Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Biohub ESMFold2 / ESMFold2-Fast all-atom co-folding (Candido et al. 2026, github.com/Biohub/esm). Single-sequence and MSA modes; protein, DNA, RNA, ligand (CCD/SMILES), modified residues. FoldBench Ab-Ag 50-55%, PPI 70-77% DockQ-pass. Also covers the ESMC-{300M,600M,6B} protein language models from the same release: masked-LM logits, hidden states, mutation scoring, contact prediction, and the SAE interpretability head. MIT-licensed weights on HuggingFace org `biohub`. Use this skill when: (1) P
.claude/skills/xuzhougeng-esmfold2/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 81% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 78% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 17% | 0% |
All-atom diffusion co-folding from the Biohub ESM release (2026). ESMFold2 = 48 pair layers with MSA support; ESMFold2-Fast = 24 layers, single-sequence only, ~1.7x faster.
License: MIT (code github.com/Biohub/esm + weights HF biohub/*). Paper: "Language Modeling Materializes a World Model of Protein Biology" (2026).
CUDA 12.x GPU (H100/A100-class); Python 3.12 only. Fresh venv; needs egress to HF Hub, GitHub, PyPI:
bashpip install --no-cache-dir uv uv venv --python 3.12 /work/venv && source /work/venv/bin/activate uv pip install \ "torch>=2.5,<2.8" einops "biotite>=1.0" rdkit msgpack-numpy biopython \ scikit-learn brotli attrs pandas cloudpathlib httpx tenacity zstd pydssp \ pygtrie accelerate huggingface_hub safetensors "numpy<3" networkx \ sentencepiece tokenizers regex packaging filelock pyyaml typing_extensions \ "transformers @ git+https://github.com/Biohub/transformers.git@3a8956fb4d4ea16b0ec8e71deef2c2909b6a5cbf" uv pip install --no-deps "esm @ git+https://github.com/Biohub/esm.git@f652b471" # OPTIONAL — only affects ESMC attention; trunk speedup comes from set_kernel_backend("fused") uv pip install ninja packaging wheel setuptools MAX_JOBS=8 uv pip install --no-deps --no-build-isolation "flash-attn<3" # Do NOT install transformer-engine — RuntimeError (not ImportError) on import # slips ESMC's guard and kills ESMFold2Model import.
For remote execution, install this version-pinned recipe on a selected and probed direct SSH GPU context, then submit inference through run_in_context. Wisp does not currently provide a Modal execution backend.
Gotchas:
None (reference PyTorch, ~12x slower than paper). Call model.set_kernel_backend('fused') after from_pretrained(). See section below.<2.8 targets CUDA 12.2.HF_HOME=/work/hf_cache.Use python only for bounded interactive checks. For structure prediction, require a selected and probed ssh:<alias> GPU context and load remote-compute-ssh. Put the documented invocation in a self-contained project script, activate the version-pinned remote environment explicitly, stage only small files with input_paths, and write predictions to a known absolute remote directory. Submit it with run_in_context, register exact ssh:// result paths in output_specs, call monitor_run once when waiting is useful, use get_run once for a snapshot, or cancel_run to stop. Do not submit a scheduler job through the SSH-direct runner.
pythonfrom esm.models.esmfold2 import ( ESMFold2InputBuilder, StructurePredictionInput, ProteinInput, DNAInput, RNAInput, LigandInput, Modification, ) from transformers.models.esmfold2.modeling_esmfold2 import ESMFold2Model model = ESMFold2Model.from_pretrained("biohub/ESMFold2").cuda().eval() # or "biohub/ESMFold2-Fast" (24 layers, no MSA, ~1.7x faster) # or "biohub/ESMFold2-Experimental{,-Fast}{,-Cutoff2025}" (4 design-critic models) spi = StructurePredictionInput(sequences=[ ProteinInput(id="A", sequence=target_seq), ProteinInput(id="B", sequence=binder_seq), # DNAInput(id="C", sequence="ACGT", modifications=[Modification(position=5, ccd="C36")]), # RNAInput(id="D", sequence="ACGU"), # LigandInput(id="L", ccd=["SAH"]), # or smiles="..." ]) # Homodimer: ProteinInput(id=["A","B"], sequence=seq) results = ESMFold2InputBuilder().fold( model, spi, num_loops=10, # paper FoldBench eval: 10; 20-loop variant: 20 num_sampling_steps=68, # paper eval: 68 (truncated EDM) num_diffusion_samples=5, # paper eval: 5/seed seed=0, ) # fold() returns list[Prediction], one per diffusion sample. Each carries # .plddt [L], .ptm, .iptm, .pae [L,L], .pair_chains_iptm, .complex.to_mmcif(). # Rank by ipTM for complexes / mean pLDDT for monomers: best = max(results, key=lambda r: float(r.iptm if r.iptm is not None else r.plddt.mean())) open("pred.cif", "w").write(best.complex.to_mmcif())
Paper-faithful FoldBench settings: 10 loops, 68 sampling steps, 25 seeds x 5 diffusion samples; rank by ipTM (complexes) or pLDDT (monomers); MSA mode adds msa_depth=1024 with 10% column masking and ESMC dropout 0.3.
biohub/| repo | size | pair layers | MSA | use | |---|---|---|---|---| | ESMFold2 | 0.94 GB + ccd.pkl 0.42 GB | 48 | yes | full eval | | ESMFold2-Fast | 0.76 GB | 24 | no | fast single-seq | | ESMFold2-Experimental{,-Fast} | 0.90 / 0.72 GB | 48 / 24 | — | design search (Alg 11) | | ESMFold2-Experimental{,-Fast}-Cutoff2025 | 0.90 / 0.72 GB | — | — | design search + critic | | ESMFold2-Experimental-Fast-base{300M,600M,6B}-step{250k..1500k} | — | — | — | 15 critic ensemble |
set_kernel_backend("fused") is REQUIREDDefault is the slow path. ESMFold2Model.from_pretrained(...) loads with _kernel_backend=None (reference PyTorch) and chunk_size=64. You MUST call:
pythonmodel = ESMFold2Model.from_pretrained("biohub/ESMFold2").cuda().eval() model.set_kernel_backend("fused") # vendored Triton TriMul/LN+SwiGLU/pair-bias kernels model.set_chunk_size(None) # optimal & OOM-safe L<=1024; use 256 above
"fused" gives ~1.5–6× trunk speedup over the reference backend, growing with L; end-to-end fold() is diffusion-bound at short L so fused breaks even around L≈300–400. Fused vs reference outputs are numerically consistent (pLDDT within noise). "fused" (Triton, bundled with the GPU torch wheel) is inference-only — auto-disables under backprop. Above ~L=1400 (chunk_size=128) it hits illegal memory access — fall back to set_kernel_backend(None) + set_chunk_size(64); validated through L=1024.
Do NOT use set_kernel_backend("cuequivariance"): the cuequivariance-torch==0.10.0 wheel lacks the compiled ops and silently falls back to the reference path. apply_torch_compile() is an alternative (NOT additive — call set_kernel_backend(None) first).
Experimental variants expose res_type_soft for gradient-guided design — see references/design-hook.md. Do NOT use the fused backend with them (fp32/bf16 dtype crash; the reference path is correct).
The Kabsch alignment in modeling_esmfold2_common.py calls torch.linalg.svd(H32, driver="gesvd") on batched 3x3 matrices. NaN/Inf inputs (degenerate diffusion samples) corrupt the cusolver workspace — all subsequent CUDA calls fail with "illegal memory access". Monkeypatch: redirect small batched SVDs to CPU:
python_orig_svd = torch.linalg.svd def _safe_svd(A, full_matrices=True, driver=None): if A.is_cuda and A.shape[-1] <= 4 and A.shape[-2] <= 4: Acpu = A.detach().float().cpu() if not torch.isfinite(Acpu).all(): Acpu = torch.nan_to_num(Acpu, nan=0.0, posinf=1e6, neginf=-1e6) out = _orig_svd(Acpu, full_matrices=full_matrices) # torch.return_types.linalg_svd is a C structseq -> ctor takes ONE tuple. return type(out)(tuple(t.to(A.device, A.dtype) for t in out)) return _orig_svd(A, full_matrices=full_matrices, driver=driver) torch.linalg.svd = _safe_svd
Note type(out)(tuple(...)), not type(out)(*(...)) — torch.return_types.* are C structseqs whose constructor takes a single tuple argument.
ESMFold2 supports per-chain MSA input via ProteinInput(id, sequence, msa=MSA). The MSA object lives at esm.utils.msa.msa.MSA:
pythonfrom esm.utils.msa.msa import MSA # ProteinInput, StructurePredictionInput as imported above msa_A = MSA.from_a3m("/path/chain_A.a3m", max_sequences=2048) msa_B = MSA.from_a3m("/path/chain_B.a3m", max_sequences=2048) inp = StructurePredictionInput(sequences=[ ProteinInput(id="A", sequence=seq_A, msa=msa_A), ProteinInput(id="B", sequence=seq_B, msa=msa_B), ])
Gotchas:
MSA.from_a3m(remove_insertions=True) asserts equal row lengths afterinsertion removal. ColabFold a3m files often carry trailing null bytes and off-by-one rows vs the query — tr -d '\000' and force row 0 to the exact query sequence (or MSA.from_sequences on manually cleaned, query-length rows).
The paper's FoldBench protocol (section A.2.11):
| Parameter | Paper default | Paper "20lp" | Notes | |---|---|---|---| | num_loops (folding-trunk recycles) | 10 | 20 | +2pp on AbAg | | num_sampling_steps (diffusion) | 68 | 68 | EDM-tuned; do NOT use 200 | | seeds x diffusion samples | 25 x 5 | 25 x 5 | Fig S6/S7 oracle = best-of-125 |
ESMFold2 and ESMFold2-Fast both use a Sept 2021 PDB training cutoff (HF biohub/ESMFold2 README).
ESMC is the Biohub successor to ESM-2; three sizes: 300M (30L), 600M (36L), 6B (80L, d=2560). HF path: AutoModelForMaskedLM.from_pretrained("biohub/ESMC-6B").
Mask token is <mask> (id 32) — use tok.mask_token. The native-SDK _ convention does NOT apply to the HF tokenizer: _ is not in the vocab and encodes to <unk>, silently corrupting mutation scores.
Full API, mutation scoring, SAE features, contact prediction: see references/esmc.md.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-09 | pass→pass | 13,865 | 3,368 | -76% | 1 | 1 | 0% | 2,053 | 3,845 | +87% | 0 | 0 | — |
case-01 | fail→pass | 22,877 | 13,800 | -40% | 1 | 1 | 0% | 4,097 | 6,137 | +50% | 0 | 0 | — |
case-02 | fail→pass | 25,970 | 15,018 | -42% | 1 | 1 | 0% | 4,813 | 6,368 | +32% | 0 | 0 | — |
case-03 | fail→pass | 19,017 | 13,067 | -31% | 1 | 1 | 0% | 3,379 | 6,115 | +81% | 0 | 0 | — |
case-04 | fail→pass | 11,414 | 2,726 | -76% | 1 | 1 | 0% | 2,079 | 3,697 | +78% | 0 | 0 | — |
case-05 | pass→pass | 11,044 | 4,000 | -64% | 1 | 1 | 0% | 1,826 | 3,932 | +115% | 0 | 0 | — |
case-06 | fail→pass | 18,421 | 3,005 | -84% | 1 | 1 | 0% | 3,223 | 3,763 | +17% | 0 | 0 | — |
case-07 | pass→pass | 7,658 | 3,730 | -51% | 1 | 1 | 0% | 1,342 | 3,952 | +194% | 0 | 0 | — |
case-08 | fail→pass | 15,199 | 5,464 | -64% | 1 | 1 | 0% | 2,352 | 4,206 | +79% | 0 | 0 | — |
case-10 | pass→pass | 16,671 | 6,329 | -62% | 1 | 1 | 0% | 2,761 | 4,549 | +65% | 0 | 0 | — |
case-11 | fail→pass | 15,363 | 2,962 | -81% | 1 | 1 | 0% | 2,887 | 3,798 | +32% | 0 | 0 | — |
case-12 | fail→pass | 9,239 | 2,579 | -72% | 1 | 1 | 0% | 1,497 | 3,614 | +141% | 0 | 0 | — |
case-13 | fail→pass | 11,913 | 2,219 | -81% | 1 | 1 | 0% | 2,048 | 3,553 | +73% | 0 | 0 | — |
case-14 | fail→pass | 13,124 | 3,041 | -77% | 1 | 1 | 0% | 2,137 | 3,741 | +75% | 0 | 0 | — |
case-15 | pass→pass | 7,343 | 3,549 | -52% | 1 | 1 | 0% | 1,143 | 3,967 | +247% | 0 | 0 | — |
case-16 | fail→pass | 29,960 | 2,678 | -91% | 1 | 1 | 0% | 2,256 | 3,688 | +63% | 0 | 0 | — |
case-17 | fail→pass | 11,710 | 5,786 | -51% | 1 | 1 | 0% | 1,997 | 4,240 | +112% | 0 | 0 | — |
case-18 | fail→pass | 9,133 | 4,889 | -46% | 1 | 1 | 0% | 1,609 | 4,316 | +168% | 0 | 0 | — |
case-19 | pass→pass | 10,589 | 5,723 | -46% | 1 | 1 | 0% | 1,959 | 4,123 | +110% | 0 | 0 | — |
case-20 | pass→pass | 12,999 | 8,551 | -34% | 1 | 1 | 0% | 2,671 | 4,940 | +85% | 0 | 0 | — |
case-21 | pass→pass | 15,658 | 10,381 | -34% | 1 | 1 | 0% | 2,815 | 5,335 | +90% | 0 | 0 | — |
case-22 | pass→pass | 8,656 | 7,803 | -10% | 1 | 1 | 0% | 1,931 | 4,553 | +136% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +59 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.