esm
它能做什么
这个工具使用名为 ESM 的工具包来创建、理解和预测蛋白质的形状。它可以生成新的蛋白质序列,为现有序列创建数值表示(嵌入,embeddings),并预测蛋白质的三维结构(折叠)。
适用场景
- ✓根据某种模式生成新的蛋白质序列时。
- ✓获取蛋白质序列的数值表示,以便进一步分析时。
- ✓根据序列预测蛋白质的三维结构时。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/esm/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“根据 'MPRT___KEND' 生成一个新的蛋白质序列,然后预测它的三维结构。”
每周 5 个新技能,1 分钟读完。
工作原理
你向工具提供蛋白质序列或模式。它会使用预训练模型生成新序列、计算嵌入或预测三维结构。结果在返回前会先进行错误检查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
ESM: protein generation, embeddings, and folding
When to use
Use for Biohub's esm SDK: ESM3 masked multimodal generation, ESMC sequence
representations, and ESMFold2 all-atom prediction. The former Forge platform
migrated to https://biohub.ai, including ESM3; SDK class names still contain
Forge. This skill targets the released esm 3.4.1.post1, verified against
its wheel and current official documentation.
fair-esm is Meta's separate, older ESM2/ESMFold/ESM-IF distribution. Both
packages import as esm; install them in separate environments. The legacy
esm.pretrained.esm2_* interface is not the Biohub ESMC interface. Hugging Face
Transformers' native ESMC implementation is another API: do not interchange its
version requirements or output types with this SDK.
Setup and model choice
uv venv --python 3.12 .venv-esm
uv pip install --python .venv-esm/bin/python "esm==3.4.1.post1"
The release declares Python >=3.12, Torch >=2.11,<2.12 and Transformers
=4.57.6,<5. Python 3.12, Torch 2.11.0 and Transformers 4.57.6 were tested on CPU. Linux x86_64 installs include GPU-specific dependencies; use a supported inference machine and budget disk space. Flash Attention is optional; it is unnecessary for the tiny CPU tests. Do not install this stack into a shared environment containing incompatible Transformers or Torch pins.
| Task | Local model/API | Hosted client/model |
|---|---|---|
| ESM3 sequence/structure/function generation | ESM3.from_pretrained("esm3-sm-open-v1") |
client("esm3-medium-2024-08"); small/large IDs in the ESM3 reference |
| ESMC embeddings | EsmcForMaskedLM and EsmcTokenizer; biohub/ESMC-300M, biohub/ESMC-600M, biohub/ESMC-6B |
esmc_client("esmc-600m-2024-12"); 300M/6B also documented |
| ESMFold2 all-atom structures | EsmFold2Model, ESMFold2InputBuilder; biohub/ESMFold2 |
esmfold2_client("esmfold2-fast-2026-05") |
ESMC 6B weights are now available locally. Current Biohub model cards identify
MIT licensing, with ESMC cards also linking third-party notices; review the
exact selected artifact's card and access requirements.
The older ESMC class remains as a deprecated compatibility wrapper. Local
model sizes, hosted availability and account quotas are different constraints;
a larger model does not guarantee better performance on a particular assay.
Workflow
- Specify the sequence/chain/residue mapping and whether the objective is
generation, representation extraction or folding. Preserve input IDs and
source provenance. Reject accidental
..., spaces, FASTA headers or gaps in plain single-chain sequences rather than silently deleting them. - Choose a local checkpoint or explicit hosted model ID. Record SDK, checkpoint revision, model settings, mask locations and random seed where supported.
- Check every SDK result for
ESMProteinError. Hosted failures may be returned as values. Use finite request timeouts, context managers and bounded concurrency. See hosted contracts. - Validate the output contract: sequence length and fixed residues, residue-only embedding axes, or chain/atom mapping and confidence. Keep model predictions separate from experimental validation.
- Save sequences/structures with settings and identifiers. Avoid caches keyed only by sequence when model, structure, function or generation settings differ.
ESM3 completion and fresh structure prediction
Illustrative pretrained inference; no weights or hosted jobs were run in this refresh. This toy sequence demonstrates API mechanics, not a functional design.
import torch
from esm.models.esm3 import ESM3
from esm.sdk.api import ESMProtein, ESMProteinError, GenerationConfig
model = ESM3.from_pretrained("esm3-sm-open-v1", device=torch.device("cpu"))
prompt = "MPRT___KEND"
completed = model.generate(
ESMProtein(sequence=prompt),
GenerationConfig(track="sequence", num_steps=3, temperature=0.7),
)
if isinstance(completed, ESMProteinError):
raise completed
assert completed.sequence is not None and len(completed.sequence) == len(prompt)
assert "_" not in completed.sequence
assert all(a == "_" or a == b for a, b in zip(prompt, completed.sequence))
# A fresh sequence-only prompt prevents old coordinates conditioning the check.
folded = model.generate(
ESMProtein(sequence=completed.sequence),
GenerationConfig(track="structure", num_steps=8),
)
if isinstance(folded, ESMProteinError):
…
常见问题
ESM3、ESMC 和 ESMFold2 有什么区别?
ESM3 用于生成序列和结构。ESMC 用于创建序列的数值表示(嵌入)。ESMFold2 用于预测蛋白质的三维结构(折叠)。
我可以在自己的电脑上运行这个工具吗?
可以。你可以在本地安装并运行模型,但可能需要性能较强的电脑,尤其是运行较大的模型时。
什么是“嵌入”(embedding)?
它是把蛋白质序列表示成一组数字的方法,有助于计算机理解和比较不同的序列。
详情
作者的原始描述
Uses the Biohub esm Python SDK for ESM3 protein generation, ESMC embeddings, and ESMFold2 all-atom folding. Applies to local model inference and Biohub hosted clients, including former Forge workflows; distinguishes the separate legacy fair-esm distribution.
热度
- GitHub 星标
- 51k
- 排名
- #3455
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …