Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LambdaLR does not follow PyTorch's LRScheduler API #346

Open
railgun122 opened this issue Feb 14, 2024 · 1 comment
Open

LambdaLR does not follow PyTorch's LRScheduler API #346

railgun122 opened this issue Feb 14, 2024 · 1 comment

Comments

@railgun122
Copy link

Hi I am facing trouble using LambdaLR scheduler

The details of the error is shown as followings:

Traceback (most recent call last):
File "latent-diffusion/main.py", line 720, in
trainer.fit(model, data)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 770, in fit
self._call_and_handle_interrupt(
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 721, in _call_and_handle_interrupt
return self.strategy.launcher.launch(trainer_fn, *args, trainer=self, **kwargs)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 93, in launch
return function(*args, **kwargs)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 811, in _fit_impl
results = self._run(model, ckpt_path=self.ckpt_path)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1217, in _run
self.strategy.setup(self)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/strategies/ddp.py", line 179, in setup
self.setup_optimizers(trainer)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/strategies/strategy.py", line 128, in setup_optimizers
self.optimizers, self.lr_scheduler_configs, self.optimizer_frequencies = _init_optimizers_and_lr_schedulers(
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/optimizer.py", line 195, in _init_optimizers_and_lr_schedulers
_validate_scheduler_api(lr_scheduler_configs, model)
File "/home/edsr/anaconda3/envs/ldm/lib/python3.8/site-packages/pytorch_lightning/core/optimizer.py", line 350, in _validate_scheduler_api
raise MisconfigurationException(
pytorch_lightning.utilities.exceptions.MisconfigurationException: The provided lr scheduler LambdaLR doesn't follow PyTorch's LRScheduler API. You should override the LightningModule.lr_scheduler_step hook with your own logic if you are using a custom LR scheduler.

Please can anyone help me with it?
It will be so appreciated

@mchan-sony
Copy link

Try downgrading to an earlier version of pytorch-lightning by running something like pip install pytorch-lightning==1.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants