training
Routes GPT2-Chinese corpus preprocessing, model training, checkpointing, and perplexity evaluation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Routes GPT2-Chinese corpus preprocessing, model training, checkpointing, and perplexity evaluation.
- disable-model-invocation
- true
02 资源文件 1
- 参考文档references/troubleshooting.md2.3 KB
03 SKILL.md 正文
Training
Use this sub-skill when the task is about training, fine-tuning, checkpointing, or perplexity evaluation in GPT2-Chinese.
Read first
../references/workflows.mdfor the end-to-end training and evaluation flow.../references/cli-reference.mdfor exact flags and defaults.../references/data-formats.mdfor the expected corpus and tokenized file shapes.../references/model-overview.mdwhen choosing a config file or vocabulary bundle.../references/troubleshooting.mdand this sub-skill's troubleshooting file for workflow-specific failures.../../scripts/check_install.pybefore the first training run.
What belongs here
- Raw corpus preprocessing with
--raw. train.pyfor the normal multi-article corpus path.train_single.pyfor one long source document or a single concatenated corpus.eval.pyfor perplexity estimation on a trained checkpoint.- Checkpoint loading and continuation with
--pretrained_model. - TensorBoard logging and training-schedule options such as
--gradient_accumulation,--log_step,--stride, and--fp16.
What does not belong here
- Prompted text generation belongs in
sub-skills/generation/SKILL.md. - Tokenizer selection, vocabulary rebuilding, or BPE setup belongs in
sub-skills/tokenization/SKILL.md. - Generic Transformers questions belong in the broader model ecosystem, not this repo skill.
How to route a training request
- Match the corpus shape first.
- JSON list of article strings: use
train.py. - One long document: use
train_single.py.
- JSON list of article strings: use
- Match the config and vocab.
- Use
config/model_config_test.jsonfor smoke checks. - Use
config/model_config_small.jsonpluscache/vocab_small.txtfor the usual compact run. - Keep
vocab_sizeand--tokenizer_pathaligned.
- Use
- Decide whether to preprocess in the same run.
--rawtokenizes and shards the corpus before training.- If shards already exist, skip
--raw.
- Decide whether you are resuming from a checkpoint.
- Pass
--pretrained_modelwhen you want to continue fromsave_pretrainedoutput.
- Pass
- Keep the schedule options consistent.
log_stepmust dividegradient_accumulation.fp16needs Apex and a matching CUDA stack.
- For evaluation, create the output directory first if you want a persisted score file.
Common decision points
- If the corpus is short and you only need a smoke check, use the test config and a tiny shard count.
- If you are training on a single long novel, prefer
train_single.pyover forcingtrain.pyto split the text. - If you need a perplexity number for a checkpoint, use
eval.pyafter the checkpoint is saved. - If the user is actually asking for generated samples, redirect to generation instead of training.
Output expectations
output_dir/model_epochN/after each epoch.output_dir/final_model/after the training loop completes.- TensorBoard logs under the writer directory if configured.
- Tokenized shards under
tokenized_data_pathwhen--rawis used.
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).