AGENT SKILL

fine-tuning

Route supervised fine-tuning, DeepSpeed, LoRA, data preprocessing, and post-training loading for Baichuan2-7B-Base.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
fine-tuning
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Route supervised fine-tuning, DeepSpeed, LoRA, data preprocessing, and post-training loading for Baichuan2-7B-Base.
disable-model-invocation
true

02 资源文件 7

03 SKILL.md 正文

Baichuan2 Fine-Tuning

Use this sub-skill when the task is to prepare, explain, validate, or launch supervised fine-tuning for Baichuan2-7B-Base. It covers the training data format, the bundled supervised trainer, DeepSpeed ZeRO-3 launch structure, multi-machine hostfiles, LoRA toggling, and how to load the saved fine-tuned result.

Do not use this sub-skill for inference demos, chat APIs, quantized loading, or CPU deployment. Route those tasks to the appropriate inference or deployment guidance instead.

Read first

Bundled helpers

  • scripts/validate_training_data.py: validates Belle-style multi-turn JSON, can write a tiny fixture, and can optionally estimate token truncation with a Baichuan tokenizer.
  • scripts/train_supervised.py: self-contained supervised trainer adapted for Baichuan2-7B-Base with schema validation, dry-run mode, DeepSpeed config generation, and LoRA options.

Routing checklist

  1. Confirm the user is fine-tuning a Base checkpoint, normally baichuan-inc/Baichuan2-7B-Base, not asking for inference or quantized deployment.
  2. Validate the JSON data before launching any distributed job.
  3. Decide full-parameter versus LoRA fine-tuning. Use LoRA when VRAM or wall-clock budget is limited, and keep target_modules=W_pack unless the model architecture has been intentionally changed.
  4. Create or verify a DeepSpeed ZeRO-3 config and match it with the Hugging Face TrainingArguments flags.
  5. For one machine, use an empty or omitted hostfile. For multiple machines, prepare a DeepSpeed hostfile with one hostname slots=N line per node.
  6. After training, load a full fine-tuned output with AutoModelForCausalLM.from_pretrained(...); load LoRA adapter output with peft.AutoPeftModelForCausalLM.from_pretrained(...).

Safe default posture

Before launching training, prefer:

python scripts/validate_training_data.py \
  --data_path /path/to/train.json \
  --model_max_length 512

python scripts/train_supervised.py \
  --dry_run True \
  --data_path /path/to/train.json \
  --model_name_or_path baichuan-inc/Baichuan2-7B-Base \
  --output_dir /path/to/output \
  --model_max_length 512

Only move from dry-run validation to DeepSpeed training when dependencies, CUDA visibility, hostfile formatting, and data schema all pass.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351