HeliXonProtein / OmegaFold

OmegaFold Release Code
Apache License 2.0
533 stars 75 forks source link

Error when running inference on CPU #24

Closed Meteord closed 1 year ago

Meteord commented 1 year ago

Hi,

first of all, thank you for publishing your work and the corresponding code!

I run into an error by using --device cpu

INFO:root:Loading weights from /mnt/home/user/.cache/omegafold_ckpt/model.pt
INFO:root:Constructing OmegaFold
INFO:root:Reading /mnt/project/struct_refine/openfold/results/casp13_14/casp1314.fasta
INFO:root:Predicting 1th chain in /mnt/project/struct_refine/openfold/results/casp13_14/casp1314.fasta
INFO:root:41 residues in this chain.
Traceback (most recent call last):
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/bin/omegafold", line 33, in <module>
    sys.exit(load_entry_point('OmegaFold==0.0.0', 'console_scripts', 'omegafold')())
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/torch-1.12.1-py3.10-linux-x86_64.egg/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/__main__.py", line 74, in main
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/torch-1.12.1-py3.10-linux-x86_64.egg/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/model.py", line 175, in forward
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/torch-1.12.1-py3.10-linux-x86_64.egg/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/model.py", line 89, in forward
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/torch-1.12.1-py3.10-linux-x86_64.egg/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/geoformer.py", line 175, in forward
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/torch-1.12.1-py3.10-linux-x86_64.egg/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/lsf-nas-1/os-shared/anaconda3/enjvs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/geoformer.py", line 122, in forward
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/torch-1.12.1-py3.10-linux-x86_64.egg/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/modules.py", line 676, in forward
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/jomegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/modules.py", line 580, in _get_attended
  File "/mnt/lsf-nas-1/os-shared/anaconda3/envs/omegafold/lib/python3.10/site-packages/OmegaFold-0.0.0-py3.10.egg/omegafold/modules.py", line 609, in _get_sharded_stacked
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'

Is device cpu not supported or how can i fix this? Thanks in advance!

RuiWang1998 commented 1 year ago

Hi,

We are sorry for this, but it seems you are running an older version of the code where we accidentally made --subbatch_size a mandatory argument.

You could update to the newest version of the code and run the model as usual, or you could specify a --subbatch_size argument.

Best

Meteord commented 1 year ago

Thanks for the fast help! Setting the subbatch_size worked for me :)