Tooluck logoTooluck
SKILL.md

fair-esm2

Agent skill fromaipoch/open-science

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.

How to install fair-esm2

install fair-esm2
# install the open-science pack with the skills CLI
npx skills add aipoch/open-science

# or add only this skill to Claude Code: copy the folder

resources/skills/fair-esm2/

# into

~/.claude/skills/fair-esm2/ (all projects)

.claude/skills/fair-esm2/ (one project)

resources/skills/fair-esm2/SKILL.md

Apache-2.0Full file
1# fair-esm2 — ESM-2 (Meta AI)
2
3ESM-2 code and weights are MIT (Meta AI, github.com/facebookresearch/esm).
4
5> **Package disambiguation.** `pip install fair-esm` gives you `import esm`
6> with `esm.pretrained.*` (ESM-1/2). Biohub's github.com/Biohub/esm fork
7> (MIT) gives you `from esm.models.esmfold2 import ESMFold2InputBuilder` —
8> see the **`esmfold2`** skill. Both share the `esm` namespace but are
9> different libraries. This skill covers **fair-esm** (the Meta package).
10
11## Prerequisites
12
13| Requirement | Minimum | Recommended |
14| ----------- | ----------------------- | ------------------ |
15| Python | 3.8+ | 3.11 |
16| CUDA | 11.7+ | 12.x |
17| GPU VRAM | 8 GB (8M), 16 GB (650M) | 24 GB+ (650M / 3B) |
18
19## How to run
20
21### Embeddings
22
23```python
24import torch, esm
25
26model, alphabet = esm.pretrained.esm2_t33_650M_UR50D()
27model = model.eval().cuda()
28bc = alphabet.get_batch_converter()
29
30_, _, toks = bc([("ubq", "MQIFVKTLTGKTITLEVEPSDTIENVK")])
31with torch.no_grad():
32 out = model(toks.cuda(), repr_layers=[33])
33emb = out["representations"][33] # (1, L+2, 1280) — includes BOS/EOS
34seq_emb = emb[0, 1:-1].mean(0) # per-sequence mean
35```
36
37### Masked-LM scoring
38
39```python
40with torch.no_grad():
41 out = model(toks.cuda(), repr_layers=[33])
42logits = out["logits"][0, 1:-1] # (L, |vocab|)
43# WT marginal log-likelihood; for mutation scoring, mask the position and
44…

Excerpt shown under the repository's Apache-2.0 license.

More skills in open-science

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent 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

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates