fair-esm2
하는 일
이 스킬은 Meta의 ESM-2 단백질 언어 모델을 사용하는 방법을 에이전트에게 가르칩니다. 잔기별과 서열별 임베딩을 만들고, 마스크 예측으로 돌연변이를 점수화하며, 잔기 간 접촉을 예측합니다.
사용하는 경우
- ✓연구자가 기계 학습 모델에 넣을 단백질 임베딩이 필요할 때.
- ✓과학자가 언어 모델로 돌연변이의 효과를 점수화하고 싶을 때.
- ✓연구자가 서열로부터 잔기 사이의 예측된 접촉을 원하는 경우.
스킬 링크
https://github.com/aipoch/open-science/blob/main/resources/skills/fair-esm2/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 단백질 서열들의 임베딩을 ESM-2로 만들어서, 분류기를 학습할 수 있게 해 주세요.”
매주 새 스킬 5개. 읽는 데 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 메모리는 얼마나 필요한가요?
스킬은 작은 모델에 8GB, 6억 5천만 파라미터 모델에 16GB를 나열합니다.
어떤 라이선스가 적용되나요?
스킬은 ESM-2 코드와 가중치가 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
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
alphafold2
5.4k에이전트가 ColabFold 러너를 통해 AlphaFold2로 단백질 서열의 3차원 구조를 예측하고, 단백질 복합체도 다루도록 돕습니다.
boltz
5.4k에이전트가 오픈 소스 Boltz-2 모델로 단백질, DNA, RNA, 저분자 복합체의 구조를 예측하도록 돕고, 선택적으로 결합 친화도 추정도 제공합니다.
borzoi
5.4k에이전트가 DNA 서열로부터 발현과 접근성 같은 게놈 전체의 활성 트랙을 예측하고, 예측된 효과로 변이를 비교하도록 돕습니다.
chai1
5.4k에이전트가 Apache 라이선스의 Chai-1 모델을 사용해, 하나의 FASTA 파일로 단백질, 핵산, 리간드 복합체의 구조를 예측하도록 돕습니다.