question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

cc @awaelchli @ananthsub @ninginthecloud @rohitgr7

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jdhorwoodcommented, Aug 8, 2022

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.

0reactions
carmoccacommented, Jul 28, 2022

Hi @jdavid04. Is this still an issue? Are you able to finish your PR?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found