attention-is-all-you-need-pytorch
Use jadore801120 attention-is-all-you-need-pytorch for Transformer architecture inspection, preprocessing, training, and checkpoint translation workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- attention-is-all-you-need-pytorch
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use jadore801120 attention-is-all-you-need-pytorch for Transformer architecture inspection, preprocessing, training, and checkpoint translation workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/package-overview.md3.0 KB
- 参考文档references/repo-provenance.md1.7 KB
- 参考文档references/repo-routing-metadata.json587 B
- 参考文档references/troubleshooting.md2.0 KB
- 脚本scripts/check_environment.py3.6 KB
03 SKILL.md 正文
attention-is-all-you-need-pytorch
Use this repo skill when a task involves the PyTorch implementation of the
Transformer paper in jadore801120/attention-is-all-you-need-pytorch: model
internals, German-English preprocessing, training commands, or checkpoint
translation. The repository is script/source based rather than a packaged Python
distribution, so future users normally work from a checkout that contains
transformer/, preprocess.py, train.py, and translate.py.
Quick Setup And Smoke Check
Use a legacy-compatible Python environment with PyTorch, legacy torchtext APIs,
spaCy, dill, tqdm, and NumPy. The source expects torchtext.data.Field; modern
torchtext releases that removed this API will not work unchanged.
Minimal import check from a user's checkout:
python - <<'PY'
from transformer.Models import Transformer
from transformer.Translator import Translator
print(Transformer)
print(Translator)
PY
Run the bundled environment checker when diagnosing an existing checkout:
python scripts/check_environment.py --repo-root /path/to/attention-is-all-you-need-pytorch --device cpu
Route Map
- model-architecture: instantiate or
debug
Transformer, masks, positional encoding, attention layers, feed-forward blocks, weight sharing, tensor shapes, andScheduledOptim. - data-preparation: prepare or inspect Multi30k/spaCy and WMT+BPE data artifacts, pickle schemas, torchtext Fields, vocabularies, and BPE helper behavior.
- training: build and troubleshoot
train.pycommands, hyperparameters, scheduler/loss behavior, logs, checkpoints, TensorBoard, CPU/CUDA selection, and safe training preflights. - translation: validate checkpoints and data
pickles for
translate.py, run checkpoint translation, or usetransformer.Translatorbeam search programmatically.
Repo-Level References
- Read references/package-overview.md for the source layout, dependency expectations, workflow map, and known caveats.
- Read references/troubleshooting.md for cross-cutting install/import, torchtext, spaCy, CUDA, pickle, and stale README issues.
- Read references/repo-provenance.md before deciding whether this skill is current for a checkout or should be refreshed.
Decision Hints
- If the user asks about tensor dimensions, masks, weight sharing, or custom model construction, route to model-architecture before training or translation.
- If the user asks why training cannot read a pickle, route to data-preparation first, then training after the schema is identified.
- If the user asks about a
.chkptfile, route to translation for checkpoint inspection unless they are asking how the checkpoint was produced. - If the prompt mentions BPE, keep the repository caveat visible: BPE is marked
not fully tested and
translate.pyleaves BPE decoding as TODO. - If a README command fails with an unrecognized
-logflag, prefer the inspectedtrain.pyparser over the README example for this commit.
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).