Update llama.py

This commit is contained in:
Daniel Han 2025-03-12 21:42:27 -07:00
commit b23ef893b9

View file

@ -2462,6 +2462,12 @@ class FastLlamaModel:
model,
use_gradient_checkpointing = True,
):
if os.environ.get("UNSLOTH_USE_NEW_MODEL", "0") == "1":
return FastBaseModel.patch_peft_model(
model = model,
use_gradient_checkpointing = use_gradient_checkpointing,
)
pass
if not isinstance(model, PeftModelForCausalLM):
raise TypeError(
"Unsloth: Your model needs to call `.get_peft_model` first!"