data-preparation
Validate and prepare XTuner SFT, MLLM, pretraining, and RL JSONL data, tokenizer/chat-template configuration, caching, packing, and local conversion workflows.
- 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
- Validate and prepare XTuner SFT, MLLM, pretraining, and RL JSONL data, tokenizer/chat-template configuration, caching, packing, and local conversion workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md6.6 KB
- 参考文档references/tokenization-and-packing.md6.7 KB
- 参考文档references/troubleshooting.md5.0 KB
- 脚本scripts/convert_gsm8k_jsonl.py10.7 KB
- 脚本scripts/validate_xtuner_jsonl.py17.5 KB
03 SKILL.md 正文
XTuner data-preparation operating skill
Use this sub-skill when the task is about XTuner V1 dataset records, JSONL validation, tokenizer/chat-template selection, dataset caching, packing, or safe local data conversion before training.
Route here
- Validate OpenAI-style SFT JSONL, including bare message-list lines and object lines with
messagesordialogs. - Validate multimodal SFT/pretraining JSONL with image/video references,
media_root, andclass_name="VLMJsonlDataset". - Validate RL/GSM8K-style reward JSONL with
prompt,data_source, andreward_model.ground_truth. - Choose or document
DatasetConfig,DataloaderConfig,OpenaiTokenizeFunctionConfig, andFTDPTokenizeFnConfigfields. - Explain dataset cache behavior (
cache_dir,cache_tag) and packing choices (pack_level, preset pack/sampler files). - Convert local GSM8K
question/answerfiles into XTuner RL JSONL without network access.
Route elsewhere
- Training launch commands, torchrun resources, FSDP/checkpoint/resume, and training logs belong to the training sub-skill.
- RL trainer, rollout, Ray, judger service, advantage, replay buffer, and inference-backend configuration belong to the reinforcement-learning sub-skill.
- Model family, tokenizer/model path validity, dense/MoE/VLM backend, attention, FP8, or optional accelerator choices belong to the model-backends sub-skill.
- Legacy preprocess CLI usage belongs to the cli-and-tools sub-skill unless only schema context is needed here.
Start with the safe local helpers
python ./scripts/validate_xtuner_jsonl.py ./data/openai_sft.jsonl --mode sft
python ./scripts/validate_xtuner_jsonl.py ./data/mllm.jsonl --mode mllm --media-root ./media
python ./scripts/convert_gsm8k_jsonl.py --input-dir ./gsm8k_raw --out-dir ./gsm8k_xtuner
python ./scripts/validate_xtuner_jsonl.py ./gsm8k_xtuner/train.jsonl --mode rl
The bundled scripts use only the Python standard library. They do not import XTuner, a tokenizer, PyTorch, image libraries, or any original repository checkout.
References to load
references/data-formats.md: SFT, MLLM, pretraining, RL/GSM8K JSONL schemas and config snippets.references/tokenization-and-packing.md: chat templates, tokenization configs, cache invalidation, and packing/sampler options.references/troubleshooting.md: failure signatures and fixes for JSONL, media, truncation, cache, preset packing, and RL reward fields.
Operating rules
- Validate JSONL before proposing a training launch.
- For multimodal data, always resolve local image/video references with an explicit
media_rootand fail fast on missing files. - Treat the validator's
--max-lengthoutput as an approximation only; real truncation depends on the selected tokenizer and chat template. - When
pack_level="preset", ensure bothpack_config_pathandsampler_config_pathare set before handing off to training. - For RL data,
reward_model.ground_truthis required for GSM8K-style rule reward; do not hand off RL data with missing or empty ground truth.
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).