Practical overview
When it fits
Use it when you want a hands-on learning resource or a local PyTorch example for Transformer-based English–German translation, rather than a hosted translation interface.
Who it is for
- Learners who want to inspect and understand the original Transformer implementation.
- Developers experimenting with English–German neural machine translation in PyTorch.
- Instructors or explainers who want visualizations of Transformer concepts.
Documented uses
- Explore the annotated Transformer implementation in a Jupyter notebook.
- Visualize positional encodings and other concepts using `playground.py`.
- Translate English or German sentences with included pretrained IWSLT models.
- Configure and run training experiments with the documented dataset and language-direction settings.
Requirements & limits
The public GitHub repository is identified as open source under the MIT license.
- The repository is explicitly presented as a learning resource; its original Transformer is not described as state of the art.
- Pretrained models cover the English–German language pair in both directions.
- The documented setup uses Conda and can be accessed through Jupyter Notebook or an IDE.
- WMT-14 training is described as hardware-intensive, and the README notes missing multi-GPU support in the documented setup.
- Translation examples show that colloquial expressions can be mistranslated.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Set up the repository for notebook study
Create the documented Conda environment and open the annotated Transformer notebook.
Before you start
- Git
- Anaconda or Miniconda with Conda
- Python environment support for PyTorch and Jupyter
Steps
Clone the repository with the command below.
git clone https://github.com/gordicaleksa/pytorch-original-transformerNavigate to the project directory in an Anaconda console.
Run
conda env createin the project directory.Activate the
pytorch-transformerenvironment, then runjupyter notebookand openThe Annotated Transformer ++.ipynb.
Expected outcome
The notebook opens in a browser within the project’s Conda environment for exploring the implementation.
Guide limitations
- Environment creation may take time while SpaCy's English and German statistical models download.
- The README recommends system-wide CUDA installation for GPU drivers; GPU training needs suitable hardware.
Run translation with an included IWSLT model
Use the documented translation script and a pretrained English–German or German–English IWSLT model.
Before you start
- The repository and its Conda environment
- A source sentence in the language matching the selected model
- The model name, dataset name and language direction kept consistent
Steps
Choose
iwslt_e2gfor English-to-German oriwslt_g2efor German-to-English.Run
translation_script.pywith the source sentence, model name,IWSLTdataset name and matching direction (E2GorG2E).Use the script's output as the translation.
Expected outcome
The script produces a translation using the selected pretrained IWSLT model, which the README says is downloaded automatically on first use.
Guide limitations
- The README's examples include a failure to interpret a colloquial German word correctly.
- The model and language-direction settings must match.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- gordicaleksa/pytorch-original-transformer · Official homepage title · retained in its source language

