This commit is contained in:
Daniel Han 2025-03-26 03:50:46 -07:00
commit fcf162a476
4 changed files with 24 additions and 4 deletions

View file

@ -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,

View file

@ -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"

View file

@ -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 = {}

View file

@ -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(