Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,24 @@ Then import the necessary libraries and instantiate your desired model.

```py
from esm.sdk import esmc_client

from esm.sdk.api import ESMProtein, LogitsConfig

# Human carbonic anhydrase II (PDB 2CBA)
protein = ESMProtein(
sequence=(
"MSHHWGYGKHNGPEHWHKDFPIAKGERQSPVDIDTHTAKYDPSLKPLSVSYDQATSLRILNNGHAFNVEFDD"
"SQDKAVLKGGPLDGTYRLIQFHFHWGSLDGQGSEHTVDKKKYAAELHLVHWNTKYGDFGKAVQQPDGLAVL"
"GIFLKVGSAKPGLQKVVDVLDSIKTKGKSADFTNFDPRGLLPESLDYWTYPGSLTTPPLLECVTWIVLKEP"
"ISVSSEQVLKFRKLNFNGEGEPEELMVDNWRPAQPLKNRQIKASFK"
)
)
model = esmc_client(
model="esmc-600m-2024-12", url="https://biohub.ai", token="<your API token>"
)

protein_tensor = model.encode(protein)
logits_output = model.logits(
protein_tensor, LogitsConfig(sequence=True, return_embeddings=True)
protein_tensor, LogitsConfig(sequence=True, return_embeddings=True)
)

print(logits_output.logits, logits_output.embeddings)
Expand Down Expand Up @@ -234,21 +244,28 @@ Import the necessary libraries.

```py
from esm.sdk.forge import SequenceStructureForgeInferenceClient
from esm.sdk.api import ESMProtein, ESMProteinError, LogitsConfig, LogitsOutput
from esm.sdk.api import FoldingConfig
from esm.utils.structure.input_builder import ProteinInput, StructurePredictionInput
```

Call the inference client with the selected model of choice and replace <your API token> with your token name.

```py
client = SequenceStructureForgeInferenceClient(model="esmfold2-fast-2026-05", url="https://biohub.ai", token="<your API token>")

gfp_sequence = "MSKGEELFTGVVPILVELDGDVNGHKFSVRGEGEGDATNGKLTLKFICTTGKLPVPWPTLVTTLTYGVQCFSRYPDHMKRHDFFKSAMPEGYVQERTISFKDDGTYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNFNSHNVYITADKQKNGIKANFKIRHNVEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSVLSKDPNEKRDHMVLLEFVTAAGITHGMDELYK"
gfp_input = input_builder.StructurePredictionInput(
sequences=[gfp_sequence]
# Human carbonic anhydrase II (PDB 2CBA)
ca2_sequence = (
"MSHHWGYGKHNGPEHWHKDFPIAKGERQSPVDIDTHTAKYDPSLKPLSVSYDQATSLRILNNGHAFNVEFDD"
"SQDKAVLKGGPLDGTYRLIQFHFHWGSLDGQGSEHTVDKKKYAAELHLVHWNTKYGDFGKAVQQPDGLAVL"
"GIFLKVGSAKPGLQKVVDVLDSIKTKGKSADFTNFDPRGLLPESLDYWTYPGSLTTPPLLECVTWIVLKEP"
"ISVSSEQVLKFRKLNFNGEGEPEELMVDNWRPAQPLKNRQIKASFK"
)
ca2_input = StructurePredictionInput(
sequences=[ProteinInput(id="A", sequence=ca2_sequence)]
)

config = FoldingConfig(num_loops=3, num_sampling_steps=32, seed=0)
result = client.fold_all_atom(gfp_input, config=config)
config = FoldingConfig(num_loops=3, num_sampling_steps=32)
result = client.fold_all_atom(ca2_input, config=config)

with open("result.cif", "w") as f:
f.write(result.complex.to_mmcif())
Expand Down
3 changes: 1 addition & 2 deletions cookbook/tutorials/esmfold2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@
"\n",
"* **num_sampling_steps**: Number of diffusion sampling steps. Higher values produce more accurate structures but take longer (typical range: 200-400).\n",
"\n",
"* **seed**: Random seed for reproducibility. Using the same seed with identical inputs will produce the same structure.\n",
"\n",
"We use a moderate number of loops (3) and sampling steps (32) to balance accuracy and runtime for this example. For more accurate results, especially when modeling flexible ligands or uncertain binding modes, you can increase num_loops and num_sampling_steps at the cost of longer runtimes."
]
Expand All @@ -278,7 +277,7 @@
"metadata": {},
"outputs": [],
"source": [
"config = FoldingConfig(num_loops=3, num_sampling_steps=32, seed=2, include_pae=True)"
"config = FoldingConfig(num_loops=3, num_sampling_steps=32, include_pae=True)"
]
},
{
Expand Down
Loading