CUDA device problem
Leo1214 opened this issue · 1 comments
Traceback (most recent call last):
File "train.py", line 25, in
train_net(config)
File "train.py", line 16, in train_net
solver = Solver(config, target_image, data_loader=data_loader)
File "/opt/data/private/Liao/AMT-GAN/backbone/solver.py", line 75, in init
self.build_model()
File "/opt/data/private/Liao/AMT-GAN/backbone/solver.py", line 183, in build_model
self.load_checkpoint()
File "/opt/data/private/Liao/AMT-GAN/backbone/solver.py", line 215, in load_checkpoint
self.G.load_state_dict(torch.load(G_path))
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 809, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 1172, in _load
result = unpickler.load()
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 1142, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 1116, in load_tensor
wrap_storage=restore_location(storage, location),
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 217, in default_restore_location
result = fn(storage, location)
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 182, in _cuda_deserialize
device = validate_cuda_device(location)
File "/opt/conda/envs/AMT-GAN/lib/python3.8/site-packages/torch/serialization.py", line 173, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on CUDA device '
RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.