tttianhao / CLEAN

CLEAN: a contrastive learning model for high-quality functional prediction of proteins
MIT License
224 stars 44 forks source link

Attempting to deserialize object on a CUDA #29

Closed MBinso closed 1 year ago

MBinso commented 1 year ago

Hello I have recently come across the following message when using the infer_pvalue option:

Traceback (most recent call last): File "", line 1, in File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/CLEAN-0.1-py3.10.egg/CLEAN/infer.py", line 28, in infer_pvalue File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 1046, in _load result = unpickler.load() File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 1016, in persistent_load load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location)) File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 1001, in load_tensor wrap_storage=restore_location(storage, location), File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 176, in default_restore_location result = fn(storage, location) File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 152, in _cuda_deserialize device = validate_cuda_device(location) File "/home/guillermo/miniconda3/envs/clean/lib/python3.10/site-packages/torch/serialization.py", line 136, 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.

I have been trying to fix this but so far I have not been able to. Could you please help with this. Cheers

canallee commented 1 year ago

You don't seem to have Pytorch correctly with CUDA. Can you try to re-install Pytorch so that import torch; torch.cuda.is_available() returns True? Or if you are running on a CPU-only machine (which we don't recommend), in which case the error shouldn't appear since I handled the possibility of loading to CPU memory. But there could always be some edge cases that I didn't catch, please follow up so we can dig deeper into the problem.

canallee commented 1 year ago

Closing this for now