-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
duplicateThis issue or pull request already existsThis issue or pull request already existsquestionFurther information is requestedFurther information is requested
Description
❓ Questions and Help
Before asking:
- search the issues. Done
- search the docs. Done
What is your question?
When I'm loading a Lightning model with LitModel.load_from_checkpoint(path) I always get this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-5cfc485836df> in <module>
1 # OPTION 2:
2 # test after loading weights
----> 3 model = LitModel.load_from_checkpoint("lightning_logs/version_0/checkpoints/epoch=2.ckpt")
~/anaconda3/envs/pytorch-lightning/lib/python3.7/site-packages/pytorch_lightning/core/saving.py in load_from_checkpoint(cls, checkpoint_path, map_location, hparams_file, tags_csv, *args, **kwargs)
169 checkpoint[cls.CHECKPOINT_HYPER_PARAMS_KEY].update(kwargs)
170
--> 171 model = cls._load_model_state(checkpoint, *args, **kwargs)
172 return model
173
~/anaconda3/envs/pytorch-lightning/lib/python3.7/site-packages/pytorch_lightning/core/saving.py in _load_model_state(cls, checkpoint, *args, **kwargs)
195
196 # load the state_dict on the model automatically
--> 197 model = cls(*args, **kwargs)
198 model.load_state_dict(checkpoint['state_dict'])
199
TypeError: __init__() takes 1 positional argument but 2 were given
Code
Simple example is from https://pytorch-lightning.readthedocs.io/en/latest/new-project.html.
Custom LightModul is very similar but I am using other data, sets, and loaders and a torchvision ResNet.
What have you tried?
I tried different checkpoints as well as relative and absolute paths.
Checkpoints are loaded from lightning_logs/version_0/checkpoints/ which where saved automatically after stopping training.
Setup and training itself works without problems.
I also get the same error with the more complex setup.
Maybe I don't see something super obvious?
Thank you very much & kind regards
What's your environment?
- OS: Ubuntu 18.04
- Packaging: Conda
- Version:
pytorch_select 0.2
pytorch 1.3.1
pytorch-lightning 0.8.0
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already existsquestionFurther information is requestedFurther information is requested