Wrong format of pre-trained models
SourceKim opened this issue · comments
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
Hello, I meet the same problem. Have you fixed it?
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
.
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
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
as per requirement you need to use python 2.7 not 3.x
Hello, have you solved it? I found a decompression error after downloading the model file。
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')