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. #213
Got the training to run successfully. When I tried to run the eval.py file, I am getting the following error -
File "/home/bhattb3/AWESOME6_dataset/scripts/eval.py", line 113, in
evaluator = Evaluator(args)
File "/home/bhattb3/AWESOME6_dataset/scripts/eval.py", line 48, in init
self.model = get_segmentation_model(model=args.model, dataset=args.dataset, backbone=args.backbone,
File "/home/bhattb3/AWESOME6_dataset/core/models/model_zoo.py", line 114, in get_segmentation_model
return modelsmodel
File "/home/bhattb3/AWESOME6_dataset/core/models/fcn.py", line 186, in get_fcn16s
model.load_state_dict(torch.load(get_modelfile('fcn16s%s_%s' % (backbone, acronyms[dataset]), root=root),
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1025, in load
return _load(opened_zipfile,
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1446, in _load
result = unpickler.load()
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1416, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1390, in load_tensor
wrap_storage=restore_location(storage, location),
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1316, in restore_location
return default_restore_location(storage, str(map_location))
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 390, in default_restore_location
result = fn(storage, location)
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 265, in _cuda_deserialize
device = validate_cuda_device(location)
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 249, 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.
Got the training to run successfully. When I tried to run the eval.py file, I am getting the following error -
File "/home/bhattb3/AWESOME6_dataset/scripts/eval.py", line 113, in
evaluator = Evaluator(args)
File "/home/bhattb3/AWESOME6_dataset/scripts/eval.py", line 48, in init
self.model = get_segmentation_model(model=args.model, dataset=args.dataset, backbone=args.backbone,
File "/home/bhattb3/AWESOME6_dataset/core/models/model_zoo.py", line 114, in get_segmentation_model
return modelsmodel
File "/home/bhattb3/AWESOME6_dataset/core/models/fcn.py", line 186, in get_fcn16s
model.load_state_dict(torch.load(get_modelfile('fcn16s%s_%s' % (backbone, acronyms[dataset]), root=root),
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1025, in load
return _load(opened_zipfile,
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1446, in _load
result = unpickler.load()
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1416, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1390, in load_tensor
wrap_storage=restore_location(storage, location),
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 1316, in restore_location
return default_restore_location(storage, str(map_location))
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 390, in default_restore_location
result = fn(storage, location)
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 265, in _cuda_deserialize
device = validate_cuda_device(location)
File "/home/bhattb3/miniconda3/envs/segenv12/lib/python3.9/site-packages/torch/serialization.py", line 249, 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.
Can anyone please help?? Thanks a lot.