Skip to content
Back to skills

Model Embeddings

ASecurity

"Load ESM/ESM-2/MSA Transformer models, tokenize protein inputs,

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
toolspythonshellbashgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill model-embeddings --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Model Embeddings?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Model Embeddings
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-model-embeddings/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-model-embeddings)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: model-embeddings
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
metadata:
  disco-role: operating
license: MIT
---

# 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

1. For Python model loading, tokenization, layer selection, output tensors, and MSA shapes, read [references/api-reference.md](references/api-reference.md).
2. For common embedding/contact workflows and safe model choices, read [references/workflows.md](references/workflows.md).
3. For bulk FASTA extraction, `.pt` contents, truncation, CPU/GPU flags, and command construction, read [references/cli-reference.md](references/cli-reference.md).
4. For large ESM-2 15B inference with Fairscale FSDP CPU offload, read [references/fsdp-offloading.md](references/fsdp-offloading.md).
5. For failures such as bad model names, download issues, MSA misuse, duplicate FASTA labels, layer errors, and OOM, read [references/troubleshooting.md](references/troubleshooting.md).

## Bundled Helper

Use the safe command builder when constructing a reproducible `esm-extract` invocation without triggering model downloads:

```bash
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 specific `esm.pretrained.<model>()` function for Python embeddings.
- Use `alphabet.get_batch_converter(truncation_seq_length=...)` for single-sequence models and MSA models; MSA alphabets return `MSABatchConverter` automatically.
- Use `model(tokens, repr_layers=[...], return_contacts=True)` for hidden representations plus contact maps.
- Use `esm-extract` only for single-sequence models; MSA Transformer requires Python API input shaped as a batch of MSAs.
- Force CPU with `--nogpu` in `esm-extract` or by keeping tensors/model on CPU in Python; expect slow inference for large models.

Files in this skill

  • SKILL.md2.9 KB
  • 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.