training
Plan and troubleshoot XTuner V1 SFT, pretraining, and multimodal fine-tuning launches with CLI or Python configs, torchrun resources, FSDP, checkpoints, resume, profiling, and log interpretation.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Plan and troubleshoot XTuner V1 SFT, pretraining, and multimodal fine-tuning launches with CLI or Python configs, torchrun resources, FSDP, checkpoints, resume, profiling, and log interpretation.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md13.9 KB
- 参考文档references/troubleshooting.md10.5 KB
- 参考文档references/workflows.md12.9 KB
- 脚本scripts/build_sft_command.py17.4 KB
- 脚本scripts/summarize_xtuner_log.py14.8 KB
03 SKILL.md 正文
XTuner Training
Use this sub-skill when a task is about launching, configuring, or diagnosing XTuner V1 supervised fine-tuning, pretraining, or multimodal SFT. It is optimized for future agents that need to choose between direct SFT CLI arguments and Python config files, build torchrun commands safely, reason about TrainerConfig / TrainingArguments, and interpret XTuner training logs.
Route here when
- The user wants an XTuner V1 SFT or pretraining launch command.
- The user needs to decide between direct CLI arguments and
--config <python_config.py>. - The user is tuning
TrainerConfig,TrainingArguments, optimizer, LR scheduler, loss, FSDP, checkpoint, resume, profiling, or work directory settings. - The user has XTuner training logs and asks whether loss, throughput, memory, data loading, or checkpoint/resume behavior looks healthy.
- The user is fine-tuning a multimodal model and the question is about training orchestration rather than JSONL/media schema details.
Route elsewhere
- JSONL schema, media paths, tokenization functions, packing internals, dataset validation, and cache invalidation details belong to
data-preparation. - MoE routing, FP8 kernels, attention backends, GroupedGEMM/AdaptiveGEMM, tensor/expert parallel internals, and model-family selection belong to
model-backends. - GRPO, DAPO, Ray, rollout engines, reward functions, and RL trainer launches belong to
reinforcement-learning. - Legacy
xtuner train, config-zoo discovery, model conversion, chat, eval, and old tools belong tocli-and-tools.
Fast operating procedure
- Identify the launch mode. Direct CLI arguments are for simple SFT/pretraining-style runs where paths and a few knobs change. Python config files are required for MLLM examples, pretraining recipes, custom datasets/tokenizers, explicit resume/checkpoint paths, profiler hooks, or deeper
TrainerConfigcontrol. See references/workflows.md. - Validate mutually exclusive inputs. XTuner V1
sft.pyaccepts either--configor directTrainingArguments, not both. Mixing them raisesValueError: Cannot specify both \config` and `arguments`.` - Build commands with the bundled helper. Use scripts/build_sft_command.py to assemble a dry
torchrun -m xtuner.v1.train.cli.sft ...command without relying on any source checkout. - Check path assumptions before launch. Direct mode needs a dataset JSONL/file/dir/glob and either
--load-fromor--model-cfg. If--tokenizer-pathis omitted,--load-frommust resolve as a Hugging Face model snapshot directory or model id; a local snapshot should containconfig.json. - Choose resource knobs deliberately. Set
--nproc-per-node, node rank, master address/port, FSDPtp_size/ep_size, CPU offload, recompute ratio, and global batch size together. World size must be compatible with the parallel mesh. See references/api-reference.md. - Inspect logs early. XTuner step lines report
data_time,time, tokens, loss, memory,grad_norm, throughput (tgs,seqlen_tgs,exp_tgs), and ETA. Use scripts/summarize_xtuner_log.py for a quick run summary and warning triage. - Troubleshoot by symptom. For config/direct conflicts, missing HF snapshots, dataset glob misses, flash-attn fallback, bitsandbytes CUDA warnings, OOM, FSDP size mismatches, and resume/checkpoint problems, use references/troubleshooting.md.
Minimal examples
Build a direct Qwen3 SFT command for an OpenAI-format JSONL:
python sub-skills/training/scripts/build_sft_command.py \
--nproc-per-node 8 \
--load-from /models/Qwen3-8B/snapshots/<revision> \
--chat-template qwen3 \
--dataset /data/train.jsonl \
--total-step 100 \
--work-dir /runs/qwen3-sft
Summarize a work directory or torchrun log file:
python sub-skills/training/scripts/summarize_xtuner_log.py /runs/qwen3-sft
Keep commands, logs, and user-provided model/data paths in the user's environment. This skill tree does not require or link to an XTuner source checkout.
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).