question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnicodeDecodeError when loading the pre-trained model

See original GitHub issue

Thank you for your great work!

When I tried to load the model you provided here, I encountered the following error:

Traceback (most recent call last):
  File "tools/run_net.py", line 152, in <module>
    main()
  File "tools/run_net.py", line 128, in main
    train(cfg=cfg)
  File "/home/ubuntu/projects/SlowFast/tools/train_net.py", line 217, in train
    convert_from_caffe2=cfg.TRAIN.CHECKPOINT_TYPE == "caffe2",
  File "/home/ubuntu/projects/SlowFast/slowfast/utils/checkpoint.py", line 212, in load_checkpoint
    checkpoint = torch.load(path_to_checkpoint, map_location="cpu")
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.7/site-packages/torch/serialization.py", line 426, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.7/site-packages/torch/serialization.py", line 603, in _load
    magic_number = pickle_module.load(f, **pickle_load_args)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd4 in position 1: invalid continuation byte

This problem occurred probably because I tried to decode in a different way from way of encoding. I would appreciate it if you could show me how this problem has happened, and how to solve it.

Thank you for your consideration!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Shumpei-Kikutacommented, Nov 5, 2019

I use default.py and never changed. _C.TRAIN.CHECKPOINT_TYPE = “pytorch”

Once I switch pytorch to caffe2, I succeeded in loading the pre-trained model. Thank you so much!!

1reaction
Shumpei-Kikutacommented, Nov 5, 2019

Thank you for replying.

I use Python 3.7.3, which may cause this problem. I am going to use 3.6 and let you know what happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getting unicode decode error while trying to load pre-trained ...
This error hits whenever the model is pretrained on torch version < 0.4 but using torch version > 0.4 for testing / resuming....
Read more >
Question about an error when loading pretrained models
When I loaded the pretrained model using the following code: ckp ... map_location='cpu') I meet an error which is “UnicodeDecodeError: ...
Read more >
UnicodeDecodeError when "Splitting data into training and ...
When first attempting to train model, Training output shows: Creating job... OK (ID: 1016858) Job started Splitting data into training and ...
Read more >
Fasttext error while loading wiki pre-trained data
You could use the load_model method instead of load_fasstext_format method. Also, you could FastText Library directly without really having to install ...
Read more >
invalid start byte python - You.com | The search engine you control.
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 3131: invalid start byte ... When I load the pretrained model from the local...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found