AGENT SKILL

conversion

Routes OpenNMT-py checkpoint averaging, release, CTranslate2, external-family conversion, vocabulary or embedding extraction, and LoRA merge workflows.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
conversion
license
MIT
metadata
{ "disco-role": "operating" }
description
Routes OpenNMT-py checkpoint averaging, release, CTranslate2, external-family conversion, vocabulary or embedding extraction, and LoRA merge workflows.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

Conversion

Use this sub-skill when the task is about OpenNMT-py checkpoint maintenance or model-format conversion rather than training or translation.

Use this route when

  • The request says average checkpoints, strip optimizer state, release a model, convert to CTranslate2, quantize for CT2, or inspect a saved checkpoint.
  • The user needs to convert a LLaMA, Mistral, Mixtral, Phi, T5, MPT, Falcon, RedPajama, XGen, or Hugging Face-style checkpoint into OpenNMT-py format.
  • The user needs to extract source/target vocabularies, inspect or export embeddings, convert pretrained embeddings to tensors, or check vocab availability.
  • The user needs to merge or concatenate LoRA weights into a compatible base OpenNMT-py model.

Do not use this route when

  • The main work is building corpora or tokenizers before training; use the data-preparation route.
  • The main work is choosing architecture, optimizer, LoRA training options, or checkpoint continuation; use the training route.
  • The main work is running inference or serving an already released model; use the inference route.

Start here

  1. Read references/checkpoint-tools.md to identify the exact checkpoint family, expected files, command/API surface, validation checks, and output format.

  2. Before changing a checkpoint, inspect the input with scripts/check_checkpoint_file.py:

    python scripts/check_checkpoint_file.py path/to/model.pt --json
    

    The helper maps tensors to CPU or fake tensors and reports top-level keys, option fields, vocab sides, tensor counts, and conversion-readiness hints.

  3. Read references/troubleshooting.md before running weight-heavy conversion, CTranslate2 release, external/Hugging Face conversion, or LoRA merge.

  4. Prefer package console commands for installed OpenNMT-py entry points: onmt_average_models and onmt_release_model. For utilities that were only source-tree tools, use the distilled contracts in references/checkpoint-tools.md and create a task-local reviewed helper instead of depending on any particular checkout path.

Primary workflows

  • Average compatible checkpoints: check all inputs, confirm identical vocabulary and architecture options, then run onmt_average_models -models ... -output averaged.pt; add -fp32 when the release target must not preserve half precision.
  • Release PyTorch or CTranslate2 models: use onmt_release_model --format pytorch to drop optimizer state, or --format ctranslate2 with an optional quantization mode to create a CT2 model directory.
  • Convert external model families: use the family matrix and option contracts in references/checkpoint-tools.md; validate that the output checkpoint has model, generator, vocab, and opt sections before training or release.
  • Extract vocabularies or embeddings: confirm vocab.src/vocab.tgt first, then use the reference recipes to write vocab text files or embedding tensors without relying on source checkout scripts.
  • Merge LoRA weights: verify the base and LoRA checkpoints share architecture/vocab assumptions, merge for inference or concatenate for resumed training, then inspect the output and release it if needed.

Safety and validation rules

  • Treat torch.load checkpoints as trusted pickle files; do not inspect arbitrary untrusted checkpoints without an isolation plan.
  • Conversion and inspection should not place tensors on GPU. Use CPU/fake-tensor loading for checks, and only select GPU for downstream inference/training if the owning route requires it.
  • Never average checkpoints from different vocabularies, architectures, model tasks, or incompatible LoRA/base states.
  • For CT2, validate that the output is a directory with CT2 files such as model.bin, config.json, and vocabulary.json, not a .pt checkpoint.
  • Keep real model paths, Hugging Face tokens, cache directories, and machine-specific paths out of skill notes and reusable scripts.

Bundled files

  • references/checkpoint-tools.md — workflows, command/API contracts, external family matrix, vocab/embedding and LoRA guidance.
  • references/troubleshooting.md — symptoms, likely causes, and recovery steps for conversion-specific failures.
  • scripts/check_checkpoint_file.py — safe checkpoint inventory helper for OpenNMT-py .pt metadata and tensor summaries.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351