nlg-gpt2-adaptation
Prepare, train, decode, and evaluate the LoRA GPT-2 data-to-text workflows for E2E, WebNLG, and DART-style datasets.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- nlg-gpt2-adaptation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Prepare, train, decode, and evaluate the LoRA GPT-2 data-to-text workflows for E2E, WebNLG, and DART-style datasets.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md1.9 KB
- 参考文档references/gpt2-lora-workflows.md2.6 KB
- 参考文档references/troubleshooting.md2.0 KB
- 脚本scripts/build_gpt2_lora_command.py6.2 KB
- 脚本scripts/validate_nlg_jsonl.py3.5 KB
03 SKILL.md 正文
NLG GPT-2 adaptation
Use this sub-skill for the repository's GPT-2 data-to-text path: raw dataset conversion, GPT-2 tokenization, LoRA fine-tuning, beam search, decoding, and metric-file preparation.
Route here
- Build a consistent train/beam/decode command set for E2E, WebNLG, or DART.
- Explain why the GPT-2 attention uses
MergedLinearwith Q/V-only LoRA. - Validate context/completion or prediction JSONL before a long run.
- Diagnose missing vocab/checkpoints, reference-count mismatches, or external evaluation-tool failures.
Start fast
- Obtain a compatible GPT-2 vocabulary and base checkpoint. Do not start a long run until the files exist and a tiny JSONL fixture validates.
- Convert raw data to records with
contextandcompletion, then encode each record into integer-token JSONL with optional BOS/EOS markers. - Train with
--lora_dim > 0,--lora_alpha, and optionally--lora_dropout. The repository trains only LoRA parameters after callingmark_only_lora_as_trainable. - Generate with the same model card, LoRA rank/alpha, base checkpoint, and output directory. Keep beam, length penalty, no-repeat n-gram, repetition, and EOS settings explicit.
- Decode predictions against the original formatted input; then validate the reference/hypothesis layout before invoking external metrics.
Use the command builder to print a consistent three-stage plan:
python scripts/build_gpt2_lora_command.py --dataset e2e --work-dir ./gpt2-e2e
Validate small fixtures without importing the training code:
python scripts/validate_nlg_jsonl.py --kind text --input-file sample.jsonl
Model integration
The archived GPT-2 model puts LoRA in c_attn, a fused QKV projection, with
enable_lora=[True, False, True]. That adapts Q and V, leaves K unchanged, and
uses merge_weights=False. The configuration names are lora_attn_dim,
lora_attn_alpha, and lora_dropout; the training CLI exposes them as
--lora_dim, --lora_alpha, and --lora_dropout.
Reroute
- Standalone layer and checkpoint helper behavior: use
../core-lora-api/SKILL.md. - RoBERTa/DeBERTa GLUE workflows: use
../nlu-glue-adaptation/SKILL.md.
References
- Read GPT-2 workflows for the ordered train/generate/decode/evaluate pipeline and command fields.
- Read data formats before converting or decoding a dataset.
- Read troubleshooting before downloading checkpoints, changing tokenization, or interpreting metric failures.
Common request patterns
Use this sub-skill when the user asks to:
- create or repair the E2E/WebNLG/DART conversion pipeline;
- verify that a GPT-2 LoRA command uses the right model card, rank, alpha, and work directory;
- understand how the training and beam-search steps share the same adapter settings;
- validate a decoded JSONL file before metric evaluation; or
- diagnose why reference counts or prediction ids do not line up.
Exit checklist
Before returning, confirm the answer states:
- the dataset family and corresponding reference count;
- the adapter rank and alpha used in both train and beam stages;
- which files are formatted text, tokenized training JSONL, prediction JSONL, and evaluation references;
- whether external evaluation tools are required; and
- which validation step should run before a long training or beam-search job.
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).