Giter Club home page Giter Club logo

Comments (4)

bhheo avatar bhheo commented on May 31, 2024 16

Hi

We implement AdamP based on PyTorch 1.3
PyTorch 1.5 changes default args of in-place operations such as add_() and addcmul_().
So, following lines of AdamP makes the warnings

AdamP/adamp/adamp.py

Lines 80 to 81 in 64a6310

exp_avg.mul_(beta1).add_(1 - beta1, grad)
exp_avg_sq.mul_(beta2).addcmul_(1 - beta2, grad, grad)

p.data.add_(-step_size, perturb)

If you change it as

 exp_avg.mul_(beta1).add_(grad, alpha=1 - beta1) 
 exp_avg_sq.mul_(beta2).addcmul_(grad, grad, value=1 - beta2) 
 p.data.add_(perturb, alpha=-step_size) 

then the warnings will disappear
But, I'm not sure whether this changes is compatible with old versions. So, I will not apply the changes to master or pip.

You can also find difference in official AdamW.py
Torch 1.4
https://github.com/pytorch/pytorch/blob/74044638f755cd8667bedc73da4dbda4aa64c948/torch/optim/adamw.py#L100-L101
Torch 1.5
https://github.com/pytorch/pytorch/blob/4ff3872a2099993bf7e8c588f7182f3df777205b/torch/optim/adamw.py#L104-L105

from adamp.

SanghyukChun avatar SanghyukChun commented on May 31, 2024 3

@Junyoungpark
We just release adamp==0.3.0(https://github.com/clovaai/AdamP/releases/tag/v0.3.0).
Please retry pip install adamp --upgrade :)

from adamp.

Junyoungpark avatar Junyoungpark commented on May 31, 2024

thanks for the comments! I'll use the code snippet for torch 1.5

from adamp.

bhheo avatar bhheo commented on May 31, 2024

Inplace operation was changed in #7.
Thanks for your contribution.

from adamp.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.