Instructions to use biohub/ESMFold2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use biohub/ESMFold2 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("biohub/ESMFold2", dtype="auto") - Notebooks
- Google Colab
- Kaggle
license:
- mit
- other
license_link: https://github.com/Biohub/esm/blob/main/THIRD_PARTY_NOTICE.md
language: en
tags:
- biology
- esm
- protein
- protein-structure-prediction
- structure-prediction
- protein-design
- 3d-structure
- confidence-estimation
- molecular-dynamics
- transformers
Model Card for ESMFold2
Model Details
ESMFold2 is a state-of-the-art model for protein structure prediction and design that defines a new frontier for speed and accuracy. The model predicts high-resolution, all-atom 3D protein structures directly from amino acid sequences, with optional multiple sequence alignment (MSA) input for enhanced accuracy on challenging targets. The model outputs comprehensive structural information including all-atom coordinates (backbone and side chains), confidence metrics (pLDDT, pAE, pTM, iPTM), and optional distogram predictions for detailed analysis of predicted structures. Unlike ESMFold, ESMFold2 is able to predict structures for all biomolecules, including small molecules, DNA, RNA, and modified amino acids.
ESMFold2 is capable of either single-sequence or MSA conditioned structure prediction for improved accuracy on difficult targets. The ESMFold2-Fast variant is an inference optimized single-sequence structure prediction model and is not MSA conditioned.
To run this model with the Biohub Platform API, visit the Biohub Platform.
Read more about ESMFold2 in our paper here.
Model Variants
| Model | MSA Conditioning | Description | Data Cutoff |
|---|---|---|---|
| esmfold2 | Yes | Large model, capable of either single-sequence or MSA conditioned structure prediction for improved accuracy on difficult targets | Sept 2021 |
| esmfold2-fast | No | Inference optimized single-sequence structure prediction model | Sept 2021 |
Performance Metrics
ESMfold2 was evaluated against state-of-the-art single-sequence and MSA-based structure prediction models on the FoldBench benchmark. ESMFold2 meets or exceeds performance by AlphaFold3 on antibody-antigen complex prediction, protein-protein complex prediction and Runs N' Poses benchmarks. Inference-time compute can dramatically improve performance of ESMFold2, especially across antibody-antigen complexes.
Refer to the paper for details on additional performance metrics.
Usage
Please install esm via PyPi:
pip install esm
You can fold your first protein with
from esm.models.esmfold2 import (
ESMFold2InputBuilder,
ProteinInput,
StructurePredictionInput,
)
from transformers.models.esmfold2.modeling_esmfold2 import ESMFold2Model
# Ubiquitin (PDB 1UBQ)
sequence = (
"MQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLEDGRTLSDYNIQKESTLHLVLRLRGG"
)
model = ESMFold2Model.from_pretrained("biohub/ESMFold2").cuda().eval()
processor = ESMFold2InputBuilder()
spi = StructurePredictionInput(sequences=[ProteinInput(id="A", sequence=sequence)])
result = processor.fold(
model, spi, num_loops=3, num_sampling_steps=50, num_diffusion_samples=1, seed=0
)
print(f"pLDDT mean: {float(result.plddt.mean()):.3f}")
print(f"pTM: {float(result.ptm):.3f}")
You may directly use the model through huggingface/transformers
from transformers.models.esmfold2.modeling_esmfold2 import ESMFold2Model
# Ubiquitin (PDB 1UBQ)
sequence = (
"MQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLEDGRTLSDYNIQKESTLHLVLRLRGG"
)
model = ESMFold2Model.from_pretrained("biohub/ESMFold2").cuda().eval()
output = model.infer_protein(sequence, num_loops=3, num_sampling_steps=50)
print(f"pLDDT mean: {float(output['plddt'].mean()):.3f}")
print(f"pTM: {float(output['ptm'].mean()):.3f}")
And the Biohub API:
TODO minimal biohub API code snippet
First install the esm Python package.
pip install esm
Import the necessary libraries.
from esm.sdk.forge import SequenceStructureForgeInferenceClient
from esm.sdk import client
from esm.sdk.api import ESMProtein, ESMProteinError, LogitsConfig, LogitsOutput
Generate an API key and add it to your Biohub account. This API key manages your access to credits and tokens, and the term API key/token is often used interchangeably within documentation. Call the inference client with the selected model of choice and replace with your token name.
client = SequenceStructureForgeInferenceClient(model="esmfold2-fast-2026-05", url="https://biohub.ai", token="<your API token>")
The Hugging Face implementation directly supports proteins only. For complex biomolecules, we recommend using the internal API. Here's an example of folding a Ubiquitin with ESMFold2:
import os
from esm.models.esmfold2 import LigandInput, ProteinInput, StructurePredictionInput
from esm.sdk import esmfold2_client
from esm.sdk.api import FoldingConfig
# Ubiquitin (PDB 1UBQ) + ATP cofactor (illustrative pairing).
protein = ProteinInput(
id="A",
sequence=(
"MQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLEDGRTLSDYNIQKESTLHLVLRLRGG"
),
)
ligand = LigandInput(id="L", ccd=["ATP"])
# TODO: replace ``esmc-fold-flash-2604`` with the public ESMFold2 model name
# once the Biohub Platform inference server announces it.
client = esmfold2_client(model="esmc-fold-flash-2604", token=os.environ["ESM_API_KEY"])
spi = StructurePredictionInput(sequences=[protein, ligand])
result = client.fold_all_atom(
spi, config=FoldingConfig(num_loops=3, num_sampling_steps=50)
)
print(f"pLDDT mean: {float(result.plddt.mean()):.3f}")
print(f"pTM: {float(result.ptm):.3f}")
Training Data
ESMfold2 was trained on sequences from the Protein Data Bank (PDB) and the AlphaFold DB (AFDB).
Frontier Safety
Biohub has established a safety team to assess the benefits and potential risks of our models and tools prior to release, and develop mitigations where necessary. Risk assessment was conducted for ESMFold2 prior to release. Further details are available in our corresponding paper appendix.
Informed by our risk assessments, we are releasing the source code and model weights for ESMFold2.
Biohub.ai Platform: We implement guardrails that detect and restrict the use of keywords and sequences corresponding to controlled pathogens and toxins on our freely accessible platform. For further details regarding these guardrails, please refer to our Biohub platform Resources page.
Biases and Limitations
Potential Biases
- The model may reflect biases present in the training data.
Limitations
- Dataset biases: The model may reflect biases present in the training data (PDB, AFDB), including over-representation of certain protein families, experimental conditions, or structural classes. Performance may vary for underrepresented protein types.
- Dataset limitations: PDB historically lacks comprehensive data on protein conformations, post-translational modifications, disordered regions, etc. Like all other structure prediction models trained on the PDB, performance may degrade on other biomolecules.
- Computational demand: Highest accuracy structure predictions require scaling inference time compute. Predictions made with reduced inference parameters may lead to suboptimal performance.
- Experimental validation required: All predictions should be considered hypotheses requiring experimental validation. The model cannot replace experimental structure determination methods (X-ray crystallography, cryo-EM, NMR) for definitive structural characterization.
Out-of-Scope or Unauthorized Use Cases
Do not use the model for the following purposes:
- Any use that is prohibited by the Acceptable Use Policy.
Caveats and Recommendations
- Always review and validate outputs generated by the model.
- Treat model outputs as machine-generated hypotheses that require further experimental validation, not as established biological facts.
- We are committed to advancing the responsible development and use of artificial intelligence.
Should you have any security or privacy issues or questions related to this model, please reach out to our team at support@biohub.org.
Citation
Coming soon.
Acknowledgements
Many people on the Biohub AI Research team and prior EvolutionaryScale team contributed to the development of this model. It would not have been possible without them.
