Skip to content

A PyTorch Implementation of "Quasi-Recurrent Neural Networks"

Notifications You must be signed in to change notification settings

jayparks/quasi-rnn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Machine Translation using Quasi-RNN

Pytorch implementation of Neural Machine Translation using "Quasi-Recurrent Neural Networks", ICLR 2017

Requirements

  • NumPy >= 1.11.1
  • Pytorch >= 0.2.0

Usage Instructions

Codes

  • layer.py : Implementation of the quasi-recurrent layer
  • model.py: Implementation of the Encoder-Decoder model using qrnn layer
  • train.py: Code to train a NMT model
  • decode.py: Code to translate a source file using a trained model

Training

To train a quasi-rnn NMT model,

$ python train.py --kernel_size 3 \
                  --hidden_size 640 \
                  --emb_size 500 \
                  --num_enc_symbols 30000 \
                  --num_dec_symbols 30000 ...

Decoding

To run the trained model for translation,

$ python eval.py  --model_path $path_to_model \
                  --decode_input $path_to_source \
                  --decode_output $path_to_output
                  --max_decode_step 300 \
                  --batch_size 30 ...                  

For simplicity, we used greedy decoding at each time step, not the beam search decoding.

Notes

For more in-depth exploration, QRNN API for Pytorch is available: https://github.com/salesforce/pytorch-qrnn

For any comments and feedbacks, please email me at [email protected] or open an issue here.

Releases

No releases published

Packages

No packages published

Languages