hustvl / YOLOP

You Only Look Once for Panopitic Driving Perception.(MIR2022)
MIT License
1.94k stars 413 forks source link

'list' object has no attribute 'seek' #41

Open zzk999 opened 3 years ago

zzk999 commented 3 years ago

my python version is 3.8, and when run python tools/test.py the question arised, can you help me? thank you!

File "tools/test.py", line 153, in main() File "tools/test.py", line 86, in main checkpoint = torch.load(checkpoint_file) File "/home/kasm-user/anaconda3/envs/torch19/lib/python3.8/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/home/kasm-user/anaconda3/envs/torch19/lib/python3.8/site-packages/torch/serialization.py", line 235, in _open_file_like return _open_buffer_reader(name_or_buffer) File "/home/kasm-user/anaconda3/envs/torch19/lib/python3.8/site-packages/torch/serialization.py", line 220, in init _check_seekable(buffer) File "/home/kasm-user/anaconda3/envs/torch19/lib/python3.8/site-packages/torch/serialization.py", line 311, in _check_seekable raise_err_msg(["seek", "tell"], e) File "/home/kasm-user/anaconda3/envs/torch19/lib/python3.8/site-packages/torch/serialization.py", line 304, in raise_err_msg raise type(e)(msg) AttributeError: 'list' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

leidi1989 commented 3 years ago

demo.py line 55 replace to:"checkpoint = torch.load(opt.weights[0], map_location= device)", "opt.weights" is a list, but here need a weight path(str).

zzk999 commented 3 years ago

thank you!!

danielzhangau commented 3 years ago

image Hi leidi1989, after I changed checkpoint_file = args.weights[0] in test.py, it raised me another error as shown above, any clues? Thanks in advance!

Lahm21111 commented 6 months ago

checkpoint_file is a list, so you have to replace the 86th line in test.py to checkpoint = torch.load(checkpoint_file[0])