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

Deprecation warning thrown from use of old add_() signature; fix #21

Open
tristanengst opened this issue May 31, 2022 · 3 comments
Open

Comments

@tristanengst
Copy link

It seems as though the usage of add_() in lars.py is deprecated. I get

home/tristanengst/miniconda3/envs/py39ISICLE/lib/python3.9/site-packages/torchlars/lars.py:140: UserWarning: This overload of add_ is deprecated:
        add_(Number alpha, Tensor other)
Consider using one of the following signatures instead:
        add_(Tensor other, *, Number alpha) (Triggered internally at  /opt/conda/conda-bld/pytorch_1639180487213/work/torch/csrc/utils/python_arg_parser.cpp:1050.)
  p.grad.add_(weight_decay, p.data)

whenever I use the optimizer. I believe the signature of add_() was changed in PyTorch 1.5, so we're well past a time when the old signature could represent a somewhat current PyTorch version.

Unless I'm mistaken, this can be fixed by changing line 140 of lars.py from

p.grad.add_(weight_decay, p.data)

to

p.grad.add_(p.data, alpha=weight_decay)

Would it be possible to see this change adopted for versions of torchlars installed alongside newer PyTorch versions? Thanks!

@RylanSchaeffer
Copy link

Has there been any update on this?

@YoojLee
Copy link

YoojLee commented Oct 26, 2022

@RylanSchaeffer Not yet :(

@LiuYing-1
Copy link

Hi guys, does this lib still work even with the deprecation? thanks in advance.

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

4 participants