From fcf162a47674c7e5a34d58254c50d067c8df46f7 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 26 Mar 2025 03:50:46 -0700 Subject: [PATCH] Bug fix --- unsloth/models/llama.py | 12 ++++++++---- unsloth/models/loader.py | 1 + unsloth/models/mapper.py | 10 ++++++++++ unsloth/models/vision.py | 5 +++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index b3b49a0436..722b50d27a 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -2024,6 +2024,14 @@ class FastLlamaModel: **kwargs, ): if os.environ.get("UNSLOTH_USE_NEW_MODEL", "0") == "1": + # Check for other PEFT args in kwargs + for (peft_arg, flag) in ( + ("finetune_vision_layers", False), + ("finetune_language_layers", True), + ("finetune_attention_modules", True), + ("finetune_mlp_modules", True), + ): + if peft_arg not in kwargs: kwargs[peft_arg] = flag return FastBaseModel.get_peft_model( model = model, r = r, @@ -2031,10 +2039,6 @@ class FastLlamaModel: lora_alpha = lora_alpha, lora_dropout = lora_dropout, bias = bias, - finetune_vision_layers = False, - finetune_language_layers = True, - finetune_attention_modules = True, - finetune_mlp_modules = True, layers_to_transform = layers_to_transform, layers_pattern = layers_pattern, use_gradient_checkpointing = use_gradient_checkpointing, diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 670e082580..c2bf51c791 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -642,6 +642,7 @@ class FastModel(FastBaseModel): trust_remote_code = trust_remote_code, ) model_types = ["siglip"] + model_types + print("model_types", model_types) # Set forced float32 env flag os.environ["UNSLOTH_FORCE_FLOAT32"] = "0" diff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.py index cf250dd498..07523ffd6a 100644 --- a/unsloth/models/mapper.py +++ b/unsloth/models/mapper.py @@ -728,6 +728,16 @@ __INT_TO_FLOAT_MAPPER = \ "mistralai/Mistral-Small-3.1-24B-Base-2503", "unsloth/Mistral-Small-3.1-24B-Base-2503-bnb-4bit", ), + "unsloth/orpheus-3b-0.1-pretrained-unsloth-bnb-4bit" : ( + "unsloth/Mistral-Small-3.1-24B-Base-2503", + "canopylabs/orpheus-3b-0.1-pretrained", + "unsloth/orpheus-3b-0.1-pretrained-bnb-4bit", + ), + "unsloth/orpheus-3b-0.1-ft-unsloth-bnb-4bit" : ( + "unsloth/Mistral-Small-3.1-24B-Base-2503", + "canopylabs/orpheus-3b-0.1-ft", + "unsloth/orpheus-3b-0.1-ft-bnb-4bit", + ), } INT_TO_FLOAT_MAPPER = {} diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index a566f023b5..6244a6146d 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -242,6 +242,11 @@ class FastBaseModel: use_gradient_checkpointing = "unsloth", **kwargs, ): + if model_types is None: + raise RuntimeError( + "Unsloth: Please use FastModel or FastVisionModel and not use FastBaseModel directly!" + ) + os.environ["UNSLOTH_USE_NEW_MODEL"] = "1" if trust_remote_code: print(