XingxingZhang / OpenNMT-py

Open-Source Neural Machine Translation in PyTorch http://opennmt.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenNMT: Open-Source Neural Machine Translation

This is a Pytorch port of OpenNMT, an open-source (MIT) neural machine translation system.

[Currently we are adapting this code, kindly released by the PyTorch team.]

Quickstart

OpenNMT consists of three commands:

  1. Download the data.

wget https://s3.amazonaws.com/pytorch/examples/opennmt/data/onmt-data.tar && tar -xf onmt-data.tar

  1. Preprocess the data.

python preprocess.py -train_src data/src-train.txt -train_tgt data/tgt-train.txt -valid_src data/src-val.txt -valid_tgt data/tgt-val.txt -save_data data/demo

  1. Train the model.

python train.py -data data/demo-train.pt -save_model model -gpus 0

  1. Translate sentences.

python translate.py -gpu 0 -model model_e13_*.pt -src data/src-test.txt -tgt data/tgt-test.txt -replace_unk -verbose

Pretrained Models

The following pretrained models can be downloaded and used with translate.py.

Release Notes

The following OpenNMT features are implemented:

  • multi-layer bidirectional RNNs with attention and dropout
  • data preprocessing
  • saving and loading from checkpoints
  • inference (translation) with batching and beam search

In development:

  • word features
  • multi-GPU
  • python tokenization tools

About

Open-Source Neural Machine Translation in PyTorch http://opennmt.net/

License:Other


Languages

Language:Python 100.0%