-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Fix Densenet module keys having dot #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 this looks good, thanks!
But I'm a bit worried that we will break a lot of people's models due to that change.
@fmassa Yes, some models might be broken. But those are only the ones that use |
I'm new to pyTorch , sorry if my question is redundant. Has the solution already been provided for the issue ? I'm using the newly released pyTorch 0.4 ,
|
Yes, just reinstall torchvision. |
Hi @lanpa
I am getting the above error when I use model.load_local_state_dict . And also when I use the previously used load_state_dict . |
@kish7 You should load state dict before |
@lanpa
And still getting an error
|
load_state_dict, not load_local_state_dict
…On Fri, Apr 27, 2018 at 3:09 PM kish7 ***@***.***> wrote:
@lanpa <https://github.com/lanpa>
I changed the order of execution to
modelCheckpoint = torch.load(pathModel)
model.load_local_state_dict(modelCheckpoint['state_dict'])
model = torch.nn.DataParallel(model).cuda()
And still getting an error
File "C:\Users\Kishore\Anaconda3\lib\site-packages\torch\nn\
modules\module.py", line 532, in __getattr__
type(self).__name__, name))
AttributeError: 'DenseNet121' object has no attribute 'load_local_state_dict'
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#474 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFaWZaABCp-zwYg7H0ytUnydOnZlBAX0ks5tssQxgaJpZM4Teiq8>
.
|
@ssnl
Takes me back to the same error as before .
|
It looks like you are using a different model that is not provided by |
Hi @fmassa ,
This is how DensenetModels.py looks like . You can see that model is being imported from torchvision. Thank You. |
@kish7 sorry for the late reply. densenet121 = torchvision.models.densenet121(pretrained=True) If it still gives the same error, and if you are using the latest torchvision, I'd say it's a problem with our Windows version, but I don't have any other ideas yet |
hi @kish7 Eyal |
Hi Eyal and @kish7 , i believe that you should update to torchvision 0.2.1, which includes this patch that should fix the issue. For loading checkpoints before 0.4/0.2.1, I think it unfortunately won’t work directly. You can apply similar changes to the state dict as I did in the patch.
… On Jun 11, 2018, at 05:07, EyalRozenberg1 ***@***.***> wrote:
hi @kish7
Did you manage to solve the issue?
Eyal
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
`Traceback (most recent call last):
|
@IlSLY the solution is to rename the |
After pytorch/pytorch#6639, '.'s are no longer allowed in module keys.
cc @lanpa