diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index 3504037b66..aa5a1c5746 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -2016,6 +2016,10 @@ class FastLlamaModel: temporary_location = "_unsloth_temporary_saved_buffers", **kwargs, ): + if os.environ.get("UNSLOTH_ENABLE_FULL_FINETUNING", "0") == "1": + print("Unsloth: Full finetuning is enabled, so .get_peft_model has no effect") + return model + pass transformers_set_seed(random_state) if use_gradient_checkpointing == "unsloth": diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 2830783756..371b4795ee 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -25,7 +25,7 @@ from ..kernels import ( post_patch_loss_function, ) from ._utils import __version__ -from peft import LoraConfig, TaskType, get_peft_model +from peft import LoraConfig, TaskType, get_peft_model as _get_peft_model from transformers import set_seed as transformers_set_seed from unsloth_zoo.peft_utils import ( get_peft_regex, @@ -341,7 +341,7 @@ class FastBaseModel: model, use_gradient_checkpointing = use_gradient_checkpointing, ) - model = get_peft_model(model, lora_config) + model = _get_peft_model(model, lora_config) # Enable gradients on modules which are trainable requires_grad_for_gradient_checkpointing(model)