Ran the demo code of "Antibody structure prediction from sequence" and got #30 error. After modifying the AntiBERTyRunner.py suggested in #30, another error occurs:
`
The code, data, and weights for this work are made available for non-commercial use
(including at commercial entities) under the terms of the JHU Academic Software License
Agreement. For commercial inquiries, please contact dmalon11[at]jhu.edu.
License: https://github.com/Graylab/IgFold/blob/main/LICENSE.md
Loading 4 IgFold models...
Using device: cuda:0
Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_1.ckpt...
Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_2.ckpt...
Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_3.ckpt...
Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_5.ckpt...
Successfully loaded 4 IgFold models.
Loaded AntiBERTy model.
Traceback (most recent call last):
File "demo.py", line 16, in
igfold.fold(
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/IgFoldRunner.py", line 106, in fold
model_out = fold(
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/utils/folding.py", line 206, in fold
model_out = model(model_in)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, kwargs)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/model/IgFold.py", line 248, in forward
str_nodes = self.str_node_transform(bert_feats)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, *kwargs)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/container.py", line 204, in forward
input = module(input)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(input, kwargs)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat1 in method wrapper_addmm)
`
Investigated IgFold.py and made a modification:
move bert_feats to the same device before the str_node_transform operation.
OS: ubuntu 22.04.2 LTS NVIDIA Driver Version: 525.85.12
CUDA Version: 12.0 Python 3.8.16
Ran the demo code of "Antibody structure prediction from sequence" and got #30 error. After modifying the AntiBERTyRunner.py suggested in #30, another error occurs: `
Loading 4 IgFold models... Using device: cuda:0 Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_1.ckpt... Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_2.ckpt... Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_3.ckpt... Loading /home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/trained_models/IgFold/igfold_5.ckpt... Successfully loaded 4 IgFold models. Loaded AntiBERTy model. Traceback (most recent call last): File "demo.py", line 16, in
igfold.fold(
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/IgFoldRunner.py", line 106, in fold
model_out = fold(
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/utils/folding.py", line 206, in fold
model_out = model(model_in)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, kwargs)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/igfold/model/IgFold.py", line 248, in forward
str_nodes = self.str_node_transform(bert_feats)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, *kwargs)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/container.py", line 204, in forward
input = module(input)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(input, kwargs)
File "/home/px172/anaconda3/envs/IgFold38/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat1 in method wrapper_addmm)
`
Investigated IgFold.py and made a modification:
move bert_feats to the same device before the str_node_transform operation.
`
`
After the fix, the prediction is generated.