full finetuning
This commit is contained in:
parent
d6fd96cc86
commit
eda8ddbc34
2 changed files with 6 additions and 2 deletions
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue