Checkpoint loading patch fails when using a pre-trained featurizer within a Lightning module.
See original GitHub issue🐛 Bug
I am getting the error: ModuleNotFoundError: No module named 'pytorch_lightning.utilities.argparse_utils'
coming from
migration.py when loading checkpoints for models which leverage pre-trained models also trained via Pytorch Lightning.
Essentially, the context manager is called recursively, since the model relies on features generated from a pre-trained model. This model also requires a call to load_from_checkpoint(). As a result, the exit function of the context manager gets called twice in a row, with the error occurring on the second call.
Expected behavior
I would expect checkpoint loading to not raise en error because of a pre-trained featurizer model.
Environment
pytorch-lightning == 1.6.1
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Checkpoint loading patch fails when using a pre-trained ...
Bug I am getting the error: ModuleNotFoundError: No module named ... fails when using a pre-trained featurizer within a Lightning module.
Read more >Unable to load custom pretrained weight in Pytorch Lightning
The reason why you're getting this error is because you are trying to load your PyTorch's model weights into the Lightning module.
Read more >Checkpointing — PyTorch Lightning 1.8.5.post0 documentation
Learn to save and load checkpoints ... Advanced. Enable cloud-based checkpointing and composable checkpoints. advanced ... Dig into the ModelCheckpoint API.
Read more >Models - Hugging Face
load_tf_weights ( Callable ) — A python method for loading a TensorFlow checkpoint in a PyTorch model, taking as arguments: model (PreTrainedModel) —...
Read more >Unable to load pretrained weight into custom model in Pytorch ...
I am having trouble loading the pretrained weight into the Pytorch Lightning model. The Pytorch Lightning code works but I have limited data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @carmocca, sorry for not coming back to this. I haven’t been able to reproduce this in a simple setting and the original code causing the issue has been simplified/resolved as well. I think there is still a scenario in which an issue might arise but it likely involves a convoluted example that can be more easily resolved outside of PL. So I think the issue can be closed for now.
Hi @jdavid04. Is this still an issue? Are you able to finish your PR?