Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: can't set attribute #62

Open
lw0210 opened this issue Mar 8, 2022 · 1 comment
Open

AttributeError: can't set attribute #62

lw0210 opened this issue Mar 8, 2022 · 1 comment

Comments

@lw0210
Copy link

lw0210 commented Mar 8, 2022

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
Copy link

WenM1222 commented May 3, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants