data-preparation
Prepare and validate OpenRLHF datasets for SFT, reward modeling, DPO, PPO/RL prompts, chat-template use, dataset mixing, packing-sensitive length checks, and VLM image placeholders before expensive training.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-preparation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Prepare and validate OpenRLHF datasets for SFT, reward modeling, DPO, PPO/RL prompts, chat-template use, dataset mixing, packing-sensitive length checks, and VLM image placeholders before expensive training.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/data-formats.md7.8 KB
- 参考文档references/troubleshooting.md4.5 KB
- 参考文档references/validation.md4.2 KB
- 脚本scripts/validate_openrlhf_dataset.py15.8 KB
03 SKILL.md 正文
OpenRLHF Data Preparation
Use this sub-skill when the task is about dataset schemas, key mapping, chat-template choices, prompt/reward/preference records, tiny dry-run validation, or VLM image placeholder alignment for OpenRLHF.
Route by Training Mode
- SFT: prepare prompt/response or multiturn chat records; see
references/data-formats.md#sft-recordsand validate withscripts/validate_openrlhf_dataset.py --mode sft. - Reward model: prepare chosen/rejected pairs, optional prompt prefixes, and optional margin values; see
references/data-formats.md#reward-model-recordsand validate with--mode rm. - DPO: prepare chosen/rejected preferences with optional shared prompt; see
references/data-formats.md#dpo-recordsand validate with--mode dpo. - PPO/RL prompts: prepare prompt-only records with optional labels and datasource fields; see
references/data-formats.md#ppo-and-rl-prompt-recordsand validate with--mode ppo. - VLM prompts: verify
<image>placeholders line up with the configured image key before Ray/vLLM training; seereferences/data-formats.md#vlm-image-promptsandreferences/troubleshooting.md#multimodal-image-mismatches.
Core Decisions
- Match CLI key flags (
--data.input_key,--data.output_key,--data.prompt_key,--data.chosen_key,--data.rejected_key,--data.label_key,--data.image_key) to the actual record fields before launching training. - Choose exactly one prompt formatting path: use
--data.apply_chat_templatefor chat-message lists, or--data.input_templatefor plain string prompts. - For SFT multiturn data, enable
--data.multiturnonly with--data.apply_chat_template, and put the full trajectory under--data.input_keyrather than splitting assistant turns into--data.output_key. - For mixed datasets, keep comma-separated
--data.datasetand--data.dataset_probscounts aligned; probabilities are parsed as floats and must match the dataset count. - Treat
--data.max_len, prompt length, packing, ring attention, and VLM image counts as preflight risks; seereferences/validation.mdbefore running expensive GPU jobs.
Safe Local Validator
Run the bundled validator on tiny local JSON or JSONL samples without importing OpenRLHF, Ray, torch, datasets, or transformers:
python skills/openrlhf/sub-skills/data-preparation/scripts/validate_openrlhf_dataset.py \
--mode sft \
--input sample.jsonl \
--input-key question \
--output-key response \
--max-samples 20
The validator checks required keys, null/empty values, chat-message shape, chosen/rejected confusion, dataset probability counts, rough length limits, and VLM placeholder/image alignment. It is a schema preflight, not a tokenizer-accurate training simulation.
Boundaries
- For full SFT/RM/DPO training command construction, hand off to
supervised-preference-trainingafter data validates. - For PPO/Ray/vLLM rollout setup, agent functions, or reward services, hand off to
rl-agent-trainingafter prompt data validates. - For installation, CUDA, flash-attn, Ray, vLLM, DeepSpeed, checkpoint, and environment issues, hand off to
operations-and-utilities.
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).