gpt2-chinese
Routes GPT2-Chinese training, generation, perplexity evaluation, and tokenizer or vocabulary workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- gpt2-chinese
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Routes GPT2-Chinese training, generation, perplexity evaluation, and tokenizer or vocabulary workflows.
- disable-model-invocation
- true
02 资源文件 9
- 参考文档references/api-reference.md2.8 KB
- 参考文档references/cli-reference.md4.3 KB
- 参考文档references/data-formats.md2.4 KB
- 参考文档references/model-overview.md2.2 KB
- 参考文档references/repo-provenance.md1.5 KB
- 参考文档references/repo-routing-metadata.json341 B
- 参考文档references/troubleshooting.md3.7 KB
- 参考文档references/workflows.md3.9 KB
- 脚本scripts/check_install.py6.5 KB
03 SKILL.md 正文
GPT2-Chinese
Use this repo skill when the task is about the GPT2-Chinese repository or its Chinese GPT-2 workflows.
Start here
- Read
references/repo-provenance.mdbefore deciding whether this skill matches the checkout you are using. - Read
references/workflows.mdfor the end-to-end training, evaluation, generation, and tokenizer flows. - Read
references/cli-reference.mdfor the exact CLI flags and default paths. - Read
references/model-overview.mdwhen choosing a config file or vocabulary bundle. - Run
scripts/check_install.pyafter installing dependencies or when imports look suspicious.
Install baseline
The repo is not packaged as a wheel. A typical working setup is:
- Install a compatible PyTorch build for your machine.
- Install the repo runtime dependencies from
requirements.txt. - Add
tensorboard,sentencepiece, andscikit-learnwhen they are missing. - Use the bundled smoke script to confirm the checkout can import and instantiate the tiny model.
See references/troubleshooting.md if train.py --help warns about missing optional packages, if generate.py cannot find a model directory, or if the word-level tokenizer cannot locate its dictionary.
Routing
Training and perplexity
Read sub-skills/training/SKILL.md when the user wants to:
- train from
train.jsonor another JSON-list corpus - use
--rawpreprocessing or the single-corpus training path - resume from a checkpoint
- evaluate perplexity with
eval.py - reason about
output_dir,tokenized_data_path,log_step,gradient_accumulation, orfp16
Generation
Read sub-skills/generation/SKILL.md when the user wants to:
- generate text from a checkpoint
- compare
generate.pyandgenerate_texts.py - choose
prefix,topk,topp,temperature, orfast_pattern - save samples to files or diagnose repeated or hanging generation
Tokenizers and vocabulary
Read sub-skills/tokenization/SKILL.md when the user wants to:
- choose between char/BERT, word-level, or BPE tokenization
- build or replace a vocabulary file
- understand
cache/vocab_*.txt,tokenizations/*.py, or the legacy vocabulary builder - fix path-sensitive tokenizer or dictionary issues
How to use the sub-skills
- Start with the narrowest sub-skill that matches the user request.
- If a request spans training plus generation, read the training sub-skill first and then the generation sub-skill.
- If the request includes vocabulary generation or tokenizer selection, read the tokenization sub-skill before training or generation so the config and vocabulary stay aligned.
- Use the bundled helper scripts rather than source-checkout paths when a workflow can be checked locally.
- Keep generated outputs inside the current checkout or the user-specified artifact area; do not put review or test artifacts inside this skill directory.
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).