fair-esm2
यह क्या करती है
यह स्किल एजेंट को Meta के ESM-2 प्रोटीन लैंग्वेज मॉडल का उपयोग करना सिखाती है। यह हर अवशेष और हर सीक्वेंस के लिए embeddings बनाती है, masked prediction से म्यूटेशन स्कोर करती है, और अवशेषों के बीच contacts का अनुमान लगाती है।
कब इस्तेमाल करें
- ✓जब रिसर्चर को मशीन लर्निंग मॉडल को देने के लिए प्रोटीन embeddings चाहिए।
- ✓जब वैज्ञानिक लैंग्वेज मॉडल से किसी म्यूटेशन के असर का स्कोर चाहता है।
- ✓जब रिसर्चर सीक्वेंस से अवशेषों के बीच अनुमानित contacts चाहता है।
Skill का लिंक
https://github.com/aipoch/open-science/blob/main/resources/skills/fair-esm2/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इन प्रोटीन सीक्वेंस के लिए ESM-2 से embeddings बनाइए, ताकि मैं उन पर क्लासिफ़ायर प्रशिक्षित कर सकूँ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट ESM-2 मॉडल लोड करता है, सीक्वेंस को टोकन में बदलता है, और चुनी हुई परत से प्रतिनिधित्व निकालने के लिए मॉडल चलाता है। फिर वह कार्य के अनुसार नतीजों का औसत निकालता है या उन्हें स्कोर करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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
अक्सर पूछे जाने वाले सवाल
क्या यह ESMFold2 जैसा ही है?
नहीं। स्किल कहती है कि fair-esm Meta का पैकेज है, और ESMFold2 एक अलग लाइब्रेरी है।
कितनी GPU मेमोरी चाहिए?
स्किल छोटे मॉडल के लिए 8 GB और 650 मिलियन पैरामीटर वाले मॉडल के लिए 16 GB बताती है।
कौन-सा लाइसेंस लागू है?
स्किल कहती है कि ESM-2 का कोड और weights MIT लाइसेंस के अंतर्गत हैं।
जानकारी
लेखक का मूल विवरण
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.
repo: aipoch/open-science
लोकप्रियता
- GitHub स्टार
- 5.4k
- रैंकिंग में स्थान
- #14860
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
alphafold2
5.4kयह आपके एजेंट को ColabFold रनर के ज़रिए AlphaFold2 से प्रोटीन की 3D संरचना उसके सीक्वेंस से अनुमानित करने देती है, प्रोटीन कॉम्प्लेक्स सहित।
boltz
5.4kयह आपके एजेंट को Boltz-2 मॉडल से प्रोटीन, DNA, RNA और छोटे अणुओं के कॉम्प्लेक्स अनुमानित करने देती है, वैकल्पिक बाइंडिंग एफ़िनिटी के साथ।
borzoi
5.4kयह आपके एजेंट को DNA सीक्वेंस से जीनोम-व्यापी गतिविधि ट्रैक, जैसे एक्सप्रेशन और एक्सेसिबिलिटी, अनुमानित करने देती है, और वेरिएंट की अनुमानित असर से तुलना करने देती है।
chai1
5.4kयह आपके एजेंट को एक FASTA फ़ाइल से Apache लाइसेंस वाले Chai-1 मॉडल के साथ प्रोटीन, न्यूक्लिक एसिड और लिगैंड कॉम्प्लेक्स की संरचना अनुमानित करने देती है।
मिलती-जुलती skills
pytorch-patterns
280kआपके एजेंट को machine learning models के लिए PyTorch इस्तेमाल करने में मदद करता है। कुशल model training के best practices लागू करता है और नतीजों को दोहराने लायक रखता है।
evm-token-decimals
280kयह आपके एजेंट को अलग-अलग blockchain networks पर decimal numbers की गलतियों से बचने में मदद करता है। यह transactions और calculations में token values सही रखने का ध्यान रखता है।
ito-inference
280kआपके एजेंट को AI models की उपलब्धता जाँचने देता है। यह compute request को तैयार model service से जोड़ता है।