Giter VIP home page Giter VIP logo

novograd-pytorch's Introduction

NovoGrad Pytorch

This repository contains a PyTorch implementation of the NovoGrad Optimizer from the paper

Stochastic Gradient Methods with Layer-wise Adaptive Moments for Training of Deep Networks

by Boris Ginsburg, Patrice Castonguay......

Summarize

NovoGrad is a first-order SGD method with gradients normalized per layer. Borrowingfrom ND-Adam, NovoGrad uses the 2nd moment for normalization and decouples weight decayfrom stochastic gradient for regularization as in AdamW. NovoGrad has half the memoryconsumption compared to Adam (similar to AdaFactor, but with a simpler moment computation).Unlike AdaFactor, NovoGrad does not require learning rate warmup.

Dependencies

  • PyTorch
  • torchvision
  • matplotlib

Usage

The code in this repository implements both NovoGrad and Adam training, with examples on the CIFAR-10 datasets.

Add the optimizer.py script to your project, and import it.

To use NovoGrad use the following command.

from optimizer import NovoGrad
optimizer = NovoGrad(model.parameters(), lr=0.01,betas=(0.95, 0.98),weight_decay=0.001)

Example

To produce the result,we use CIFAR-10 dataset for alexnet.

# use adam
python run.py --optimizer-adam --model=alexnet

# use novograd
python run.py --optimizer=novograd --model=alexnet

# use adamW
python run.py --optimizer=adamw --model=alexnet

# use lr scheduler
python run.py --optimizer=adam --model=alexnet --do_scheduler
python run.py --optimizer=novograd --model=alexnet --do_scheduler
python run.py --optimizer=adamw --model=alexnet --do_scheduler

Alexnet Results

Train loss of adam ,adamw and novograd with Alexnet on CIFAR-10.

Valid loss of adam ,adamw and novograd with Alexnet on CIFAR-10.

Valid accuracy of adam ,adamw and novograd with Alexnet on CIFAR-10.

novograd-pytorch's People

Contributors

lonepatient avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

novograd-pytorch's Issues

License

Thank you for this Repo! Can you add a License to show if others can use it?

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.