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, and ScheduledOptim.
- 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.py
commands, 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 use
transformer.Translator beam 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
.chkpt file, 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.py leaves BPE decoding as TODO.
- If a README command fails with an unrecognized
-log flag, prefer the
inspected train.py parser over the README example for this commit.
1---2name: attention-is-all-you-need-pytorch3description: "Use jadore801120 attention-is-all-you-need-pytorch for Transformer4 architecture inspection, preprocessing, training, and checkpoint translation5 workflows."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/attention-is-all-you-need-pytorch9 disco-role: operating10license: MIT11---1213# attention-is-all-you-need-pytorch1415Use this repo skill when a task involves the PyTorch implementation of the16Transformer paper in `jadore801120/attention-is-all-you-need-pytorch`: model17internals, German-English preprocessing, training commands, or checkpoint18translation. The repository is script/source based rather than a packaged Python19distribution, so future users normally work from a checkout that contains20`transformer/`, `preprocess.py`, `train.py`, and `translate.py`.2122## Quick Setup And Smoke Check2324Use a legacy-compatible Python environment with PyTorch, legacy torchtext APIs,25spaCy, dill, tqdm, and NumPy. The source expects `torchtext.data.Field`; modern26torchtext releases that removed this API will not work unchanged.2728Minimal import check from a user's checkout:2930```bash31python - <<'PY'32from transformer.Models import Transformer33from transformer.Translator import Translator34print(Transformer)35print(Translator)36PY37```3839Run the bundled environment checker when diagnosing an existing checkout:4041```bash42python scripts/check_environment.py --repo-root /path/to/attention-is-all-you-need-pytorch --device cpu43```4445## Route Map4647- [model-architecture](sub-skills/model-architecture/SKILL.md): instantiate or48 debug `Transformer`, masks, positional encoding, attention layers,49 feed-forward blocks, weight sharing, tensor shapes, and `ScheduledOptim`.50- [data-preparation](sub-skills/data-preparation/SKILL.md): prepare or inspect51 Multi30k/spaCy and WMT+BPE data artifacts, pickle schemas, torchtext Fields,52 vocabularies, and BPE helper behavior.53- [training](sub-skills/training/SKILL.md): build and troubleshoot `train.py`54 commands, hyperparameters, scheduler/loss behavior, logs, checkpoints,55 TensorBoard, CPU/CUDA selection, and safe training preflights.56- [translation](sub-skills/translation/SKILL.md): validate checkpoints and data57 pickles for `translate.py`, run checkpoint translation, or use58 `transformer.Translator` beam search programmatically.5960## Repo-Level References6162- Read [references/package-overview.md](references/package-overview.md) for the63 source layout, dependency expectations, workflow map, and known caveats.64- Read [references/troubleshooting.md](references/troubleshooting.md) for65 cross-cutting install/import, torchtext, spaCy, CUDA, pickle, and stale README66 issues.67- Read [references/repo-provenance.md](references/repo-provenance.md) before68 deciding whether this skill is current for a checkout or should be refreshed.6970## Decision Hints7172- If the user asks about tensor dimensions, masks, weight sharing, or custom73 model construction, route to model-architecture before training or translation.74- If the user asks why training cannot read a pickle, route to data-preparation75 first, then training after the schema is identified.76- If the user asks about a `.chkpt` file, route to translation for checkpoint77 inspection unless they are asking how the checkpoint was produced.78- If the prompt mentions BPE, keep the repository caveat visible: BPE is marked79 not fully tested and `translate.py` leaves BPE decoding as TODO.80- If a README command fails with an unrecognized `-log` flag, prefer the81 inspected `train.py` parser over the README example for this commit.