Skip to content

Commit

Permalink
fix model state_dict retrieving in zero3 (#576)
Browse files Browse the repository at this point in the history
Co-authored-by: 聂靖入 <niejingru@bytedance.com>
  • Loading branch information
Jingru and 聂靖入 authored Oct 30, 2023
1 parent 91a0f43 commit c26d450
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trlx/trainer/accelerate_ppo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def save_pretrained(self, directory: Optional[str] = None, **kwargs):

# Save only the base model, so that is could be loaded directly
# with Hugging Face's `from_pretrained` method
state_dict = self.accelerator.get_state_dict(self.model.base_model)
state_dict = self.accelerator.get_state_dict(self.model, unwrap=True)

self.accelerator.unwrap_model(self.model).save_pretrained(
directory,
Expand Down

0 comments on commit c26d450

Please # to comment.