Move checkpoint loading before DataParallel#22
Merged
Tobias-Fischer merged 1 commit intoQVPR:mainfrom Aug 3, 2021
Merged
Conversation
Currently feature_extract.py will fail with the following error message if nGPU > 1.
=> loading checkpoint '/home/gaia.fkie.fraunhofer.de/michael.schleiss/repos/Patch-NetVLAD/patchnetvlad/./pretrained_models/pittsburgh_WPCA128.pth.tar'
Traceback (most recent call last):
File "feature_extract.py", line 174, in <module>
main()
File "feature_extract.py", line 160, in main
model.load_state_dict(checkpoint['state_dict'])
File "/home/gaia.fkie.fraunhofer.de/michael.schleiss/miniconda3/envs/netvlad/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1223, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Module:
Missing key(s) in state_dict: "encoder.module.0.weight", "encoder.module.0.bias", "encoder.module.2.weight", "encoder.module.2.bias", "encoder.module.5.weight", "encoder.module.5.bias", "encoder.module.7.weight", "encoder.module.7.bias", "encoder.module.10.weight", "encoder.module.10.bias", "encoder.module.12.weight", "encoder.module.12.bias", "encoder.module.14.weight", "encoder.module.14.bias", "encoder.module.17.weight", "encoder.module.17.bias", "encoder.module.19.weight", "encoder.module.19.bias", "encoder.module.21.weight", "encoder.module.21.bias", "encoder.module.24.weight", "encoder.module.24.bias", "encoder.module.26.weight", "encoder.module.26.bias", "encoder.module.28.weight", "encoder.module.28.bias", "pool.module.centroids", "pool.module.conv.weight".
Unexpected key(s) in state_dict: "encoder.0.weight", "encoder.0.bias", "encoder.2.weight", "encoder.2.bias", "encoder.5.weight", "encoder.5.bias", "encoder.7.weight", "encoder.7.bias", "encoder.10.weight", "encoder.10.bias", "encoder.12.weight", "encoder.12.bias", "encoder.14.weight", "encoder.14.bias", "encoder.17.weight", "encoder.17.bias", "encoder.19.weight", "encoder.19.bias", "encoder.21.weight", "encoder.21.bias", "encoder.24.weight", "encoder.24.bias", "encoder.26.weight", "encoder.26.bias", "encoder.28.weight", "encoder.28.bias", "pool.centroids", "pool.conv.weight".
Tobias-Fischer
approved these changes
Aug 3, 2021
Contributor
|
Many thanks for the catch @michaelschleiss! Looks good to me - @oravus @StephenHausler let's merge? |
Contributor
|
Yep looks good, feel free to merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently feature_extract.py will fail with the following error message if nGPU > 1.
Fixed by moving
model.load_state_dict(checkpoint['state_dict'])before wrapping the model intonn.DataParallel.