ESM-2
Embed proteins with Meta AI's ESM-2 (`fair-esm` package). Use this skill when: (1) Extracting per-residue or per-sequence embeddings for downstream ML, (2) Masked-LM likelihood / mutation effect scoring, (3) Contact prediction from a sequence.
Install / Use
npx skills add aipoch/open-science --skill fair-esm2Installs into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of ESM-2
ESM-2 scores 91/100 on our quality scale, 326th of 947 AI & Machine Learning skills we index (top 35%).
Its SKILL.md is 5.8 KB long, well organised into 12 sections with 5 code examples: a solid amount of guidance for an agent.
With 4,918 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so ESM-2 is actively maintained.
- Our last check on 2026-10-28 found the source still online.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-29. Automated pattern scan on 2026-09-29. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
ESM-2 compared with similar skills
All 4 of these similar skills score higher than ESM-2; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| ESM-2 (this skill)by aipoch | 91 | 4.9k | 53d ago | SKILL.md |
| claude-memby thedotmack | 100 | 117.6k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 92.8k | 1d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
Frequently asked questions
- How do I install ESM-2?
- Run
npx skills add aipoch/open-science --skill ESM-2. The install tabs above show the steps for each supported agent. - Which AI agents does ESM-2 work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is ESM-2 safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is ESM-2 still maintained?
- The repository was last updated about 2 months ago, so ESM-2 is actively maintained.
Skill content
View source on GitHubname: fair-esm2
description: >
Embed proteins with Meta AI's ESM-2 (fair-esm package). Use this skill
when: (1) Extracting per-residue or per-sequence embeddings for downstream
ML, (2) Masked-LM likelihood / mutation effect scoring, (3) Contact
prediction from a sequence.
license: Apache-2.0
category: biomodels
requirements: [gpu]
metadata:
display-name: ESM-2
github.com/facebookresearch/esm/blob/main/LICENSE: MIT (© Meta Platforms,
Inc. and affiliates). verified 2026-06-30
third_party: - kind: weights name: ESM-2 provider: Meta AI license: MIT terms_url: https://github.com/facebookresearch/esm/blob/main/LICENSE
fair-esm2 — ESM-2 (Meta AI)
ESM-2 code and weights are MIT (Meta AI, github.com/facebookresearch/esm).
Package disambiguation.
pip install fair-esmgives youimport esmwithesm.pretrained.*(ESM-1/2). Biohub's github.com/Biohub/esm fork (MIT) gives youfrom esm.models.esmfold2 import ESMFold2InputBuilder— see theesmfold2skill. Both share theesmnamespace but are different libraries. This skill covers fair-esm (the Meta package).
Prerequisites
| Requirement | Minimum | Recommended | | ----------- | ----------------------- | ------------------ | | Python | 3.8+ | 3.11 | | CUDA | 11.7+ | 12.x | | GPU VRAM | 8 GB (8M), 16 GB (650M) | 24 GB+ (650M / 3B) |
How to run
Embeddings
import torch, esm
model, alphabet = esm.pretrained.esm2_t33_650M_UR50D()
model = model.eval().cuda()
bc = alphabet.get_batch_converter()
_, _, toks = bc([("ubq", "MQIFVKTLTGKTITLEVEPSDTIENVK")])
with torch.no_grad():
out = model(toks.cuda(), repr_layers=[33])
emb = out["representations"][33] # (1, L+2, 1280) — includes BOS/EOS
seq_emb = emb[0, 1:-1].mean(0) # per-sequence mean
Masked-LM scoring
with torch.no_grad():
out = model(toks.cuda(), repr_layers=[33])
logits = out["logits"][0, 1:-1] # (L, |vocab|)
# WT marginal log-likelihood; for mutation scoring, mask the position and
# compare logit[mut] − logit[wt].
Contact prediction
with torch.no_grad():
out = model(toks.cuda(), repr_layers=[33], return_contacts=True)
contacts = out["contacts"][0] # (L, L)
Models
| Name | Layers | Dim | Params | Use |
| --------------------- | ------ | ---- | ------ | ---------------------------- |
| esm2_t6_8M_UR50D | 6 | 320 | 8 M | Fast smoke / tiny embeddings |
| esm2_t33_650M_UR50D | 33 | 1280 | 650 M | Default embedding model |
| esm2_t36_3B_UR50D | 36 | 2560 | 3 B | Best embeddings, 24 GB+ |
Output format
out["representations"][layer] is (B, L_max+2, D), where L_max is the
longest tokenized residue sequence in the batch. ESM-2 adds BOS/EOS and pads
shorter sequences after EOS. The single-sequence 1:-1 slice above is valid
without padding; in a mixed-length batch it includes EOS and may include padding
for shorter sequences.
For a batch, count non-padding tokens separately for each sequence, then remove
BOS/EOS before pooling. Here toks and out must come from the same batch:
token_lengths = (toks != alphabet.padding_idx).sum(1).tolist() # includes BOS/EOS
emb = out["representations"][33]
residue_embs = [emb[i, 1 : token_length - 1] for i, token_length in enumerate(token_lengths)]
seq_embs = torch.stack([residues.mean(0) for residues in residue_embs]) # (B, D)
Use nonempty protein sequences. Keep the batch order when associating embeddings
with sequence IDs. out["contacts"] (when return_contacts=True) has shape
(B, L_max, L_max); for sequence i, retain only
out["contacts"][i, : token_lengths[i] - 2, : token_lengths[i] - 2].
Remote compute
Needs ≥16 GB VRAM (650M model) and either pre-cached .pt checkpoints or
egress to dl.fbaipublicfiles.com. Read
compute_details({provider, mode:'read'}) for an environment with fair-esm
and a torch-hub weight cache, then:
c = host.compute.create(provider)
job = c.submitJob(
intent="ESM-2 650M embeddings for 200 sequences — 1×GPU, ~2 min",
inputs=[
{"src": "seqs.fasta", "dstFilename": "seqs.fasta"},
{"src": "embed_esm2.py", "dstFilename": "embed_esm2.py"},
],
command="python3 embed_esm2.py",
environment=..., # env name from compute_details
outputs=["embeddings.pt"],
timeoutSeconds=1800,
)
print(job.job_id) # cell ends here — kernel never blocks on compute
Retain the exact returned job_id. Query that saved ID with the non-blocking
c.attachJob(job_id).status() or .result() when its state or result is relevant; do not scan Job
history. A final .result() read reports whether its follow-up was suppressed or had already been
committed; otherwise the app starts the later analysis turn for an unread final result. See the
remote-compute-ssh skill for details.
Inside embed_esm2.py, set TORCH_HOME to the provider's torch-hub cache
mount (path is in compute_details) so esm.pretrained.* resolves locally.
Troubleshooting
| Symptom | Cause | Fix |
| --------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------- |
| ModuleNotFoundError: No module named 'esm.models' | You want Biohub's esm fork, not fair-esm | See esmfold2 skill; this skill uses esm.pretrained.* |
| Slow first call | Downloading weights via torch.hub | Set TORCH_HOME to a cached location |
Next: feed embeddings to a classifier. For structure prediction, use
esmfold2.
Related Skills
claude-mem
117.6kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
92.8kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
