HansBambel/SmaAt-UNet

ImportError: cannot import name 'LearningRateLogger' from 'pytorch_lightning.callbacks'

Closed this issue · 3 comments

After searching for debug methods online,it tells me I should use "from pytorch_lightning.loggers import LearningRateLogger
",cause the LearningRateLogger model is not in pytorch_lightning.callbacks, but after changing the way of import,still give me the ImportError.
My version of pytorch_lightning is :
lightning-utilities 0.10.0
pytorch-lightning 2.1.2

Any wrong? or Are there any other models to replace LearningRateLogger?

I think you are using the paper-snapshot branch, right? Because I can only find a LearningRateMonitor in the master branch. That version is using a quite old packages. You should check out the requirements.txt there for exact versions. For example pytorch-lightning is 0.7.6.

The name seemed to change in pytorch-lightning some releases back.

Thank you for your reply.Yes,the error may due to the paper-snapshot branch. I use the master branch and seemed to solve the problem.
**By the way,**the codes you uploaded in the master branch may have some mistakes? As far as I know, the lightning.pytorch should be pytorch_lightning? Writing lightning.pytorch seems to cause errors,change to pytorch_ Lightning seems to be fine.
image
image
image

Actually, both should work:
Lightning-AI/pytorch-lightning#16688
Lightning-AI/pytorch-lightning#17095

pytorch_lightning is the old way of importing and lightning.pytorch is the new way.