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

[No module named 'pocket_flow]and[RuntimeError: Trying to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1] #3

Closed
Lyueyang2020 opened this issue Apr 12, 2024 · 1 comment

Comments

@Lyueyang2020
Copy link

Lyueyang2020 commented Apr 12, 2024

您好,我尝试了您的模型,使用系统win11,并测试“python main_generate.py -pkt test_samples/test_pocket10/1bvr_C_rec_pocket10-surf.pdb --ckpt ckpt/ZINC-pretrained-255000.pt -n 100 -d cuda:0 --root_path gen_results --name 1bvr -at 1.0 -bt 1.0 --max_atom_num 35 -ft 0.5 -cm True --with_print True”,已成功运行。
已经安装了cuda( torch.version.cuda'11.6'),但是当使用“-d cuda:1”时会报错“RuntimeError: Trying to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1"。具体信息如下

E:\0_deep_learning_program\project\PocketFlow\PocketFlow-master\PocketFlow-master\pocket_flow\utils\transform.py:134: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  protein_atom_indices = torch.tensor(data.protein_atom_to_aa_type, dtype=torch.int64)
Loading model ...
Traceback (most recent call last):
  File "main_generate.py", line 79, in <module>
    ckpt = torch.load(args.ckpt, map_location=device)
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 1049, in _load
    result = unpickler.load()
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 1019, in persistent_load
    load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 1001, in load_tensor
    wrap_storage=restore_location(storage, location),
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 970, in restore_location
    return default_restore_location(storage, map_location)
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 175, in default_restore_location
    result = fn(storage, location)
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 152, in _cuda_deserialize
    device = validate_cuda_device(location)
  File "E:\0_deep_learning_program\miniconda3\envs\pytorch\lib\site-packages\torch\serialization.py", line 143, 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.

由于本人毫无编程基础无法解决以上问题,如您能解答将万分感激!

@Saoge123
Copy link
Owner

抱歉回复晚了。您在windows上运行的模型,‘cuda:0'意思是选择编号为0的gpu,‘cuda:1’则是选择编号为1的gpu。而您的电脑应该只有一块GPU,系统对它的编号默认是0,所以您设置cuda:1会报错。

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

2 participants