Educational Transformer implementation based on Harvard's tutorial. Complete PyTorch code with Chinese annotations, interactive notebook, attention visualization, and translation examples. Perfect for learning NLP and deep learning concepts.
- Complete Transformer Implementation: Full PyTorch implementation from "Attention Is All You Need"
- Chinese Annotations: Detailed Chinese comments for better understanding
- Interactive Notebook: Jupyter notebook with step-by-step explanations
- Attention Visualization: Visual representations of attention mechanisms
- Translation Examples: Real-world translation using Multi30k dataset
the_annotated_transformer.py- Complete Transformer implementationTheAnnotatedTransformer.ipynb- Interactive Jupyter notebookrequirements.txt- Dependencies and packages needed
Note: Pre-trained model files (*.pt) are not included in this repository due to their large size (each ~230MB).
- Option 1: Train your own models using the notebook
- Option 2: Download pre-trained models (will be available on Hugging Face soon)
- Option 3: Contact the repository owner for model files
multi30k_model_00.ptthroughmulti30k_model_07.pt- Training checkpointsmulti30k_model_final.pt- Final trained modelvocab.pt- Vocabulary file
pip install -r requirements.txtSee TheAnnotatedTransformer.ipynb for detailed examples and explanations.
The notebook includes complete training pipeline for Multi30k German-English translation task.
This project follows the original Harvard Annotated Transformer license.
Feel free to submit issues and pull requests!
For questions about model files or project details, please open an issue. 220242544@seu.edu.cn