Team Ai
Modelpublic

OneScience-Group/AlphaFold3

sourceHugging Facecc-by-nc-sa-4.0updated 2mo agoView on Hugging Face
2likes248downloads
Model Card

<p align="center"> <strong> <span style="font-size: 30px;">AlphaFold3</span> </strong> </p>

Model Introduction

AlphaFold 3 is a biomolecular structure prediction model developed by Google DeepMind and Isomorphic Labs. It predicts the three-dimensional structures and interactions of proteins, DNA, RNA, small-molecule ligands, and their complexes.

Paper: Accurate structure prediction of biomolecular interactions with AlphaFold 3 https://www.nature.com/articles/s41586-024-07487-w

Model Description

AlphaFold 3 uses a Pairformer and a diffusion model to predict biomolecular complex structures. This model package provides a JAX / Flax inference implementation and database-search scripts, together with the accompanying Hugging Face dataset OneScience-Group/AlphaFold3_dataset.

Use Cases

ScenarioDescription
Direct inference from existing featuresTakes an AlphaFold 3 JSON file containing precomputed features such as MSAs and templates as input and produces structure predictions
Protein structure predictionTakes a protein sequence as input, generates features by searching databases, and predicts its structure
Biomolecular complex modelingTakes multicomponent systems comprising proteins, DNA, RNA, ligands, and other molecules as input and predicts their 3D structures
Database-search pipeline validationUses Jackhmmer / Nhmmer or MMseqs pipelines to verify database paths and the availability of search tools
Hugging Face / OneCode executionAfter downloading the model project and complete dataset, quickly verifies that the scripts run correctly in a life-sciences runtime environment

Usage Instructions

1. OneCode

Try one-click AI4S development in the OneCode online environment:

Try one-click AI4S development

2. Manual Installation

Hardware Requirements

  • —GPU or DCU is recommended.
  • —A CPU can be used for import checks and lightweight configuration tests; full training and inference will be slow.
  • —DCU users must install DTK in advance. DTK 25.04.2 or later is recommended, or a OneScience-recommended version matching the current cluster.

Environment Check

  • —NVIDIA GPU:
bash
nvidia-smi
  • —Hygon DCU:
bash
hy-smi

Download the Model Package

bash
hf download OneScience-Group/AlphaFold3 --local-dir ./AlphaFold3
cd AlphaFold3

Install the Runtime Environment

DCU Environment

bash
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation supported
pip install onescience[bio-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

After installation, return to the model package directory:

bash
cd ./AlphaFold3

If the AlphaFold 3 C++ extension and runtime data files have not yet been built in the current environment, run:

bash
python -m onescience.flax_model.alphafold3.build_extension
python -m onescience.flax_models.alphafold3.build_data

Training and Inference Data Overview

The OneScience community has uploaded the complete data required for AlphaFold 3 inference and database searches to Hugging Face: OneScience-Group/AlphaFold3_dataset. This model package does not include a training entry point; the dataset is primarily used to construct MSA / template features and perform database searches before inference.

bash
hf download OneScience-Group/AlphaFold3_dataset \
  --repo-type dataset \
  --local-dir ./data/alphafold3

Model Weights

Model weights will be available soon.

Preparing Weights

Place the AlphaFold 3 model weights in the following directory, or specify them via environment variables:

text
weight/
  AlphaFold3/
    ...

Default lookup order:

  • —ALPHAFOLD3_MODEL_DIR
  • —${ONESCIENCE_MODELS_DIR}/AlphaFold3
  • —weight/AlphaFold3

Example:

bash
export ALPHAFOLD3_MODEL_DIR=/path/to/AlphaFold3

Direct Inference

When the input JSON already contains features such as MSA and templates, you can run inference directly:

bash
bash scripts/infer.sh

Equivalent Python command example:

bash
python scripts/run_alphafold.py \
  --json_path inputs/7r6r_data.json \
  --model_dir weight/AlphaFold3 \
  --output_dir outputs \
  --run_data_pipeline=false \
  --flash_attention_implementation=triton

Output is written to outputs/ and includes the top-ranked structure, structures generated from different seed / sample combinations, a CSV file containing ranking scores, and a copy of the input JSON.

Jackhmmer / Nhmmer Database Search

When the input JSON contains only sequences and requires a local database search, use:

bash
bash scripts/infer_jackhmmer.sh

Common environment variables:

bash
export ALPHAFOLD3_DATASET_ROOT=/path/to/alphafold3
export ALPHAFOLD3_MODEL_DIR=/path/to/AlphaFold3
export ALPHAFOLD3_JSON_PATH=inputs/t1119_search.json
export ALPHAFOLD3_OUTPUT_DIR=outputs
export ALPHAFOLD3_RUN_INFERENCE=false

ALPHAFOLD3_DATASET_ROOT is expected to contain directories such as public_databases/, jackhmmer_split/, and mmseqsDB/.

MMseqs Database Search

If the runtime environment provides the MMseqs executable and the required MMseqs databases, use:

bash
bash scripts/infer_mmseqs.sh

Common environment variables:

bash
export ALPHAFOLD3_MMSEQS_HOME=/path/to/mmseqs
export ALPHAFOLD3_DATASET_ROOT=/path/to/alphafold3
export ALPHAFOLD3_MMSEQS_DB_DIR=/path/to/alphafold3/mmseqsDB
export ALPHAFOLD3_RUN_INFERENCE=false

To proceed with inference after the database search, set ALPHAFOLD3_RUN_INFERENCE to true and ensure that the weights directory is available.

Data Format

AlphaFold 3 inputs are provided in JSON format with the following basic structure:

json
{
  "dialect": "alphafold3",
  "version": 1,
  "name": "example",
  "sequences": [
    {
      "protein": {
        "id": "A",
        "sequence": "..."
      }
    }
  ],
  "modelSeeds": [100],
  "bondedAtomPairs": null,
  "userCCD": null
}

This repository provides two examples:

  • —inputs/7r6r_data.json: contains sequence, MSA, and template information; suitable for direct inference.
  • —inputs/t1119_search.json: contains only sequences; suitable for database-search pipeline validation.

It is recommended to download the full Hugging Face dataset OneScience-Group/AlphaFold3_dataset to data/alphafold3/ under the model package. The relative directory structure expected by the database-search pipeline is as follows:

text
data/
  alphafold3/
    public_databases/
      mmcif_files/
      pdb_seqres_2022_09_28.fasta
      ...
    jackhmmer_split/
      bfd-first_non_consensus_sequences.fasta@64
      mgy_clusters_2022_05.fa@512
      uniprot_cluster_annot_2021_04.fa@256
      uniref90_2022_05.fa@128
    mmseqsDB/
      small_bfd_db
      mgnify_db
      uniprot_cluster_annot_db
      uniref90_db

Verification

Static import check:

bash
python tests/check_import_boundaries.py

OneScience Official Information

PlatformOneScience Main RepositorySkills Repository
Giteehttps://gitee.com/onescience-ai/onesciencehttps://gitee.com/onescience-ai/oneskills
GitHubhttps://github.com/onescience-ai/OneSciencehttps://github.com/onescience-ai/oneskills

Citation & License