Skip to content

Commit

Permalink
update save_model
Browse files Browse the repository at this point in the history
  • Loading branch information
DesmonDay committed Oct 17, 2024
1 parent b2639ac commit 27bb12f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,11 @@ def _save_checkpoint(self, model, metrics=None):
elif isinstance(self.model, LoRAModel) or isinstance(self.model, PrefixModelForCausalLM):
self.save_model(output_dir, True, signal_dir)
else:
self.save_model(output_dir, False, signal_dir)
signature = inspect.signature(self.save_model)
if "signal_dir" in signature.parameters:
self.save_model(output_dir, False, signal_dir)
else:
self.save_model(output_dir)

# only save model state dict, ignore optimizer and scheduler
if not self.args.ignore_save_lr_and_optim:
Expand Down

0 comments on commit 27bb12f

Please sign in to comment.