Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix `set_stance`

Daniel Hanfec1b2d5f6e5
diff --git a/pyproject.toml b/pyproject.toml
index b3ee2d7aead..8ef5fcd240d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -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",
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 883a05f82aa..bce6bb616d6 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -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",
diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py
index 5bbf4c76a68..2436db4ff47 100644
--- a/unsloth/models/vision.py
+++ b/unsloth/models/vision.py
@@ -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