My learning record of the Annotated Transformer.
- Wrap the original code into a package.
- Visualization of the model.
- Train the model from scratch.
- Train the model with PyTorch Lightning.
Reference:
- The Annotated Transformer
- How to calculate the BLEU score?
- Jupyter Notebook provided as part of the Tensor2Tensor repo
- the
attention.pyin the Tensor2Tensor repo
python train_scratch.pyThis line will call the train_scratch.py script to train the model from scratch. All the configure is in the script.
Once you have trained the model, you can evaluate the model, such as BLEU score, etc.
python eval_scratch.pyThis is useful for me to understand the model and the training process.
python train_lightning.pyThe model configuration is in the config.py file. You can change the configuration in the file.