Git Product home page Git Product logo

Comments (5)

Nacriema avatar Nacriema commented on June 20, 2024 1

Hi, this is the learning rate scheme I've got for testing:

  • With max_iter=100, decay_iter=1, power=1.0
  • With max_iter=100, decay_iter=5, power=1.0
  • With max_iter=100, decay_iter=1, power=2.0
  • With max_iter=100, decay_iter=5, power=2.0

from docextractor.

monniert avatar monniert commented on June 20, 2024

Hi thanks for the interest in the project! Indeed after a quick inspection this part is buggy, it is a feature I started to implement but I have never used it in the end. I will remove it, if you are interested in other schedulers there are now great built-in modules in pytorch (see https://pytorch.org/docs/stable/optim.html)
Best, Tom

from docextractor.

Nacriema avatar Nacriema commented on June 20, 2024

Hi, thank you for your response. Your code is very clean, I learned a lot from your coding style. Thank you very much !

from docextractor.

Nacriema avatar Nacriema commented on June 20, 2024

Hi, from this discussion thread: https://discuss.pytorch.org/t/solved-learning-rate-decay/6825/4, I have been implemented the PolynomialLR scheduler, but I'm not sure if it is correct. Could you please check it, thank you in advance:

class PolynomialLR(_LRScheduler):
    def __init__(self, optimizer, max_iter, decay_iter=1, power=0.9, last_epoch=-1):
        self.decay_iter = decay_iter
        self.max_iter = max_iter
        self.power = power
        super(PolynomialLR, self).__init__(optimizer, last_epoch)

    def get_lr(self):
        if self.last_epoch % self.decay_iter == 0 or self.last_epoch % self.max_iter == 0:
            factor = (1 - self.last_epoch / float(self.max_iter)) ** self.power
            return [base_lr * factor for base_lr in self.base_lrs]
        return [group['lr'] for group in self.optimizer.param_groups]

    def __str__(self):
        params = [
            'optimizer: {}'.format(self.optimizer.__class__.__name__),
            'decay_iter: {}'.format(self.decay_iter),
            'max_iter: {}'.format(self.max_iter),
            'gamma: {}'.format(self.gamma),
        ]
        return '{}({})'.format(self.__class__.__name__, ', '.join(params))

from docextractor.

monniert avatar monniert commented on June 20, 2024

Mmh from a quick look it looks good to me, to be sure you should try on a basic example and print the LR when it changes during training

from docextractor.

Related Issues (19)

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.