You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
尝试只用CPU时报错Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
#16
我尝试运行
python fishing.py image -f yolox/exp/yolox_tiny_fish.py -c weights/best_tiny3.pth --conf 0.25 --nms 0.45 --tsize 640 --device cpu
时报错
Traceback (most recent call last):
File "fishing.py", line 189, in
main(exp, args)
File "fishing.py", line 143, in main
agent.load_state_dict(torch.load(args.model_dir))
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 594, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 853, in _load
result = unpickler.load()
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 845, in persistent_load
load_tensor(data_type, size, key, _maybe_decode_ascii(location))
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 834, in load_tensor
loaded_storages[key] = restore_location(storage, location)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 175, in default_restore_location
result = fn(storage, location)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 151, in _cuda_deserialize
device = validate_cuda_device(location)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 135, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on a CUDA '
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
我尝试运行
python fishing.py image -f yolox/exp/yolox_tiny_fish.py -c weights/best_tiny3.pth --conf 0.25 --nms 0.45 --tsize 640 --device cpu
时报错
Traceback (most recent call last):
File "fishing.py", line 189, in
main(exp, args)
File "fishing.py", line 143, in main
agent.load_state_dict(torch.load(args.model_dir))
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 594, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 853, in _load
result = unpickler.load()
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 845, in persistent_load
load_tensor(data_type, size, key, _maybe_decode_ascii(location))
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 834, in load_tensor
loaded_storages[key] = restore_location(storage, location)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 175, in default_restore_location
result = fn(storage, location)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 151, in _cuda_deserialize
device = validate_cuda_device(location)
File "C:\Users\34703.conda\envs\ysfish\lib\site-packages\torch\serialization.py", line 135, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on a CUDA '
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
尝试根据报错将fishing.py的115行改为ckpt = torch.load(ckpt_file, map_location=torch.device('cpu'))
仍出现此报错
The text was updated successfully, but these errors were encountered: