GitHunt
KE

keishinkickback/Pytorch-RNN-text-classification

Word Embedding + LSTM + FC

RNN-based short text classification

  • This is for multi-class short text classification.
  • Model is built with Word Embedding, LSTM ( or GRU), and Fully-connected layer by Pytorch.
  • A mini-batch is created by 0 padding and processed by using torch.nn.utils.rnn.PackedSequence.
  • Cross-entropy Loss + Adam optimizer.
  • Support pretrained word embedding (GloVe).

Model

  • Embedding --> Dropout --> LSTM(GRU) --> Dropout --> FC.

Preprocessing

python preprocess.py

Training

  • The following command starts training. Run it with -h for optional arguments.
python main.py

Languages

Python100.0%

Contributors

Created November 7, 2017
Updated January 20, 2026
keishinkickback/Pytorch-RNN-text-classification | GitHunt