Skip to content

This repo is a Minimalist transformer for sequence classification.

Notifications You must be signed in to change notification settings

ricardorei/Minimalist-Transformer-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimalist Transformer for Classification:

This repo is a Minimalist transformer for Classification. The task explored in this repo is sentiment analysis.

For learning abouth transformers I recommend the following blog posts:

To see a Minimalist implementation of a transformer for sequence-to-sequence modelling 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.

About

This repo is a Minimalist transformer for sequence classification.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages