Comments (2)
I don't know how to use pytorch_warmup
inside pytorch-lightning
. But you could use it by reading pytorch-lightning
docs: Bring your own Custom Learning Rate Schedulers
import torch
import pytorch_warmup as warmup
def configure_optimizers(self):
optimizer = torch.optim.AdamW(self.model..parameters(), lr=0.001, betas=(0.9, 0.999), weight_decay=0.01)
num_steps = len(self.train_dataloader) * self.num_epochs # I don't know whether this line is correct or not.
lr_scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=num_steps)
warmup_scheduler = warmup.UntunedLinearWarmup(optimizer)
return [optimizer], [{"scheduler": (lr_scheduler, warmup_scheduler), "interval": "step"}]
def lr_scheduler_step(self, scheduler, optimizer_idx, metric):
lr_scheduler, warmup_scheduler = scheduler
with warmup_scheduler.dampening():
lr_scheduler.step()
from pytorch_warmup.
I have just done it on Colab:
PyTorch Lightning with pytorch_warmup.ipynb
from pytorch_warmup.
Related Issues (14)
- Unexpected keyword argument `warmup_period` HOT 1
- Why did my learning rate drop from the initial lr HOT 3
- UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()` HOT 2
- My lr jumped from 0.01 to 0.0498 without any linear signs. HOT 2
- About the learning rate in scheduler HOT 1
- How to schedule LR with warmup on global_step initially, and then epoches after warmup? HOT 9
- Can the warmup_scheduler update the learning rate every epoch and not every batch? HOT 2
- Why is warmup better than RAdam? HOT 3
- difference of this library with hugging face HOT 3
- What is the decay rule of thumb? HOT 3
- UserWarning: The epoch parameter in `scheduler.step()` was not necessary and is being deprecated where possible. HOT 2
- no attribute named dampening HOT 1
- License file is not included in sdist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch_warmup.