How to save / load part of checkpoint?
See original GitHub issue❓ Questions/Help/Support
Hi @vfdev-5 ,
I have a feature request from Clara users for transfer learning: I trained a model with 4 output classes, then I want to load the checkpoint for a 3 classes task.
How to save weights except for the last output layer in ignite Checkpoint
handler? Or skip the last layer when loading checkpoint in the handler?
Thanks in advance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Saving and loading a general checkpoint in PyTorch
A common PyTorch convention is to save these checkpoints using the .tar file extension. To load the items, first initialize the model and...
Read more >Save and load models | TensorFlow Core
Save and load models ; Setup. Installs and imports; Get an example dataset; Define a model ; Save checkpoints during training. Checkpoint callback ......
Read more >How to Save and Load Models in PyTorch - Wandb
This article is a tutorial that covers how to correctly save and load your trained machine learning models in PyTorch using Weights &...
Read more >How to save and load models in Pytorch - YouTube
Let's say you have a model that is working but now you want to be able to save a checkpoint and load it...
Read more >Load that &%$*# Checkpoint! - Towards Data Science
Just load what you need. You might not want all of the info that I loaded in this checkpoint, but I'm including the...
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 @vfdev-5 ,
Thanks for your detailed solutions! I prefer the first solution because we may not know the exact layers affected by class numbers, for example, maybe a different input channel number will affect several convolution layers. Maybe we can enhance the MONAI
CheckpointLoader
with thestrick_shape
option later, I submitted ticket: https://github.com/Project-MONAI/MONAI/issues/1939Thanks.
I think we can close this issue as solved.