Skip to content

Commit

Permalink
Update trainer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga authored Dec 23, 2023
1 parent 29e7a1e commit 84df580
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2908,7 +2908,7 @@ def _save(self, output_dir: Optional[str] = None, state_dict=None):
else:
logger.info("Trainer.model is not a `PreTrainedModel`, only saving its state dict.")
if self.args.save_safetensors:
safetensors.torch.save_file(state_dict, os.path.join(output_dir, SAFE_WEIGHTS_NAME))
safetensors.torch.save_file(state_dict, os.path.join(output_dir, SAFE_WEIGHTS_NAME), metadata={"format": "pt"})
else:
torch.save(state_dict, os.path.join(output_dir, WEIGHTS_NAME))
else:
Expand Down

0 comments on commit 84df580

Please sign in to comment.