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

Wrong format of pre-trained models #6

Open
SourceKim opened this issue Apr 5, 2020 · 7 comments
Open

Wrong format of pre-trained models #6

SourceKim opened this issue Apr 5, 2020 · 7 comments

Comments

@SourceKim
Copy link

I can't unarchive them by tar or 7zip.
Here are the log:

7z.exe a mobilenetv2_total_with_prior_channel.tar

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Open archive: mobilenetv2_total_with_prior_channel.tar
ERROR: mobilenetv2_total_with_prior_channel.tar
mobilenetv2_total_with_prior_channel.tar
Open ERROR: Can not open the file as [tar] archive

ERRORS:
Is not archive

@ypw1996
Copy link

ypw1996 commented May 28, 2020

Hello, I meet the same problem. Have you fixed it?

@Novaal
Copy link

Novaal commented Jun 3, 2020

You don't need to extract them. Just rename them accordingly to the used config file: e.g myexp/mobilenetv2_video_total/single_224_without_group/model_best.pth.tar.

@NhatRio
Copy link

NhatRio commented Aug 27, 2020

Hi @dong-x16 , Thanks a lot for your impressive work.
I got an error while loading the pre-trained model. Specifically, it was at "checkpoint_video = torch.load(bestModelFile)" in the file VideoTest.ipynb. Here is the error:

    53 if os.path.isfile(bestModelFile):
---> 54     checkpoint_video = torch.load(bestModelFile)
     55     netmodel_video.load_state_dict(checkpoint_video['state_dict'])
     56     print ("minLoss: ", checkpoint_video['minLoss'], checkpoint_video['epoch'])

1 frames
/usr/local/lib/python3.6/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    763     unpickler = pickle_module.Unpickler(f, **pickle_load_args)
    764     unpickler.persistent_load = persistent_load
--> 765     result = unpickler.load()
    766 
    767     deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte   

Do you think this problem caused by the file "model_best.pth.tar"?

Have a nice day!

Nhat

@gruossomonica
Copy link

Hi,
I get a similar error when I load the model mobilenetv2_total_with_prior_channel.tar in VideoTest.ipynb.
I changed the model_root and the model filename accordingly with my folders and files.

---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-13-0ef5f99e810e> in <module>
     51 bestModelFile = os.path.join(exp_args.model_root, 'mobilenetv2_total_with_prior_channel.tar')
     52 if os.path.isfile(bestModelFile):
---> 53     checkpoint_video = torch.load(bestModelFile)
     54     netmodel_video.load_state_dict(checkpoint_video['state_dict'])
     55     print ("minLoss: ", checkpoint_video['minLoss'], checkpoint_video['epoch'])

~\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module)
    366         f = open(f, 'rb')
    367     try:
--> 368         return _load(f, map_location, pickle_module)
    369     finally:
    370         if new_fd:

~\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\serialization.py in _load(f, map_location, pickle_module)
    540     unpickler = pickle_module.Unpickler(f)
    541     unpickler.persistent_load = persistent_load
--> 542     result = unpickler.load()
    543 
    544     deserialized_storage_keys = pickle_module.load(f)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb7 in position 3: ordinal not in range(128)

Looking forward to your reply.
Best regards.

Monica Gruosso

@shivSD
Copy link

shivSD commented Nov 4, 2020

as per requirement you need to use python 2.7 not 3.x

@DAVID-Hown
Copy link

Hello, have you solved it? I found a decompression error after downloading the model file。

@vigneshchandar
Copy link

For the weight file, I'd downloaded, the encoding was in 'latin1' format.

Try passing encoding='latin1' when loading the file.
torch.load(weight_file_path, map_location=torch.device('cpu'), encoding='latin1')

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

8 participants