-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix #565 #582
Fix #565 #582
Conversation
@@ -432,13 +432,15 @@ def _load_conv_params(conv, state_dict_tv, module_name_tv, | |||
""" | |||
|
|||
weight_tv_name = module_name_tv + '.weight' | |||
conv.weight.data.copy_(state_dict_tv[weight_tv_name]) | |||
loaded_param_names.append(weight_tv_name) | |||
if conv.weight.data.shape == state_dict_tv[weight_tv_name].shape: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to issue some warning if the shapes are mismatched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no warning is OK, since:
- The shape mismatch may only happen when in_channels != 3. In this case, the shape mismatch is not unexpected. Users assume that pre-train weights are for other modules (except conv1).
- There is already a warning message in
_load_torchvision_checkpoint
, which indicates that parameters ofconv1
andbn1
are not loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its okay if pytorch could warn the user. As long as there are warnings, I'm ok with the change.
Codecov Report
@@ Coverage Diff @@
## master #582 +/- ##
==========================================
- Coverage 84.17% 84.13% -0.04%
==========================================
Files 121 121
Lines 8613 8617 +4
Branches 1427 1431 +4
==========================================
Hits 7250 7250
- Misses 1014 1015 +1
- Partials 349 352 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Changes are not covered by tests |
I think it is covered: I add a testing case in which the ResNet is initialized with |
Then there must be tracking issues in Codcov |
In our unit test refactor doc, |
Sorry I didn't see it before, I will reorganize related unittests. |
No description provided.