finetuning
Guide InternLM-XComposer supervised finetuning, data manifests, runnable launchers, DeepSpeed configs, LoRA settings, and adapter merge.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- finetuning
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guide InternLM-XComposer supervised finetuning, data manifests, runnable launchers, DeepSpeed configs, LoRA settings, and adapter merge.
- disable-model-invocation
- true
02 资源文件 23
- 脚本entrypoints/xcomposer25/data_mix.py6.4 KB
- 参考文档entrypoints/xcomposer25/data.txt128 B
- 资产文件entrypoints/xcomposer25/data/images/Bk1Ghbw1SynAoDP7VS3B_1.jpg15.5 KB
- 资产文件entrypoints/xcomposer25/data/images/Bk1GhqA1RhyCKaOWwxKT_1.jpg22.3 KB
- 资产文件entrypoints/xcomposer25/data/images/Bk1GhQQ1RR_Cj8wVTPjD_1.jpg23.5 KB
- 资产文件entrypoints/xcomposer25/data/images/Bk1GhXY06hYCpDhD8y9l_1.jpg17.4 KB
- 资产文件entrypoints/xcomposer25/data/images/panda.jpeg5.2 KB
- 参考文档entrypoints/xcomposer25/data/multi_turn_multi_images_example.json26.6 KB
- 参考文档entrypoints/xcomposer25/data/only_text_example.json4.5 KB
- 参考文档entrypoints/xcomposer25/data/single_turn_single_image_example.json3.8 KB
- 参考文档entrypoints/xcomposer25/ds_config_zero2.json832 B
- 脚本entrypoints/xcomposer25/finetune.py9.6 KB
- 脚本entrypoints/xcomposer25/ixc_utils.py1.3 KB
- 脚本entrypoints/xcomposer25/launch_full.sh1.7 KB
- 脚本entrypoints/xcomposer25/launch_lora.sh2.0 KB
- 脚本entrypoints/xcomposer25/merge_peft_adapter.py2.3 KB
- 参考文档entrypoints/xcomposer25/README.md1.8 KB
- 参考文档references/data-formats.md5.2 KB
- 参考文档references/training-arguments.md5.6 KB
- 参考文档references/troubleshooting.md6.6 KB
- 参考文档references/workflows.md7.5 KB
- 脚本scripts/render_finetune_command.py15.3 KB
- 脚本scripts/validate_finetune_data.py15.9 KB
03 SKILL.md 正文
Finetuning Sub-skill
Use this sub-skill for supervised finetuning of InternLM-XComposer family models, especially the 2.5 training path. It covers:
data.jsonanddata.txtpreparation for text-only, single-image, and multi-image samples;- 2.5 placeholder rules, plus legacy 1.0/2.0 compatibility notes;
- torchrun + DeepSpeed templates and manual FSDP planning on the same
finetune.pyentrypoint; - full-parameter and LoRA training arguments;
- PEFT adapter loading and
merge_peft_adapter.pymerge planning; - the file-level data-mixing behavior used by the loader.
Route non-training tasks to sibling sub-skills:
- inference, Gradio, LMDeploy, and composition:
model-inference; - reward scoring or preference training:
reward-model; - benchmarks, converters, and related projects:
evaluation-and-projects; - OmniLive audio/video/service workflows:
omnilive.
Quick compatibility notes
- InternLM-XComposer 2.5 uses
conversationsin actual JSON examples and loader code. - 2.5 single-image samples do not require
<ImageHere>; multi-image samples should keep one<ImageHere>token per image, in order. - 2.0 finetuning examples require
<ImageHere>on image-bearing samples. - 1.0 legacy finetuning examples are placeholder-free in the published README guidance.
Operating checklist
- Identify the target family: 2.5 default, or 2.0 / 1.0 compatibility guidance.
- Validate the manifest with
scripts/validate_finetune_data.py. - Render a safe command with
scripts/render_finetune_command.pywhen planning only. - For approved execution, use the bundled runnable training bundle in
entrypoints/xcomposer25/instead of relying on source checkout files. - If using LoRA, keep both training and
entrypoints/xcomposer25/merge_peft_adapter.pyaligned withreferences/workflows.md. - Review
references/troubleshooting.mdbefore changing batch size,hd_num,max_length, or backend flags.
Bundled references
references/data-formats.mdreferences/workflows.mdreferences/training-arguments.mdreferences/troubleshooting.md
Bundled scripts and entrypoints
Safe planners/validators:
scripts/validate_finetune_data.pyscripts/render_finetune_command.py
Runnable self-contained entrypoints:
entrypoints/xcomposer25/finetune.pyentrypoints/xcomposer25/data_mix.pyentrypoints/xcomposer25/ixc_utils.pyentrypoints/xcomposer25/ds_config_zero2.jsonentrypoints/xcomposer25/launch_full.shentrypoints/xcomposer25/launch_lora.shentrypoints/xcomposer25/merge_peft_adapter.pyentrypoints/xcomposer25/data.txtandentrypoints/xcomposer25/data/source-format fixtures
Read entrypoints/xcomposer25/README.md before running any entrypoint. These files are real training/merge entrypoints and will import torch/Transformers/DeepSpeed/PEFT, load checkpoints, and write outputs when executed.
Boundaries
- Do not start actual training, checkpoint download, or merge execution in Creator mode.
- Do not depend on the source checkout remaining available after the skill is drafted; use the bundled references and scripts instead.
- Keep launcher advice self-contained and edit-safe; let the user choose exact paths, GPUs, and ports.
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).