aqlaboratory / openfold

Trainable, memory-efficient, and GPU-friendly PyTorch reproduction of AlphaFold 2
Apache License 2.0
2.82k stars 550 forks source link

Inference error using precomputed alignments #422

Open xuagu37 opened 8 months ago

xuagu37 commented 8 months ago

Dear OpenFold community,

I was encountering an error when running inference using precomputed alignments.

I precomputed the alignments by:

python3 scripts/precompute_alignments_mmseqs.py \
    ${OPENFOLD_RESULTS}/input/T1050.fasta \
    ${OPENFOLD_DB}/mmseqs_dbs \
    uniref30_2103_db \
    ${OPENFOLD_RESULTS}/output/alignments \
    ${OPENFOLD_PREFIX}/envs/openfold_2.0.0/bin/mmseqs \
    --hhsearch_binary_path ${OPENFOLD_PREFIX}/envs/openfold_2.0.0/bin/hhsearch \
    --env_db colabfold_envdb_202108_db \
    --pdb70 ${OPENFOLD_DB}/pdb70/pdb70

I ran the inference by:

python run_pretrained_openfold.py \
    ${OPENFOLD_RESULTS}/input \
    ${OPENFOLD_DB}/pdb_mmcif/mmcif_files/ \
    --use_precomputed_alignments ${OPENFOLD_RESULTS}/output/alignments \
    --output_dir ${OPENFOLD_RESULTS}/output \
    --model_device "cuda:0" \
    --config_preset "model_1"

The error message was as follows.

[2024-03-22 13:07:16,218] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to cuda (auto detect)
INFO:/software/sse/manual/OpenFold/2.0.0/openfold/utils/script_utils.py:Successfully loaded JAX parameters at openfold/resources/params/params_model_1.npz...
INFO:/software/sse/manual/OpenFold/2.0.0/run_pretrained_openfold.py:Using precomputed alignments for T1050 at /proj/nsc_testing/xuan/openfold_results_2.0.0/output/alignments...
Traceback (most recent call last):
  File "/software/sse/manual/OpenFold/2.0.0/run_pretrained_openfold.py", line 470, in <module>
    main(args)
  File "/software/sse/manual/OpenFold/2.0.0/run_pretrained_openfold.py", line 279, in main
    feature_dict = generate_feature_dict(
  File "/software/sse/manual/OpenFold/2.0.0/run_pretrained_openfold.py", line 141, in generate_feature_dict
    feature_dict = data_processor.process_fasta(
  File "/software/sse/manual/OpenFold/2.0.0/openfold/data/data_pipeline.py", line 876, in process_fasta
    template_features = make_template_features(
  File "/software/sse/manual/OpenFold/2.0.0/openfold/data/data_pipeline.py", line 44, in make_template_features
    templates_result = template_featurizer.get_templates(
  File "/software/sse/manual/OpenFold/2.0.0/openfold/data/templates.py", line 1126, in get_templates
    sorted(filtered, key=lambda x: x.sum_probs, reverse=True)
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

Has anyone experienced a similar issue, or does anyone have suggestions on how I might resolve this? Any advice or guidance would be greatly appreciated.

Thank you for your time and help.

juliocesar-io commented 2 months ago

Hello!

Maybe the fasta ID is not being parsed correctly? I had a similar issue. Try testing with this fix #485