• Stars
    star
    969
  • Rank 47,227 (Top 1.0 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gradually-Warmup Learning Rate Scheduler for PyTorch

pytorch-gradual-warmup-lr

Gradually warm-up(increasing) learning rate for pytorch's optimizer. Proposed in 'Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour'.

example tensorboard

Example : Gradual Warmup for 100 epoch, after that, use cosine-annealing.

Install

$ pip install git+https://github.com/ildoonet/pytorch-gradual-warmup-lr.git

Usage

See run.py file.

import torch
from torch.optim.lr_scheduler import StepLR, ExponentialLR
from torch.optim.sgd import SGD

from warmup_scheduler import GradualWarmupScheduler


if __name__ == '__main__':
    model = [torch.nn.Parameter(torch.randn(2, 2, requires_grad=True))]
    optim = SGD(model, 0.1)

    # scheduler_warmup is chained with schduler_steplr
    scheduler_steplr = StepLR(optim, step_size=10, gamma=0.1)
    scheduler_warmup = GradualWarmupScheduler(optim, multiplier=1, total_epoch=5, after_scheduler=scheduler_steplr)

    # this zero gradient update is needed to avoid a warning message, issue #8.
    optim.zero_grad()
    optim.step()

    for epoch in range(1, 20):
        scheduler_warmup.step(epoch)
        print(epoch, optim.param_groups[0]['lr'])

        optim.step()    # backward pass (update network)

More Repositories

1

pytorch-randaugment

Unofficial PyTorch Reimplementation of RandAugment.
Python
627
star
2

cutmix

a Ready-to-use PyTorch Extension of Unofficial CutMix Implementations with more improved performance.
Python
167
star
3

unsupervised-data-augmentation

Unofficial PyTorch Implementation of Unsupervised Data Augmentation.
Python
147
star
4

remote-dataloader

PyTorch DataLoader processed in multiple remote computation machines for heavy data processings
Python
66
star
5

data-science-bowl-2018

End-to-end one-class instance segmentation based on U-Net architecture for Data Science Bowl 2018 in Kaggle
Python
57
star
6

tf-lcnn

Tensorflow implementation for 'LCNN: Lookup-based Convolutional Neural Network'. Predict Faster using Models Trained Fast with Multi-GPUs
Python
40
star
7

kaggle-human-protein-atlas-image-classification

Kaggle 2018 @ Human Protein Atlas Image Classification
Python
34
star
8

simulated-annealing-for-tsp

This code is to solve traveling salesman problem by using simulated annealing meta heuristic.
C++
28
star
9

deep-object-detection-models

Deep Learning으둜 ν•™μŠ΅λœ Object Detection Model 에 λŒ€ν•΄ μ •λ¦¬ν•œ Archive μž„.
19
star
10

pystopwatch2

Multi Stopwatch for Python
Python
12
star
11

ai-starthon-2019

Codes used on AI Starthon 2019. 1st place in total.
Python
8
star
12

chat-ui-dashboard

Svelte
8
star
13

wedding-invitation

CSS
4
star
14

evonorm

Pytorch Implementation of EvoNorm which reproduces paper's result
Python
4
star
15

HttpReverseProxy

HTTP reverse proxy designed to facilitate secure access to HTTP services located within an internal network
Python
3
star
16

tbreader

TensorBoard Log Parser
Python
2
star