mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
allow modules_to_save (for trainable layernorm)
This commit is contained in:
parent
7c5fe3bc5b
commit
37c5185fae
2 changed files with 7 additions and 2 deletions
|
|
@ -240,6 +240,10 @@ class LoRAArguments:
|
|||
default=None,
|
||||
metadata={"help": ("LoRA target modules.")},
|
||||
)
|
||||
modules_to_save: Optional[list[str]] = field(
|
||||
default=None,
|
||||
metadata={"help": ("Modules to save.")},
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
|
|
@ -142,8 +142,9 @@ def get_model(
|
|||
if peft_config is not None:
|
||||
model = PeftModel(model, peft_config)
|
||||
model.train(train)
|
||||
for param in model.parameters():
|
||||
param.requires_grad = requires_grad
|
||||
for name, param in model.named_parameters():
|
||||
if "modules_to_save" not in name:
|
||||
param.requires_grad = requires_grad
|
||||
return model
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue