xlnet
Operate the legacy TensorFlow 1.x XLNet repository for model APIs, classification, SQuAD, RACE, and pretraining workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- xlnet
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate the legacy TensorFlow 1.x XLNet repository for model APIs, classification, SQuAD, RACE, and pretraining workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/model-overview.md3.7 KB
- 参考文档references/repo-provenance.md2.5 KB
- 参考文档references/repo-routing-metadata.json534 B
- 参考文档references/troubleshooting.md5.1 KB
- 脚本scripts/check_xlnet_environment.py4.8 KB
03 SKILL.md 正文
XLNet repo skill
Use this skill when a Researcher task involves the original zihangdai/xlnet TensorFlow 1.x repository: released XLNet checkpoints, xlnet_config.json, spiece.model, source-script fine-tuning, SQuAD/RACE workflows, pretraining data, or direct XLNet graph APIs.
Before you act
- Confirm the caller wants the original TensorFlow 1.x XLNet code, not modern Hugging Face
transformers.XLNet*APIs. - Collect the model bundle paths:
xlnet_config.json,spiece.model, and, for training, the TensorFlow checkpoint prefix. - Identify the workflow family and route to the focused sub-skill below.
- Run
scripts/check_xlnet_environment.py --helpwhen you need a safe import/config diagnostic. It does not download data, open checkpoints, or launch training. - Read references/model-overview.md for released model artifacts, memory anchors, and hardware expectations.
- Read references/troubleshooting.md for cross-cutting TensorFlow 1.x, protobuf, Abseil flag, checkpoint, and backend failures.
- Read references/repo-provenance.md before deciding whether this skill is stale for a checkout.
Runtime prerequisites
- Legacy TensorFlow 1.x runtime. TensorFlow 2.x lacks several
tf.contribAPIs used by the repository. sentencepiece,numpy, and task-specific metric packages such asscipy/scikit-learnfor RACE metrics.- An XLNet source checkout or runtime where source modules such as
xlnet,modeling,run_classifier,run_squad, andrun_raceare importable. - Released or fine-tuned model artifacts supplied by the user; this skill does not bundle checkpoints, tokenizer models, or datasets.
- GPU/TPU hardware only when the selected workflow requires actual training or large evaluation. Many checks and command builders are CPU-safe.
Minimal diagnostic from a runtime where XLNet source is importable:
python scripts/check_xlnet_environment.py --repo-root /path/to/xlnet --config /path/to/xlnet_config.json
If no checkout path is needed because the modules are already importable, omit --repo-root.
Route map
| User task | Read next | Why |
|---|---|---|
Use XLNetConfig, RunConfig, XLNetModel, tokenizer helpers, losses, checkpoint loading, or custom TensorFlow graph code. |
sub-skills/model-api/SKILL.md | Covers verified signatures, tensor shapes, config validation, and runtime helpers. |
Fine-tune/evaluate/predict GLUE MNLI, STS-B, IMDB, Yelp-5, or processor-backed classification/regression through run_classifier.py. |
sub-skills/classification/SKILL.md | Covers task names, data layouts, train/eval/predict flags, and command generation. |
| Preprocess or fine-tune SQuAD 1.1/2.0, generate predictions, decode n-best answers, or handle no-answer thresholds. | sub-skills/squad-qa/SKILL.md | Covers SQuAD JSON, feature caches, GPU/TPU recipes, prediction outputs, and threshold metrics. |
| Run RACE multiple-choice reading-comprehension training/evaluation or adapt TPU RACE recipes. | sub-skills/race-reading-comprehension/SKILL.md | Covers RACE directory layout, high/middle filtering, four-candidate batching, and TPU command templates. |
Prepare raw text or token-id corpora for pretraining, generate TFRecords, or build train_gpu.py/train.py pretraining commands. |
sub-skills/data-pretraining/SKILL.md | Covers corpus format, SentencePiece assumptions, record_info files, and pretraining command builders. |
Operating guardrails
- Do not import several task scripts in the same long-lived Python process; their Abseil flags collide. Inspect one CLI module per process.
- Keep
data_dir,output_dir,model_dir,predict_dir, andinit_checkpointconceptually separate. - Treat
output_diras a cache. Use a new cache or overwrite flag when sequence length, task data, tokenizer, or split changes. - For multi-GPU task fine-tuning,
num_core_per_hostmeans number of GPUs andtrain_batch_sizeis per GPU. - Prefer command-builder scripts in the sub-skills when assembling long commands. They print commands only and avoid accidental training, downloads, or GCS writes.
- Do not treat README result numbers as proof for a new run. They are context anchors; real results require matching data, checkpoints, hardware, and training time.
Bundled root files
- references/model-overview.md: released models, artifact contracts, memory table, and result anchors.
- references/troubleshooting.md: shared runtime, artifact, and backend troubleshooting.
- references/repo-provenance.md: source snapshot and refresh baseline.
- references/repo-routing-metadata.json: structured metadata for a future managed repo-skill import.
- scripts/check_xlnet_environment.py: safe runtime/config diagnostic helper.
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).