Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bbbts opened this issue Jun 25, 2024 · 0 comments

Comments

@bbbts
Copy link

bbbts commented Jun 25, 2024

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_model_file('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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant