Git Product home page Git Product logo

Comments (5)

lucasliunju avatar lucasliunju commented on June 20, 2024 1

Dear Devansh,
Thank you very much for your reply. I have reproduced the results based on cosine decay, which is also the same as the results in the paper. Thanks again!

Best,
Lucas

from lpf-sgd.

devansh20la avatar devansh20la commented on June 20, 2024

I think you might be looking at the wrong file. This was from another optimizer.

EDIT: I had a naming error. The code you are looking for starts here:

with torch.no_grad():
noise = []
for mp in model.parameters():
if len(mp.shape) > 1:
sh = mp.shape
sh_mul = np.prod(sh[1:])
temp = mp.view(sh[0], -1).norm(dim=1, keepdim=True).repeat(1, sh_mul).view(mp.shape)
temp = torch.normal(0, args.std*temp).to(mp.data.device)
else:
temp = torch.empty_like(mp, device=mp.data.device)
temp.normal_(0, args.std*(mp.view(-1).norm().item() + 1e-16))
noise.append(temp)
mp.data.add_(noise[-1])
# single sample convolution approximation
with torch.set_grad_enabled(True):
outputs = model(inputs)
batch_loss = criterion(outputs, targets) / args.M
batch_loss.backward()
# going back to without theta
with torch.no_grad():
for mp, n in zip(model.parameters(), noise):
mp.data.sub_(n)

from lpf-sgd.

lucasliunju avatar lucasliunju commented on June 20, 2024

Thank you very much for your reply!

from lpf-sgd.

lucasliunju avatar lucasliunju commented on June 20, 2024

Dear Devansh,

This is a great work for me and LPF-SGD can significantly improve the performance compared with vanilla momentum sgd. I would like to ask whether cosine learning rate decay can also work for LPF-SGD on WRN and ResNet. Since I find the most learning rate decay is StepLR

Thank you very much!

Best,
Lucas

from lpf-sgd.

devansh20la avatar devansh20la commented on June 20, 2024

I did not try the cosine learning rate decay. I can't think of any reason it shouldn't work, it might just require finetuning to find the best hyperparameters.

from lpf-sgd.

Related Issues (3)

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.