lfz / DSB2017

The solution of team 'grt123' in DSB2017
MIT License
1.23k stars 420 forks source link

加载model文件夹里面的训练模型参数时出错 #100

Open Carl-Lei opened 5 years ago

Carl-Lei commented 5 years ago

@lfz 我在测试时,加载您提供的模型'classifier_param':'./model/classifier.ckpt'时出错,错误提示是 checkpoint = torch.load('./model/classifier.ckpt') File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 469, in _load result = unpickler.load() UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 16: ordinal not in range(128) 请问,该怎么解决啊?谢谢!

zhaifly commented 5 years ago

你用的是python3?

BR. -飞跃

On Aug 2, 2018, at 09:26, Carl-Lei notifications@github.com wrote:

@lfz 我在测试时,加载您提供的模型'classifier_param':'./model/classifier.ckpt'时出错,错误提示是 checkpoint = torch.load('./model/classifier.ckpt') File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 469, in _load result = unpickler.load() UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 16: ordinal not in range(128) 请问,该怎么解决啊?谢谢!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Carl-Lei commented 5 years ago

@zhaifly 是的,这个要怎么解决呢

zhaifly commented 5 years ago

换python2

BR. -飞跃

On Aug 2, 2018, at 13:44, Carl-Lei notifications@github.com wrote:

@zhaifly 是的,这个要怎么解决呢

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

bohdanchap commented 4 years ago

If you use a python 3 and the latest PyTorch you can read the classifier by specifying additional encoding parameter that escapes Unicode bytes: classifier_ckpt = torch.load('model/classifier.ckpt', encoding= 'unicode_escape')

More details on this you can find on PyTorch documentation page.