train-and-merge
Routes Chinese-LLaMA-Alpaca-2 dataset prep, training, and LoRA merge workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- train-and-merge
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Routes Chinese-LLaMA-Alpaca-2 dataset prep, training, and LoRA merge workflows.
- disable-model-invocation
- true
02 资源文件 22
- 参考文档references/troubleshooting.md1.4 KB
- 参考文档references/workflows.md2.2 KB
- 脚本scripts/merge_llama2_with_chinese_lora_low_mem.py15.0 KB
- 脚本scripts/training/build_dataset.py3.9 KB
- 脚本scripts/training/ds_zero2_no_offload.json686 B
- 脚本scripts/training/peft/__init__.py1.6 KB
- 脚本scripts/training/peft/mapping.py5.5 KB
- 脚本scripts/training/peft/peft_model.py42.7 KB
- 脚本scripts/training/peft/tuners/__init__.py1.0 KB
- 脚本scripts/training/peft/tuners/lora.py32.6 KB
- 脚本scripts/training/peft/tuners/p_tuning.py6.5 KB
- 脚本scripts/training/peft/tuners/prefix_tuning.py3.6 KB
- 脚本scripts/training/peft/tuners/prompt_tuning.py4.7 KB
- 脚本scripts/training/peft/utils/__init__.py1.2 KB
- 脚本scripts/training/peft/utils/adapters_utils.py730 B
- 脚本scripts/training/peft/utils/config.py6.4 KB
- 脚本scripts/training/peft/utils/other.py3.7 KB
- 脚本scripts/training/peft/utils/save_and_load.py3.2 KB
- 脚本scripts/training/run_clm_pt_with_peft.py31.8 KB
- 脚本scripts/training/run_clm_sft_with_peft.py21.1 KB
- 脚本scripts/training/run_pt.sh1.9 KB
- 脚本scripts/training/run_sft.sh2.1 KB
03 SKILL.md 正文
train-and-merge
Use this sub-skill for any workflow that prepares training data, runs pretraining or supervised fine-tuning, or merges LoRA adapters back into a full model.
Use it when
- the user mentions
build_dataset.py,run_clm_pt_with_peft.py,run_clm_sft_with_peft.py,run_pt.sh, orrun_sft.sh - the task is about JSON instruction data with
instruction,input, andoutputfields - the user needs DeepSpeed stage-2 configuration or PEFT/LoRA launch flags
- the task is merging Chinese-LLaMA/Alpaca LoRA weights into HF or PTH outputs
Workflow
- Read
references/workflows.mdfor the accepted data schema and training flag map. - Check that the command is being run from
scripts/training/so the bundled vendoredpeft/package is importable. - Validate the dataset or model-path assumptions before starting any expensive job.
- Use the shell launchers for a quick example of the expected DeepSpeed and LoRA arguments.
- Read
references/troubleshooting.mdif the run fails on imports, dataset layout, or adapter merging.
Bundled runtime files
scripts/training/build_dataset.pyscripts/training/run_clm_pt_with_peft.pyscripts/training/run_clm_sft_with_peft.pyscripts/training/run_pt.shscripts/training/run_sft.shscripts/training/ds_zero2_no_offload.jsonscripts/training/peft/scripts/training/build_dataset.pyalso supplies the collator and dataset cache logic used by SFTscripts/merge_llama2_with_chinese_lora_low_mem.pyfor LoRA merge/export when a full checkpoint is needed
What to read first
references/workflows.mdfor the training data layout and command familyreferences/troubleshooting.mdfor localpeft, DeepSpeed, bitsandbytes, and dataset errors
Routing notes
- Use this sub-skill before the inference sub-skill when a task needs a freshly trained or merged checkpoint.
- The fine-tuning scripts are intentionally adapter-heavy; do not replace them with a generic Hugging Face recipe unless the user explicitly asks for a rewrite.
- The vendored
peft/package is part of this sub-skill's runtime surface, not a separate external repository.
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).