Learning rate finder using Lightning CLI #19901
Closed
Unanswered
theja-vanka
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 3 comments 3 replies
-
I implemented it the following way: my_lightning_module.py class MyLightningModule(LightningModule):
def __init__(self):
super().__init__()
self.lr = None # Gets set by LearningRateFinder if configured
def on_fit_start(self):
if self.lr:
# Overwrite learning rate after running LearningRateFinder
for optimizer in self.trainer.optimizers:
for param_group in optimizer.param_groups:
param_group["lr"] = self.lr Then I add the LearningRateFinder callback to my training config as follows: config.yaml trainer:
callbacks:
- class_path: pytorch_lightning.callbacks.LearningRateFinder Then I run the training using LightningCLI and passing the above config: python lightning_cli.py fit --config config.yaml Hope that helps! 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks you for your help. It works like a charm. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey,
My config.yaml file is
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to trigger lr_finder using Lightning CLI ?
Beta Was this translation helpful? Give feedback.
All reactions