From 14920eb3ebe193a7c9fcd9c6ee4fd03baae81574 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 26 Nov 2024 00:26:37 -0800 Subject: [PATCH] Old torch versions --- unsloth/models/_utils.py | 10 ++++++++++ unsloth/models/loader.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 73b415a6c3..ac9c9a98ca 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 334f7b76f7..198a95b313 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)