Skip to content

Commit

Permalink
Allow Trainer.get_optimizer_cls_and_kwargs to be overridden (huggin…
Browse files Browse the repository at this point in the history
…gface#31875)

* Change `Trainer.get_optimizer_cls_and_kwargs` to `self.`

* Make `get_optimizer_cls_and_kwargs` an instance method

* Fixing typo

* Revert `get_optimizer_cls_and_kwargs` to staticmethod

* restore newline to trainer.py eof
  • Loading branch information
apoorvkh authored and MHRDYN7 committed Jul 23, 2024
1 parent fb1003c commit 773cc63
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 @@ -1079,7 +1079,7 @@ def create_optimizer(self):
},
]

optimizer_cls, optimizer_kwargs = Trainer.get_optimizer_cls_and_kwargs(self.args, opt_model)
optimizer_cls, optimizer_kwargs = self.get_optimizer_cls_and_kwargs(self.args, opt_model)

# Overwrite `params` in case it's created by `get_optimizer_cls_and_kwargs`
# e.g. for GaLore optimizer.
Expand Down

0 comments on commit 773cc63

Please sign in to comment.