Open nlvtuan opened 3 years ago
I am wondering about this too - I think it strips off the beginning of the "module." state_dict entries so that it matches the model state_dict. I think the issue is that when training with parallel GPUs each model state_dict is nested under separate "module" dict entries. It is really frustrating me because after training the model and loading it using test.py following this schema the outputs are nonsense and it seems like it is not loading the trained model at all.
I seemed to have solved the issues I'm facing by following this schema for distributed data parallel: https://pytorch.org/tutorials/intermediate/ddp_tutorial.html
This way the remapping above is not needed.
Hi everyone,
Could you explain for me the meaning of this line https://github.com/HRNet/HRNet-Semantic-Segmentation/blob/8037a7fb867b58d885b26b1ceb8283a7ee252851/tools/test.py#L82
pretrained_dict = {k[6:]: v for k, v in pretrained_dict.items() if k[6:] in model_dict.keys()}
What are
k
andv
and why is6
ink[6]
.Thanks for your time!
key is start with “module” in muti-gpu training.
Hi everyone,
Could you explain for me the meaning of this line https://github.com/HRNet/HRNet-Semantic-Segmentation/blob/8037a7fb867b58d885b26b1ceb8283a7ee252851/tools/test.py#L82 https://github.com/HRNet/HRNet-Semantic-Segmentation/blob/8037a7fb867b58d885b26b1ceb8283a7ee252851/tools/test.py#L83
pretrained_dict = {k[6:]: v for k, v in pretrained_dict.items() if k[6:] in model_dict.keys()}
What are
k
andv
and why is6
ink[6]
.Thanks for your time!