magicleap / Atlas

Atlas: End-to-End 3D Scene Reconstruction from Posed Images
Apache License 2.0
1.82k stars 222 forks source link

AttributeError: can't set attribute #62

Open lw0210 opened 2 years ago

lw0210 commented 2 years ago

Dear, when I run on the sample scene use: python inference.py --model results/release/semseg/final.ckpt --scenes METAROOT/sample/sample1/info.json

it show that: Traceback (most recent call last): File "inference.py", line 149, in main() File "inference.py", line 127, in main model = VoxelNet.load_from_checkpoint(args.model) File "/home/liwei/.conda/envs/atlas/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 156, in load_from_checkpoint model = cls._load_model_state(checkpoint, strict=strict, kwargs) File "/home/liwei/.conda/envs/atlas/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 198, in _load_model_state model = cls(_cls_kwargs) File "/home/liwei/github/Atlas/atlas/model.py", line 93, in init self.hparams = hparams File "/home/liwei/.conda/envs/atlas/lib/python3.7/site-packages/torch/nn/modules/module.py", line 826, in setattr object.setattr(self, name, value) AttributeError: can't set attribute

What can I do can solve the problem?

WenM1222 commented 1 year ago

Hi, I also met this problem. It seems related to the newer version of pytorch-lightning. I solved this by replacing self.hparams = hparams with self.save_hyperparameters(hparams). In my case, I used pytorch-lightning 1.5.0, and PyTorch 1.10.