Commit d59b06b4 authored by Gustaf Ahdritz's avatar Gustaf Ahdritz
Browse files

Tweak README

parent c2f46ce8
......@@ -2,7 +2,7 @@
# OpenFold
A faithful PyTorch reproduction of DeepMind's
A faithful but trainable PyTorch reproduction of DeepMind's
[AlphaFold 2](https://github.com/deepmind/alphafold).
## Features
......@@ -14,11 +14,12 @@ DeepMind experiments. It is omitted here for the sake of reducing clutter. In
cases where the *Nature* paper differs from the source, we always defer to the
latter.
OpenFold is trainable, and we've trained it from scratch, matching AlphaFold's
performance. We've publicly released model weights and our training data &mdash some
400,000 MSAs &mdash under a permissive license. Model weights are available
from scripts in this repository while the MSAs are hosted by the [Registry of Open
Data on AWS (RODA)](registry.opendata.aws/openfold).
OpenFold is trainable in full precision or `bfloat16` with or without DeepSpeed,
and we've trained it from scratch, matching the performance of the original.
We've publicly released model weights and our training data &mdash some 400,000
MSAs &mdash under a permissive license. Model weights are available from
scripts in this repository while the MSAs are hosted by the
[Registry of Open Data on AWS (RODA)](registry.opendata.aws/openfold).
OpenFold is built to support inference with AlphaFold's official parameters.
Try it out for yourself with our
......@@ -26,7 +27,6 @@ Try it out for yourself with our
Additionally, OpenFold has the following advantages over the reference implementation:
- Openfold is trainable in full precision or `bfloat16` half-precision, with or without [DeepSpeed](https://github.com/microsoft/deepspeed).
- **Faster inference** on GPU for chains with < 1500 residues.
- **Inference on extremely long chains**, made possible by our implementation of low-memory attention
([Rabe & Staats 2021](https://arxiv.org/pdf/2112.05682.pdf)). OpenFold can predict the structures of
......@@ -78,8 +78,7 @@ To install the HH-suite to `/usr/bin`, run
## Usage
To download our original OpenFold weights, DeepMind's pretrained parameters,
and common ground truth data, run:
To download the databases used to train OpenFold and AlphaFold run:
```bash
bash scripts/download_data.sh data/
......@@ -105,12 +104,13 @@ Make sure to run the latter command on the machine that will be used for MSA
generation (the script estimates how the precomputed database index used by
MMseqs2 should be split according to the memory available on the system).
Alternatively, you can use raw MSAs from
Alternatively, you can use raw MSAs from our aforementioned MSA database or
[ProteinNet](https://github.com/aqlaboratory/proteinnet). After downloading
the database, use `scripts/prep_proteinnet_msas.py` to convert the data into
a format recognized by the OpenFold parser. The resulting directory becomes the
`alignment_dir` used in subsequent steps. Use `scripts/unpack_proteinnet.py` to
extract `.core` files from ProteinNet text files.
the latter database, use `scripts/prep_proteinnet_msas.py` to convert the data
into a format recognized by the OpenFold parser. The resulting directory
becomes the `alignment_dir` used in subsequent steps. Use
`scripts/unpack_proteinnet.py` to extract `.core` files from ProteinNet text
files.
For both inference and training, the model's hyperparameters can be tuned from
`openfold/config.py`. Of course, if you plan to perform inference using
......@@ -133,12 +133,13 @@ python3 run_pretrained_openfold.py \
--uniclust30_database_path data/uniclust30/uniclust30_2018_08/uniclust30_2018_08 \
--output_dir ./ \
--bfd_database_path data/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt \
--model_device cuda:1 \
--model_device "cuda:0" \
--jackhmmer_binary_path lib/conda/envs/openfold_venv/bin/jackhmmer \
--hhblits_binary_path lib/conda/envs/openfold_venv/bin/hhblits \
--hhsearch_binary_path lib/conda/envs/openfold_venv/bin/hhsearch \
--kalign_binary_path lib/conda/envs/openfold_venv/bin/kalign
--openfold_param_path openfold/openfold_params/finetuning_1.pt
--config_preset "model_1_ptm"
--openfold_checkpoint_path openfold/resources/openfold_params/finetuning_2_ptm.pt
```
where `data` is the same directory as in the previous step. If `jackhmmer`,
......@@ -146,13 +147,17 @@ where `data` is the same directory as in the previous step. If `jackhmmer`,
`/usr/bin`, their `binary_path` command-line arguments can be dropped.
If you've already computed alignments for the query, you have the option to
skip the expensive alignment computation here with
--use_precomputed_alignments.
Exactly one of --openfold_param_path or --jax_param_path must be specified to
run the inference script. These accept .pt/DeepSpeed OpenFold checkpoints and
AlphaFold's .npz JAX parameter files, respectively. For a breakdown of the
differences between the different parameter files, see the README in
`openfold/resources/openfold_params/`.
`--use_precomputed_alignments`.
Exactly one of `--openfold_checkpoint_path` or `--jax_param_path` must be specified
to run the inference script. These accept .pt/DeepSpeed OpenFold checkpoints
and AlphaFold's .npz JAX parameter files, respectively. For a breakdown of the
differences between the different parameter files, see the README downloaded to
`openfold/resources/openfold_params/`. Since OpenFold was trained under a
newer training schedule than the one from which the `model_n` config
presets are derived, there is no clean correspondence between `config_preset`
settings and OpenFold checkpoints; the only restraint is that `*_ptm`
checkpoints must be run with `*_ptm` config presets.
Note that chunking (as defined in section 1.11.8 of the AlphaFold 2 supplement)
is enabled by default in inference mode. To disable it, set `globals.chunk_size`
......@@ -160,8 +165,9 @@ to `None` in the config. If a value is specified, OpenFold will attempt to
dynamically tune it, considering the chunk size specified in the config as a
minimum. This tuning process automatically ensures consistently fast runtimes
regardless of input sequence length, but it also introduces some runtime
variability, which may be undesirable for certain users. To disable this
functionality, set the `tune_chunk_size` option in the config to `False`.
variability, which may be undesirable for certain users. It is also recommended
to disable this feature for very long chains (see below). To do so, set the
`tune_chunk_size` option in the config to `False`.
Input FASTA files containing multiple sequences are treated as complexes. In
this case, the inference script runs AlphaFold-Gap, a hack proposed
......@@ -369,7 +375,7 @@ python3 /opt/openfold/run_pretrained_openfold.py \
--hhblits_binary_path /opt/conda/bin/hhblits \
--hhsearch_binary_path /opt/conda/bin/hhsearch \
--kalign_binary_path /opt/conda/bin/kalign \
--openfold_param_path /database/openfold_params/finetuning_1.pt
--openfold_checkpoint_path /database/openfold_params/finetuning_2_ptm.pt
```
## Copyright notice
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment