sa-prot
Use SaProt for structure-aware protein language modeling, AA+3Di sequence conversion, model inference, LMDB configs, training, and mutation-effect evaluation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sa-prot
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use SaProt for structure-aware protein language modeling, AA+3Di sequence conversion, model inference, LMDB configs, training, and mutation-effect evaluation.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/repo-provenance.md2.4 KB
- 参考文档references/repo-routing-metadata.json324 B
- 参考文档references/setup-and-dependencies.md4.3 KB
- 参考文档references/troubleshooting.md3.6 KB
- 脚本scripts/check_sa_prot_environment.py8.0 KB
03 SKILL.md 正文
SaProt Repo Skill
Use this skill when a task involves SaProt, structure-aware protein language modeling, AA+3Di tokens, Foldseek 3Di sequences, SaProt checkpoints, mutation-effect scoring, inverse folding, SaProt LMDB datasets, YAML task configs, fine-tuning, pretraining, ProteinGym, or ClinVar evaluation.
SaProt expects structure-aware sequences where each residue is represented as an amino acid plus a Foldseek 3Di token, such as M#EvVpQpL#VyQdYaKv. The 35M and 650M SaProt checkpoints work best with SA-token input for frozen embeddings; the 1.3B variants are documented as stronger for AA-only workflows.
Quick Start
- Read
references/setup-and-dependencies.mdto decide whether the task needs only static checks, Foldseek conversion, model inference, or the full training stack. - Run the shared checker when the user provides local assets:
python scripts/check_sa_prot_environment.py --model-dir <local-model-dir> --foldseek <foldseek> - Route to the focused sub-skill for the main task.
- Keep heavyweight steps explicit: model downloads, full benchmark datasets, GPU training, and Foldseek installation are user-provided prerequisites, not bundled by this skill.
Route Map
sub-skills/structure-sequences/SKILL.md: convert PDB/mmCIF structures to amino-acid, Foldseek 3Di, or combined AA+3Di sequences; diagnose Foldseek and pLDDT masking.sub-skills/model-inference/SKILL.md: load local SaProt model assets, tokenize combined sequences, extract embeddings, score mutations, predict substitution effects/probabilities, or run inverse folding.sub-skills/datasets-configs/SKILL.md: build/validate SaProt LMDB splits, inspect JSON row schemas, edit task YAMLs, and validate config paths without importing heavy ML frameworks.sub-skills/training-evaluation/SKILL.md: adapt pretraining, fine-tuning, zero-shot mutation benchmark, ClinVar AUC, Lightning trainer, WandB, checkpoint, and GPU settings safely.
Common Task Routing
| User asks for | Read |
|---|---|
| Convert a structure to SaProt input | sub-skills/structure-sequences/SKILL.md |
Understand M#EvVp tokenization or pLDDT masking |
sub-skills/structure-sequences/references/sequence-formats.md |
Load SaProt_650M_AF2 or validate local weights |
sub-skills/model-inference/SKILL.md and sub-skills/model-inference/references/model-assets.md |
Score V3A or V3A:Q4M mutations |
sub-skills/model-inference/SKILL.md |
| Create LMDB data from JSONL rows | sub-skills/datasets-configs/SKILL.md |
| Adapt a task config from GPU to CPU/one-GPU smoke | sub-skills/datasets-configs/SKILL.md, then sub-skills/training-evaluation/SKILL.md |
| Run or dry-run fine-tuning/evaluation launchers | sub-skills/training-evaluation/SKILL.md |
| Merge ClinVar prediction logs and labels into AUC | sub-skills/training-evaluation/SKILL.md |
Minimal Environment Checks
Use these checks before writing code that imports SaProt modules:
python scripts/check_sa_prot_environment.py --check-python-imports
python scripts/check_sa_prot_environment.py --model-dir <local-model-dir>
python scripts/check_sa_prot_environment.py --foldseek <foldseek>
For model-specific asset validation, use sub-skills/model-inference/scripts/check_model_assets.py. For config validation, use sub-skills/datasets-configs/scripts/validate_config.py or sub-skills/training-evaluation/scripts/saprot_config_check.py depending on whether the task is data/config preparation or launch-risk review.
Safety Rules
- Do not launch pretraining, downstream fine-tuning, ProteinGym-wide evaluation, or ClinVar-wide evaluation unless the user explicitly asks for an expensive run.
- Do not assume model weights, Foldseek, or LMDB datasets are bundled; validate user-provided local paths.
- Do not paste WandB API keys into shared configs. Prefer private environment variables or disable logging for dry-runs.
- Do not hard-code CUDA. Choose CPU-safe diagnostics first, then move to GPU only after checking the installed PyTorch/CUDA stack and model size.
- Treat example paths such as
LMDB/,weights/PLMs/, andbin/foldseekas conventions to adapt inside the user’s active project.
References
references/setup-and-dependencies.md: install modes, optional dependencies, model/data/Foldseek prerequisites, and quick check commands.references/troubleshooting.md: cross-cutting import, path, asset, GPU, logging, and stale-skill issues.references/repo-provenance.md: source snapshot used to decide when this skill may need refresh.references/repo-routing-metadata.json: structured routing metadata used byrepo-skills-routerduring import.
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).