Comments (5)
Thanks for the feature! fixed a few things, all tests passed and merged!
from pytorch-lightning.
yeah, that's a good approach.
Two options:
trainer = Trainer(...)
trainer.lr_scheduler = SomeScheduler()
Or:
def learning_rate_scheduler(self):
return MyScheduler()
Option 2 is what you mentioned, and I think probably makes the most sense. It might be that you have multiple models you're running with the same trainer, and each model might use a different learning rate scheduler. Option 2 makes supporting this case easier (otherwise user has to decide which to use based on the model).
What do you think?
from pytorch-lightning.
Or:
# In Lightning module
def configure_optimizers(self):
adam = Adam()
cosine_anneal = CosineAnneal(adam,..)
sgd = SGD()
cyclic = CyclicalLR(sgd)
return [adam, sgd], [cosine_anneal, cyclic]
.....
# In Trainer base class
self.optimizers, self.lr_schedulers = model.configure_optimizers()
Because each scheduler in pytorch take exactly one optimizer as an arguments, this would make sense to group their definition together.
If no scheduler is needed, the seconds list will be empty.
def configure_optimizers(self):
adam = Adam()
sgd = SGD()
return [adam, sgd], []
from pytorch-lightning.
perfect. Mind putting in a PR with these changes? 🙃
from pytorch-lightning.
also need to remove the lr scheduling options from the trainer and update the docs. I can help with any of these if you need
from pytorch-lightning.
Related Issues (20)
- IndexError: Pytorch-lightning CompositionalMetric require tensor.item() if dim=0 whether I did so
- Huge metrics jump between epochs && Step and epoch log not matched, when accumulate_grad_batches > 1
- Does `fabric.save()` save on rank 0? HOT 3
- Turn off hpc checkpoint saving in SLURM environment if trainer.fit(..., ckpt_path="last") HOT 4
- DDP strategy doesn't work for on_validation_epoch_end, always hang HOT 4
- TensorBoardLogger does not document .add_image() function
- Passing a dataloader to save_hyperparams hangs trainer.fit
- If saved_for_backward returns NumberProxy, the value is taken from compile time, not runtime. HOT 1
- logged images are not showing up in tensorboard images.
- Enable batch size finder for distributed strategies HOT 1
- Support wandb_logger.watch() when using LightningCLI
- The packages such as libraries and models are not loading from files
- Please make it simple!
- LOG issue HOT 1
- Multi-gpu training is much lower than single gpu (due to additional processes?)
- Missing documentation for the `log_weight_decay` argument in `lightning.pytorch.callbacks.LearningRateMonitor`
- parsing issue with `save_last` parameter of `ModelCheckpoint`
- Construct objects from yaml by classmethod
- FSDP Strategy checkpoint loading
- Current FSDPPrecision does not support custom scaler for 16-mixed precision
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-lightning.