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.

Old torch versions

Daniel Han14920eb3ebe1
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 73b415a6c3f..ac9c9a98ca6 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -1131,6 +1131,16 @@ def unsloth_compile_transformers(
disable = False,
return_logits = False,
):
+ if Version(torch_version) < Version("2.4.0"):
+ print(
+ "="*30 + \
+ "Unsloth: Unfortunately Unsloth vision and other newer optimized models need Torch 2.4 or later.\n"\
+ f"You have Torch version {torch_version}. Please upgrade your Torch version by visiting https://pytorch.org/\n"\
+ "For now your models will not get optimized, but will still work for now!"
+ )
+ return
+ pass
+
if disable: return
model_types = get_transformers_model_type(
model_name = model_name,
diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py
index 334f7b76f7f..198a95b313a 100644
--- a/unsloth/models/loader.py
+++ b/unsloth/models/loader.py
@@ -401,6 +401,7 @@ class FastVisionModel(FastBaseVisionModel):
revision = revision,
trust_remote_code = trust_remote_code,
)
+ print("Model config", model_config)
is_model = True
except Exception as error:
autoconfig_error = str(error)
@@ -412,6 +413,7 @@ class FastVisionModel(FastBaseVisionModel):
revision = revision,
trust_remote_code = trust_remote_code,
)
+ print("PEFT config", peft_config)
is_peft = True
except Exception as error:
peft_error = str(error)