data-preparation
Prepare and validate flat pretraining, packed SFT, preference, and RL prompt datasets for train-llm-from-scratch.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-preparation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Prepare and validate flat pretraining, packed SFT, preference, and RL prompt datasets for train-llm-from-scratch.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/data-formats.md5.8 KB
- 参考文档references/troubleshooting.md6.9 KB
- 参考文档references/workflows.md6.4 KB
- 脚本scripts/inspect_h5_tokens.py7.0 KB
- 脚本scripts/validate_preference_jsonl.py7.1 KB
- 脚本scripts/validate_rl_prompts_jsonl.py8.4 KB
- 脚本scripts/validate_sft_h5.py10.4 KB
03 SKILL.md 正文
Data Preparation Router
Use this sub-skill when a task is about building, inspecting, validating, or triaging datasets for this repository's LLM pipeline. Keep training, checkpoint, evaluation, chat, and UI work routed to the sibling skills listed below.
Decide The Dataset Shape First
- Base pretraining text -> flat HDF5
tokensarray. Use for next-token base-model pretraining. - SFT/instruction data -> packed HDF5 with aligned
tokensandloss_mask. Use for assistant-only supervised fine-tuning. - Preference data -> JSONL rows with
prompt,chosen, andrejected. Use for reward-model training and DPO/ORPO/KTO. - RL prompts -> JSONL rows with
promptand numeric-or-nullgold; the arithmetic curriculum is the same schema. Use for PPO and GRPO/RLVR.
Read references/data-formats.md for exact schema,
mask, tokenizer, and data-loader contracts before accepting a user-provided file.
Read references/workflows.md for distilled command
recipes and safe small-data checks. Read
references/troubleshooting.md when validation
fails or data generation is blocked by dependencies, cache, network, or context
limits.
Safe Validators Bundled Here
These scripts do not download data, train models, modify input files, or require a repository checkout. Run them before launching any stage that consumes the data.
scripts/inspect_h5_tokens.py— inspect a flat pretraining HDF5tokensdataset: shape, dtype, min/max, EOT count, and optional head decode.scripts/validate_sft_h5.py— validate packed SFT HDF5tokensandloss_maskschema, binary mask, token range, and trained-token fraction.scripts/validate_preference_jsonl.py— validate preference JSONL rows and reject missing/empty fields or degeneratechosen == rejectedpairs.scripts/validate_rl_prompts_jsonl.py— validate prompt/gold JSONL rows, numeric/null gold policy, and optional arithmetic-curriculum consistency.
Routing Boundaries
- Base model training, DDP/bf16 pretraining, memory flags, checkpointing, and
resume behavior ->
../model-pretraining/SKILL.md. - SFT, reward model, DPO/ORPO/KTO, PPO, GRPO, rollout, KL, and optimizer logic ->
../post-training-rlhf/SKILL.md. - GSM8K scoring, answer parsing during evaluation, stage tables, generation, and
chat ->
../evaluation-chat/SKILL.md. - JSON config editing, CLI override precedence, smoke configs, and Streamlit UI ->
../configuration-ui/SKILL.md.
Operating Checklist
- Ask which downstream stage the data will feed and record the intended context length, data directory, cache policy, and whether network access is available.
- Pick the matching dataset shape from this router; do not mix HDF5 pretraining tokens, packed SFT rows, preference pairs, and RL prompts.
- If generating public data, use the distilled command recipe in
references/workflows.md, starting with a tiny limit when practical. - Validate the resulting file with the bundled script for that shape.
- If validation fails, stop before training and use
references/troubleshooting.mdto identify whether the fix is regeneration, path creation, cache/network repair, context length change, or schema cleanup.
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).