Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion : Pytorch compatibility get_last_lr #5

Open
L-Reichardt opened this issue Oct 7, 2022 · 0 comments
Open

Suggestion : Pytorch compatibility get_last_lr #5

L-Reichardt opened this issue Oct 7, 2022 · 0 comments

Comments

@L-Reichardt
Copy link

Hello,

first of all thank you very much for your implementation. I noticed a small "incompatibility" when using the scheduler. Since some update, Pytorch recommends using .get_last_lr() over .get_lr(). In their code they've added a warning.

def get_lr(self):
    if not self._get_lr_called_within_step:
        warnings.warn("To get the last learning rate computed by the scheduler, "
                      "please use `get_last_lr()`.", UserWarning)

When plugging your scheduler into existing (newer) code bases, this raises an error as some use get_last_lr(). A quick fix would be adding the following to your code:

    def get_last_lr(self):
        return self.get_lr()

Best Regards,
L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant