Skip to content
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

Unable to load sk_resnet50.pth #29

Open
ghost opened this issue Dec 30, 2019 · 3 comments
Open

Unable to load sk_resnet50.pth #29

ghost opened this issue Dec 30, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 30, 2019

Hi, I got the following error when try to load sk_resnet50.pth

>>> checkpoint1 = torch.load('sk_resnet50.pth.tar', map_location=torch.device('cpu'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jinchen/.local/lib/python3.6/site-packages/torch/serialization.py", line 426, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/home/jinchen/.local/lib/python3.6/site-packages/torch/serialization.py", line 620, in _load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 3594295 more bytes. The file might be corrupted.

is t because map_location uses CPU? but others seem fine, only this model has the error
Thanks!

@timothyMbehold
Copy link

timothyMbehold commented Jun 5, 2020

Hey there, got exactly the same issue and I'm using CUDA as a device.

SK_resnet101 works perfectly though

@creater-zq
Copy link

creater-zq commented Feb 15, 2021

Hey there, got exactly the same issue and I'm using CUDA as a device.

SK_resnet101 works perfectly though

my code:

     def get_se_resnet101(path_state_dict, device, vis_model=False):

             model = resnet_se.se_resnet101() 

            if path_state_dict:

                 pretrained_state_dict = torch.load(path_state_dict, map_location=torch.device('cpu')) 

                 model.load_state_dict(pretrained_state_dict, )

`

error:

raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for ResNet:

  Missing key(s) in state_dict: "conv1.weight", "bn1.weight", "bn1.bias", "bn1.running_mean", "bn1.running_var", ......

  Unexpected key(s) in state_dict: "epoch", "state_dict", "acc", "best_acc", "optimizer"

How to solve it? thanks

@creater-zq
Copy link

creater-zq commented Feb 15, 2021

Hi, I got the following error when try to load sk_resnet50.pth

>>> checkpoint1 = torch.load('sk_resnet50.pth.tar', map_location=torch.device('cpu'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jinchen/.local/lib/python3.6/site-packages/torch/serialization.py", line 426, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/home/jinchen/.local/lib/python3.6/site-packages/torch/serialization.py", line 620, in _load
    deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 3594295 more bytes. The file might be corrupted.

is t because map_location uses CPU? but others seem fine, only this model has the error
Thanks!

my code:

     def get_se_resnet101(path_state_dict, device, vis_model=False):

             model = resnet_se.se_resnet101() 

            if path_state_dict:

                 pretrained_state_dict = torch.load(path_state_dict, map_location=torch.device('cpu')) 

                 model.load_state_dict(pretrained_state_dict, )

`

error:

raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for ResNet:

  Missing key(s) in state_dict: "conv1.weight", "bn1.weight", "bn1.bias", "bn1.running_mean", "bn1.running_var", ......

How to address this issue? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants