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.

RuntimeError: storage has wrong size

See original GitHub issue

I got this in the prediction section (bmt) root@ABC001:/data/zuyuehan/project/BMT# python ./sample/single_video_prediction.py --prop_generator_model_path ./sample/best_prop_model.pt --pretrained_cap_model_path ./sample/best_cap_model.pt --vggish_features_path ./test/pandemic_vggish.npy --rgb_features_path ./test/pandemic_rgb.npy --flow_features_path ./test/pandemic_flow.npy --duration_in_secs 99 --device_id 0 --max_prop_per_vid 100 --nms_tiou_thresh 0.4 Contructing caption_iterator for "train" phase Using vanilla Generator initialization: xavier Glove emb of the same size as d_model_caps Traceback (most recent call last): File "./sample/single_video_prediction.py", line 281, in <module> args.device_id, args.prop_generator_model_path, args.pretrained_cap_model_path, args.max_prop_per_vid File "./sample/single_video_prediction.py", line 94, in load_prop_model checkpoint = torch.load(prop_generator_model_path, map_location='cpu') File "/root/anaconda3/envs/bmt/lib/python3.7/site-packages/torch/serialization.py", line 386, in load return _load(f, map_location, pickle_module, **pickle_load_args) File "/root/anaconda3/envs/bmt/lib/python3.7/site-packages/torch/serialization.py", line 580, in _load deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly) RuntimeError: storage has wrong size: expected 0 got 512 I need your help, and I’d appreciate it if you could help me.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Johnzu-2019commented, Oct 15, 2020

恐怕我无法重现您的错误。

我建议检查您要加载的模型的md5总和:

md5sum ./sample/best_prop_model.pt
5f8b20826b09eadd41b7a5be662c198b ./sample/best_prop_model.pt

md5sum ./sample/best_cap_model.pt
7b4d48cd77ec49a027a4a1abc6867ee7 ./sample/best_cap_model.pt

您是否正在使用某种形式的分布式培训?

I am afraid I cannot reproduce your error on my side.

I would suggest checking the md5 sums of the models you are trying to load:

md5sum ./sample/best_prop_model.pt
5f8b20826b09eadd41b7a5be662c198b  ./sample/best_prop_model.pt

md5sum ./sample/best_cap_model.pt
7b4d48cd77ec49a027a4a1abc6867ee7  ./sample/best_cap_model.pt

Are you using distributed training of some sort?

Thank you very much indeed. According to your suggestion, I found that the MD5 code of the.pt file I uploaded to the server was wrong. After I re-uploaded the correct.PT file, I ran it successfully.You are such a good man. You have been very helpful to me as a beginner.

0reactions
v-iashincommented, Oct 15, 2020

No problem. Good luck with your endeavors!

Closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: storage has wrong size - PyTorch Forums
I use single machine with 4 gpus to train my models, and then I save paramaters of the model with torch.save(aemodel.state_dict(), file).
Read more >
RuntimeError: storage has wrong size when loading ... - GitHub
Bug description Experiencing RuntimeError when finetuning model according to command described in Recipes Reproduction steps Run command ...
Read more >
There is a Runtime error "storage has wrong size:" when I use ...
I get "RuntimeError storage has wrong size" when I'm invoking torch.load("pthfilename") . My model is trained on multiple GPUs and I saved ...
Read more >
Inference: storage has wrong size: expected 0 got 256
RuntimeError: storage has wrong size: expected 0 got 256 Note that I cannot import it using load_learner on the server that trained it...
Read more >
storage has wrong size: expected XXX got XXX 以及多卡GPU ...
RuntimeError : storage has wrong size: expected XXX got XXX 以及多卡GPU训练转到多卡GPU测试 ; Traceback (most recent call last) ; if args ; Attempting ...
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