Skip to content

PyTorch implementation for Seq2Seq model with attention and Greedy Search / Beam Search for neural machine translation

License

Notifications You must be signed in to change notification settings

312shan/Pytorch-seq2seq-Beam-Search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pytorch-seq2seq-Beam-Search

Seq2Seq model with attention and Greedy Search / Beam Search for neural machine translation in PyTorch.

This implementation focuses on the following features:

  • Modular structure to be used in other projects
  • Minimal code for readability
  • Full utilization of batches and GPU.
  • Decoding Method Greedy Search
  • Decoding Method Beam Search

This implementation relies on torchtext to minimize dataset management and preprocessing parts.

Seq2Seq Model description

The main structure of seq2seq is adopt in seq2seq

  • Encoder: Bidirectional GRU
  • Decoder: GRU with Attention Mechanism
  • Attention

Decoding Method

  • Greedy Search
  • Beam Search

Requirements

  • CUDA
  • Python 3.6
  • PyTorch 1.4
  • torchtext
  • Spacy
  • numpy
  • Visdom (optional)

download tokenizers by doing so:

python -m spacy download de
python -m spacy download en

TODO

  1. add logging
  2. change to support gpu and cpu, currently is gpu based code implementation
  3. Do Length normalization experiment on Beam-Search And Compare

References

Based on the following implementations

About

PyTorch implementation for Seq2Seq model with attention and Greedy Search / Beam Search for neural machine translation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages