imbue-ai / self_supervised

A Pytorch-Lightning implementation of self-supervised algorithms
MIT License
536 stars 52 forks source link

run the code you mentioned has some wrong #11

Open littleolex opened 3 years ago

littleolex commented 3 years ago

Traceback (most recent call last): File "E:/git/self_supervised/train_blog.py", line 42, in main() File "E:/git/self_supervised/train_blog.py", line 33, in main method = MoCoMethod(config) File "E:\git\self_supervised\moco.py", line 115, in init self.hparams = AttributeDict(attr.asdict(hparams)) File "E:\software\anaconda3\envs\pytorch_1_7\lib\site-packages\torch\nn\modules\module.py", line 826, in setattr object.setattr(self, name, value) AttributeError: can't set attribute

UncleSan commented 3 years ago

@littleolex I meet the same problem. Have you solve it?

joshalbrecht commented 3 years ago

This is likely because some dependency has changed and you're now using a newer version than we used.

Try installing the versions mentioned in the requirements.txt as == instead of >=

Also we used pytorch 1.6, and it looks like you have 1.7

It's likely that this is basically caused by a newer version of pytorch lightning as described here: https://discuss.pytorch.org/t/pytorch-lightning-module-cant-set-attribute-error/121125

Fubuki901 commented 3 years ago

If you use some latest version of pytorch-lightning, you will meet this problem. self.hparams = AttributeDict(attr.asdict(hparams)) Replace that with the following line. self.save_hyperparameters(AttributeDict(attr.asdict(hparams)))