classification
Construct and adapt XLNet run_classifier.py classification and regression workflows for processor-backed tasks.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- classification
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Construct and adapt XLNet run_classifier.py classification and regression workflows for processor-backed tasks.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/cli-reference.md7.9 KB
- 参考文档references/data-formats.md6.0 KB
- 参考文档references/troubleshooting.md7.2 KB
- 参考文档references/workflows.md8.6 KB
- 脚本scripts/build_classifier_command.py18.6 KB
03 SKILL.md 正文
XLNet classification/regression sub-skill
Use this sub-skill when the task is to fine-tune, evaluate, or generate predictions with XLNet's processor-backed run_classifier.py workflow.
Best-fit tasks
- GLUE MNLI matched and mismatched classification with
task_name=mnli_matchedortask_name=mnli_mismatched. - GLUE STS-B sentence-pair regression with
task_name=sts-band--is_regression=True. - IMDB binary sentiment classification with
task_name=imdb. - Yelp-5 review classification with
task_name=yelp5. - Similar classification/regression jobs after reshaping data to one of the supported processor layouts or adding a new processor in the caller's working copy.
Route elsewhere
- SQuAD span question answering belongs in
../squad-qa/. - RACE multiple-choice reading comprehension belongs in
../race-reading-comprehension/. - Direct XLNet graph/model API work, new losses, custom classifier heads, tokenizer internals, or checkpoint surgery belongs in
../model-api/.
Operating procedure
-
Identify the task processor and raw data layout in references/data-formats.md. Do not assume arbitrary TSV columns are configurable: the built-in processors hard-code filenames, columns, and labels.
-
Separate the runtime paths before generating a command:
data_dir: raw GLUE/IMDB/Yelp data.output_dir: generated TFRecord cache.model_dir: fine-tuned checkpoints and TensorFlow event files.init_checkpoint: released or already fine-tuned checkpoint used only to initialize variables, normally during training.predict_dir: prediction TSV/logit JSON destination for--do_predict=True.
-
Use the bundled safe command generator, not a source notebook or shell snippet, to produce a command template:
python scripts/build_classifier_command.py --helpThe generator prints a
python run_classifier.py ...command and never downloads data, launches training, or opens checkpoints. -
Apply the task-specific workflow guidance in references/workflows.md. For STS-B, keep regression mode enabled in every train/eval/predict command.
-
Check CLI semantics in references/cli-reference.md, especially GPU/TPU flags, per-GPU
train_batch_size,eval_all_ckpt, and prediction outputs. -
Before running an expensive job, review references/troubleshooting.md for stale TFRecord caches, missing model artifacts, bad dataset layout, GPU memory limits, TPU/GCS path mismatches, and multi-GPU eval pitfalls.
High-signal guardrails
- Supported
task_namevalues in this sub-skill are exactlymnli_matched,mnli_mismatched,sts-b,imdb, andyelp5. sts-bis regression. Always pass--is_regression=True; evaluation sorts byeval_pearsonrinstead ofeval_accuracy.- Multi-GPU training uses TensorFlow
MirroredStrategy; in this codebase,train_batch_sizeis per GPU, not global. - Evaluate on one GPU unless the caller has intentionally audited sharding. The original workflow separates multi-GPU training from single-GPU evaluation to avoid incorrect metrics.
- Keep
model_dirseparate from the pretrainedinit_checkpointdirectory. Eval-all-checkpoints should scan fine-tuned checkpoints inmodel_dir, not the released model directory. output_diris a preprocessing cache. Change it or pass--overwrite_data=Truewhen changing task data, sequence length, SentencePiece model, or regression/classification mode.
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).