YOLOP icon indicating copy to clipboard operation
YOLOP copied to clipboard

'list' object has no attribute 'seek'

Open zzk999 opened this issue 4 years ago • 4 comments
trafficstars

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.

zzk999 avatar Oct 05 '21 08:10 zzk999

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).

leidi1989 avatar Oct 08 '21 02:10 leidi1989

thank you!!

zzk999 avatar Oct 08 '21 12:10 zzk999

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!

danielzhangau avatar Oct 30 '21 02:10 danielzhangau