model-embeddings
Load ESM/ESM-2/MSA Transformer models, tokenize protein inputs, compute representations or contacts, and build bulk FASTA embedding extraction commands.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-embeddings
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Load ESM/ESM-2/MSA Transformer models, tokenize protein inputs, compute representations or contacts, and build bulk FASTA embedding extraction commands.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md6.2 KB
- 参考文档references/cli-reference.md3.5 KB
- 参考文档references/fsdp-offloading.md2.9 KB
- 参考文档references/troubleshooting.md4.6 KB
- 参考文档references/workflows.md3.6 KB
- 脚本scripts/esm_extract_command_builder.py5.4 KB
03 SKILL.md 正文
Model Embeddings
Use this sub-skill when an agent needs embeddings, logits, or unsupervised contact maps from ESM, ESM-2, ESM-1/1b/1v, or MSA Transformer language models. It covers Python APIs for model loading and tokenization plus the esm-extract bulk FASTA CLI.
Do not use this sub-skill for structure prediction, inverse folding, or mutation-effect scoring. Route those tasks to sibling sub-skills instead:
- Structure prediction / ESMFold PDB output:
../structure-prediction/SKILL.md - Inverse folding / ESM-IF1 design and structure-conditioned scoring:
../inverse-folding/SKILL.md - DMS or zero-shot mutation scoring:
../variant-effect-prediction/SKILL.md
Start Here
- For Python model loading, tokenization, layer selection, output tensors, and MSA shapes, read references/api-reference.md.
- For common embedding/contact workflows and safe model choices, read references/workflows.md.
- For bulk FASTA extraction,
.ptcontents, truncation, CPU/GPU flags, and command construction, read references/cli-reference.md. - For large ESM-2 15B inference with Fairscale FSDP CPU offload, read references/fsdp-offloading.md.
- For failures such as bad model names, download issues, MSA misuse, duplicate FASTA labels, layer errors, and OOM, read references/troubleshooting.md.
Bundled Helper
Use the safe command builder when constructing a reproducible esm-extract invocation without triggering model downloads:
python sub-skills/model-embeddings/scripts/esm_extract_command_builder.py \
esm2_t33_650M_UR50D input.fasta embeddings_out \
--repr-layers -1 --include mean contacts --nogpu --print-only
The helper validates that the FASTA exists, checks extraction options, warns about unsupported MSA Transformer model names, and prints a shell-quoted command by default. It does not import esm or load model weights for --help or --print-only.
Quick Decisions
- Use
esm.pretrained.load_model_and_alphabet(name)or a specificesm.pretrained.<model>()function for Python embeddings. - Use
alphabet.get_batch_converter(truncation_seq_length=...)for single-sequence models and MSA models; MSA alphabets returnMSABatchConverterautomatically. - Use
model(tokens, repr_layers=[...], return_contacts=True)for hidden representations plus contact maps. - Use
esm-extractonly for single-sequence models; MSA Transformer requires Python API input shaped as a batch of MSAs. - Force CPU with
--nogpuinesm-extractor by keeping tensors/model on CPU in Python; expect slow inference for large models.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).