ChatGLM2-6B P-Tuning and Fine-Tuning
Use this route when the task involves P-Tuning v2, chat fine-tuning data,
ADGEN-style data, bundled P-Tuning runner arguments, prefix checkpoint loading,
prediction, or optional full-parameter DeepSpeed fine-tuning. Use
chat-and-demos for ordinary base-model chat and
api-serving when a prepared model should be served.
Safe workflow
- Validate data before launching
torchrun:
python sub-skills/ptuning/scripts/validate_ptuning_data.py --file train.json --format chat --history-column history.
- Build a command string without executing it from the generated skill root:
python sub-skills/ptuning/scripts/build_ptuning_command.py train --train-file train.json --validation-file dev.json --output-dir output/run.
- Confirm model weights/cache, CUDA availability, and the intended checkpoint
type. P-Tuning v2 saves a prefix encoder, not a full model; full fine-tuning
checkpoints load differently.
- Run expensive training/evaluation only after checking data columns,
pre_seq_len, quantization, GPU memory, and output paths.
Read data-formats.md for ADGEN/chat schemas,
command-templates.md for launch patterns,
checkpoint-workflows.md for prefix vs
full checkpoints, and troubleshooting.md for
schema, OOM, DeepSpeed, quantization, and Gradio issues.
Boundaries
This sub-skill distills the repository's P-Tuning scripts into bundled
references, validators, command builders, and a bundled runner under
scripts/ptuning_runner/. It does not train or evaluate as a smoke test, does
not download ADGEN/model weights, and does not make DeepSpeed a required
dependency. Full training, prediction, and web demo launch are GPU/model/data
dependent and should be treated as deliberate runtime actions, not verification
shortcuts.
1---2name: ptuning3description: "Guides ChatGLM2-6B P-Tuning v2, chat fine-tuning data, prediction4 commands, prefix/full checkpoint loading, and optional DeepSpeed fine-tuning."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/ptuning8 disco-role: operating9license: NOASSERTION10---1112# ChatGLM2-6B P-Tuning and Fine-Tuning1314Use this route when the task involves P-Tuning v2, chat fine-tuning data,15ADGEN-style data, bundled P-Tuning runner arguments, prefix checkpoint loading,16prediction, or optional full-parameter DeepSpeed fine-tuning. Use17[`chat-and-demos`](../chat-and-demos/SKILL.md) for ordinary base-model chat and18[`api-serving`](../api-serving/SKILL.md) when a prepared model should be served.1920## Safe workflow21221. Validate data before launching `torchrun`:23 `python sub-skills/ptuning/scripts/validate_ptuning_data.py --file train.json --format chat --history-column history`.242. Build a command string without executing it from the generated skill root:25 `python sub-skills/ptuning/scripts/build_ptuning_command.py train --train-file train.json --validation-file dev.json --output-dir output/run`.263. Confirm model weights/cache, CUDA availability, and the intended checkpoint27 type. P-Tuning v2 saves a prefix encoder, not a full model; full fine-tuning28 checkpoints load differently.294. Run expensive training/evaluation only after checking data columns,30 `pre_seq_len`, quantization, GPU memory, and output paths.3132Read [`data-formats.md`](references/data-formats.md) for ADGEN/chat schemas,33[`command-templates.md`](references/command-templates.md) for launch patterns,34[`checkpoint-workflows.md`](references/checkpoint-workflows.md) for prefix vs35full checkpoints, and [`troubleshooting.md`](references/troubleshooting.md) for36schema, OOM, DeepSpeed, quantization, and Gradio issues.3738## Boundaries3940This sub-skill distills the repository's P-Tuning scripts into bundled41references, validators, command builders, and a bundled runner under42`scripts/ptuning_runner/`. It does not train or evaluate as a smoke test, does43not download ADGEN/model weights, and does not make DeepSpeed a required44dependency. Full training, prediction, and web demo launch are GPU/model/data45dependent and should be treated as deliberate runtime actions, not verification46shortcuts.