Fix set_stance

This commit is contained in:
Daniel Han 2025-07-23 05:19:08 -07:00
commit f04dc8a07b
3 changed files with 13 additions and 5 deletions

View file

@ -37,7 +37,7 @@ triton = [
]
huggingface = [
"unsloth_zoo>=2025.7.8",
"unsloth_zoo>=2025.7.9",
"packaging",
"tyro",
"transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3,!=4.53.0",
@ -381,7 +381,7 @@ colab-ampere-torch220 = [
"flash-attn>=2.6.3",
]
colab-new = [
"unsloth_zoo>=2025.7.8",
"unsloth_zoo>=2025.7.9",
"packaging",
"tyro",
"transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3,!=4.53.0",

View file

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "2025.7.7"
__version__ = "2025.7.8"
__all__ = [
"SUPPORTS_BFLOAT16",

View file

@ -85,6 +85,12 @@ from unsloth_zoo.vllm_utils import (
return_lora_modules,
)
try:
torch_compiler_set_stance = torch.compiler.set_stance
except:
torch_compiler_set_stance = None
pass
def unsloth_base_fast_generate(
self,
*args,
@ -756,7 +762,8 @@ class FastBaseModel:
# Must enable returning logits
os.environ["UNSLOTH_RETURN_LOGITS"] = "1"
# Turn off skip guards and set stance to default
torch.compiler.set_stance(stance = "default", skip_guard_eval_unsafe = False)
if torch_compiler_set_stance is not None:
torch_compiler_set_stance(stance = "default", skip_guard_eval_unsafe = False)
return model
pass
@ -804,7 +811,8 @@ class FastBaseModel:
# Can re-enable not returning logits
os.environ["UNSLOTH_RETURN_LOGITS"] = "0"
# Turn off skip guards and set stance to default
torch.compiler.set_stance(stance = "default", skip_guard_eval_unsafe = False)
if torch_compiler_set_stance is not None:
torch_compiler_set_stance(stance = "default", skip_guard_eval_unsafe = False)
return model
pass
pass