HeliXonProtein / OmegaFold

OmegaFold Release Code
Apache License 2.0
555 stars 79 forks source link

Model 2 error #67

Open vvishwesh opened 1 year ago

vvishwesh commented 1 year ago

Am trying to use --model 2. But I get the following error

(omegafoldenv) (omegafoldenv) C:\Workspace\PEPTIDES>omegafold --num_cycle 1 --subbatch_size 8 --device cuda --weights_file release1.pt --model 2 1a4t_B.fasta TEST
INFO:root:Loading weights from release1.pt
INFO:root:Constructing OmegaFold
Traceback (most recent call last):
  File "C:\Software\anaconda3\envs\omegafoldenv\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Software\anaconda3\envs\omegafoldenv\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Software\anaconda3\envs\omegafoldenv\Scripts\omegafold.exe\__main__.py", line 7, in <module>
  File "C:\Software\anaconda3\envs\omegafoldenv\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Software\anaconda3\envs\omegafoldenv\lib\site-packages\omegafold\__main__.py", line 53, in main
    model.load_state_dict(state_dict)
  File "C:\Software\anaconda3\envs\omegafoldenv\lib\site-packages\torch\nn\modules\module.py", line 1604, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for OmegaFold:
        Missing key(s) in state_dict: "recycle_embedder.embed_struct.linear_z_weights", "recycle_embedder.embed_struct.linear_z_bias", "recycle_embedder.embed_struct.aa_embedding.weight", "recycle_embedder.embed_struct.dist_bin_embedding.weight", "recycle_embedder.embed_struct.dist_bin_embedding.bias", "recycle_embedder.embed_struct.rough_dist_bin_embedding.weight", "recycle_embedder.embed_struct.rough_dist_bin_embedding.bias", "recycle_embedder.embed_struct.dist_bin_linear.weight", "recycle_embedder.embed_struct.dist_bin_linear.bias", "recycle_embedder.embed_struct.rough_dist_bin_linear.weight", "recycle_embedder.embed_struct.rough_dist_bin_linear.bias", "recycle_embedder.embed_struct.pos_bin_embedding.weight", "recycle_embedder.embed_struct.pos_bin_embedding.bias", "recycle_embedder.embed_struct.pos_linear.weight", "recycle_embedder.embed_struct.pos_linear.bias".
YoelShoshan commented 1 year ago

@vvishwesh you are mixing up version 1 of the checkpoint (--weights_file release1.pt) while asking for model architecture version 2 (--model 2)

Your solutions are:

  1. Only use "--model 2" and drop the "--weights_file release1.pt"
  2. Download release2.pt and change your command to omegafold --num_cycle 1 --subbatch_size 8 --device cuda --weights_file release1.pt --model 2 1a4t_B.fasta TEST