model variants for text classification written in PyTorch. Some of the code structure is based on examples from spro. At the moment the following models are implemented:
- vanilla RNN with GRU cells
class RNN_s
- vanilla RNN with GRU cells and attention on top
class RNN_encoder
- CNN with attention on top
class CNN_encoder
- a transformer encoder in
transformer_models.py
in order to run this code apart from PyTorch you need torchtext too. Get it using:
pip install torchtext
if you want to use some more advanced tokenization technique with torchtext do make sure you have spacy installed using:
pip install -U spacy
then download the English models using:
python -m spacy download en
check the tensorboard-pytorch repo. Here are is a blogpost describing some of the functionality.