diff --git a/paddlenlp/trainer/trainer.py b/paddlenlp/trainer/trainer.py index 7c7ad82ccc11..6a03ca217dc6 100644 --- a/paddlenlp/trainer/trainer.py +++ b/paddlenlp/trainer/trainer.py @@ -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: