Skip to content

Commit

Permalink
Allow Trainer.get_optimizer_cls_and_kwargs to be overridden (#31875)
Browse files Browse the repository at this point in the history
* 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 Jul 11, 2024
1 parent 5258501 commit 574e68d
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 574e68d

Please sign in to comment.