HansBambel / SmaAt-UNet

PyTorch-Code for the Paper "SmaAt-UNet: Precipitation Nowcasting using a Small, Attentive UNet-Architecture"
230 stars 43 forks source link

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

Closed ponyger closed 6 months ago

ponyger commented 9 months ago

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 pytorchlightning is : lightning-utilities 0.10.0 pytorch-lightning 2.1.2_ Any wrong? or Are there any other models to replace LearningRateLogger?

HansBambel commented 9 months ago

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.

ponyger commented 9 months ago

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 _pytorchlightning? Writing lightning.pytorch seems to cause errors,change to pytorch_ Lightning seems to be fine. image image image

HansBambel commented 9 months ago

Actually, both should work: https://github.com/Lightning-AI/pytorch-lightning/discussions/16688 https://github.com/Lightning-AI/pytorch-lightning/discussions/17095

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