data-preparation
Prepares and inspects Multi30k and WMT-style BPE data for the attention-is-all-you-need-pytorch Transformer workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-preparation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Prepares and inspects Multi30k and WMT-style BPE data for the attention-is-all-you-need-pytorch Transformer workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md5.3 KB
- 参考文档references/troubleshooting.md7.4 KB
- 参考文档references/workflows.md7.6 KB
- 脚本scripts/bpe_tiny_demo.py7.6 KB
- 脚本scripts/inspect_preprocessed_pickle.py15.3 KB
03 SKILL.md 正文
Data Preparation
Use this sub-skill when a task asks how to preprocess translation data for this repo, inspect a saved preprocessing pickle, reason about the legacy torchtext schemas consumed by training or translation, or try the repository's BPE logic without downloading WMT corpora.
Route by task
- Preprocess the default Multi30k German/English example: read references/workflows.md. It covers the spaCy model prerequisites, legacy torchtext version expectations, and the command shape for the default non-BPE path.
- Inspect an existing
*.pklpreprocessing artifact: run scripts/inspect_preprocessed_pickle.py and then read references/data-formats.md to map the reported schema to training/translation consumers. - Understand BPE support: read references/workflows.md and references/data-formats.md. The repository's BPE route is WIP and is suitable for training-data preparation experiments, not finished translation decoding.
- Try BPE locally without WMT downloads: run
scripts/bpe_tiny_demo.py. It is a safe, deterministic
adaptation of the repository's
learn_bpe/apply_bpebehavior for tiny local corpora. - Debug preprocessing failures: read references/troubleshooting.md before retrying downloads, changing dependency versions, or assuming a pickle is corrupt.
High-value facts
- The default executable path calls the non-BPE
main_wo_bpeflow. It creates a single pickle containing settings, source/target torchtextFieldobjects, andtrain/valid/testexample lists. - The BPE flow is present but WIP. It requires switching the preprocessing entry
point to the BPE
mainflow, downloads WMT-style archives, writes encoded*.src/*.trgfiles, and saves only a shared torchtextFieldplus settings in the pickle. - Token constants are fixed: padding
<blank>, unknown<unk>, BOS<s>, and EOS</s>. These must exist in the relevant field vocabularies before training or translation. - Custom
-data_src/-data_trgfiles are rejected by the default non-BPE path; do not promise arbitrary local text preprocessing unless a new conversion path is intentionally implemented outside the stock command.
Bundled helpers
# Refuses to unpickle until the caller explicitly acknowledges pickle trust.
python sub-skills/data-preparation/scripts/inspect_preprocessed_pickle.py --help
python sub-skills/data-preparation/scripts/inspect_preprocessed_pickle.py --pickle m30k_deen_shr.pkl --trust-pickle
# Safe BPE demonstration with built-in tiny corpus; no downloads or repo imports.
python sub-skills/data-preparation/scripts/bpe_tiny_demo.py --help
python sub-skills/data-preparation/scripts/bpe_tiny_demo.py --symbols 12 --min-frequency 2
Both scripts are deterministic, runnable from arbitrary current directories, and avoid importing the original repository source. If a task needs model training, checkpoint handling, or translation output, route to the sibling training or translation sub-skill instead.
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).