Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.41 KB

File metadata and controls

51 lines (36 loc) · 1.41 KB

Minimalist Transformer for Sequence-to-Sequence:

This repo is a Minimalist transformer for sequence to sequence modelling.

The task explored in this repo is the task of inverting sequences with a transformer model.

For learning abouth transformers I recommend the following blog posts:

To see a Minimalist implementation of a transformer for sentiment analysis check out my other repo:

Requirements:

This project uses Python 3.6.

Create a virtual env with:

virtualenv -p python3.6 env

Activate venv:

source env/bin/activate

Finally, to install all requirements just run:

pip install -r requirements.txt

Preprocessing:

Before we start is important to preprocess our data and create our vocabulary.

Run the following command:

python transformer preprocess

It will print a dictionary, our vocabulary string to index.

Train:

To train the model run:

python transformer train

This command will print the losses along the training and validation sets and ends by running the model with some final source samples and using greedy search to decode the reverted sequence.