Attribute Error no "_sync_params"


I run into the the error " File “/home/xz479/rds/hpc-work/miniconda3/envs/exp_gen/lib/python3.8/site-packages/torch/nn/modules/”, line 1207, in getattr
raise AttributeError(“‘{}’ object has no attribute ‘{}’”.format(
AttributeError: ‘LightningDistributedDataParallel’ object has no attribute ‘_sync_params’". while I was training on a platform with the following environment

pytorch-lightning 1.0.3

torch 1.12.1+cu113
torchaudio 0.12.1+cu113
torchmetrics 0.10.1
torchvision 0.13.1+cu113

The cuda version on this HPC platform is 11.4 which I cannot change. I suspect this is a version related error because I run the scripts just fine on my own machine with a different cuda version. Would you please help me with this?

Thank you so much!

@SpaceHunterInf This is because you are using a two-year old version of Lightning (1.0.3), but using it with a too new torch version 1.12.1 that wasn’t even released back when Lightning 1.0.3 existed.

You have these two options to resolve the problem:

  • Downgrade pytorch to an earlier version (probably 1.9 or 1.10).
  • Upgrade Lightning to a later version 1.8 or newer.

I hope this helps.

1 Like

Thank you very much! I updated lightning and solved the problem.

1 Like