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.
