diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 897f9a4475..95182e0179 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -221,11 +221,13 @@ class _RaiseUninitialized(logging.Handler): def __init__(self): super().__init__() def emit(self, record): - if "some weights of" in str(record).lower(): + record_lower = str(record).lower() + if "some weights of" in record_lower and "score.weight" not in record_lower: raise Exception( f"Unsloth: Critical error since some weights are not initialized.\n"\ f"Please try updating Unsloth, transformers and timm via:\n"\ - f"`pip install --upgrade --force-reinstall --no-cache-dir --no-deps unsloth unsloth_zoo transformers timm`\n" + f"`pip install --upgrade --force-reinstall --no-cache-dir --no-deps unsloth unsloth_zoo transformers timm`\n"\ + f"{str(record)}" ) pass class RaiseUninitialized: diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 8b8ec1b1a0..a5b7d18164 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -858,7 +858,7 @@ class FastModel(FastBaseModel): trust_remote_code = trust_remote_code, ) # Patch it as well! - model = FastBaseModel.post_patch_model(model, use_gradient_checkpointing) + model = FastBaseModel.post_patch_model(model, use_gradient_checkpointing, trust_remote_code = trust_remote_code) pass return model, tokenizer pass diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 2436db4ff4..246e5d5671 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -608,7 +608,7 @@ class FastBaseModel: finetune_mlp_modules = finetune_mlp_modules, ) else: - assert(type(target_modules) in (list, tuple,)) + assert(type(target_modules) in (list, tuple, str,)) pass # Clear deleted GPU items