All Projects → lvapeab → Nmt Keras

lvapeab / Nmt Keras

Licence: mit
Neural Machine Translation with Keras

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nmt Keras

Sockeye
Sequence-to-sequence framework with a focus on Neural Machine Translation based on Apache MXNet
Stars: ✭ 990 (+97.6%)
Mutual labels:  attention-mechanism, machine-translation, neural-machine-translation, sequence-to-sequence, attention-model, attention-is-all-you-need, transformer
Joeynmt
Minimalist NMT for educational purposes
Stars: ✭ 420 (-16.17%)
Mutual labels:  machine-translation, neural-machine-translation, nmt, transformer
Pytorch Seq2seq
Tutorials on implementing a few sequence-to-sequence (seq2seq) models with PyTorch and TorchText.
Stars: ✭ 3,418 (+582.24%)
Mutual labels:  neural-machine-translation, sequence-to-sequence, gru, transformer
Machine Translation
Stars: ✭ 51 (-89.82%)
Mutual labels:  machine-translation, sequence-to-sequence, attention-is-all-you-need, transformer
Neuralmonkey
An open-source tool for sequence learning in NLP built on TensorFlow.
Stars: ✭ 400 (-20.16%)
Mutual labels:  machine-translation, neural-machine-translation, sequence-to-sequence, nmt
Nematus
Open-Source Neural Machine Translation in Tensorflow
Stars: ✭ 730 (+45.71%)
Mutual labels:  machine-translation, neural-machine-translation, sequence-to-sequence, nmt
Nmt List
A list of Neural MT implementations
Stars: ✭ 359 (-28.34%)
Mutual labels:  machine-translation, neural-machine-translation, sequence-to-sequence, nmt
Eeg Dl
A Deep Learning library for EEG Tasks (Signals) Classification, based on TensorFlow.
Stars: ✭ 165 (-67.07%)
Mutual labels:  attention-mechanism, gru, transformer
parallel-corpora-tools
Tools for filtering and cleaning parallel and monolingual corpora for machine translation and other natural language processing tasks.
Stars: ✭ 35 (-93.01%)
Mutual labels:  machine-translation, neural-machine-translation, nmt
Transformer
A Pytorch Implementation of "Attention is All You Need" and "Weighted Transformer Network for Machine Translation"
Stars: ✭ 271 (-45.91%)
Mutual labels:  attention-mechanism, machine-translation, attention-is-all-you-need
Transformer
A TensorFlow Implementation of the Transformer: Attention Is All You Need
Stars: ✭ 3,646 (+627.74%)
Mutual labels:  attention-mechanism, attention-is-all-you-need, transformer
Linear Attention Recurrent Neural Network
A recurrent attention module consisting of an LSTM cell which can query its own past cell states by the means of windowed multi-head attention. The formulas are derived from the BN-LSTM and the Transformer Network. The LARNN cell with attention can be easily used inside a loop on the cell state, just like any other RNN. (LARNN)
Stars: ✭ 119 (-76.25%)
Mutual labels:  attention-mechanism, attention-model, attention-is-all-you-need
Subword Nmt
Unsupervised Word Segmentation for Neural Machine Translation and Text Generation
Stars: ✭ 1,819 (+263.07%)
Mutual labels:  machine-translation, neural-machine-translation, nmt
dynmt-py
Neural machine translation implementation using dynet's python bindings
Stars: ✭ 17 (-96.61%)
Mutual labels:  machine-translation, neural-machine-translation, sequence-to-sequence
RNNSearch
An implementation of attention-based neural machine translation using Pytorch
Stars: ✭ 43 (-91.42%)
Mutual labels:  neural-machine-translation, sequence-to-sequence, nmt
Npmt
Towards Neural Phrase-based Machine Translation
Stars: ✭ 175 (-65.07%)
Mutual labels:  machine-translation, neural-machine-translation, sequence-to-sequence
NiuTrans.NMT
A Fast Neural Machine Translation System. It is developed in C++ and resorts to NiuTensor for fast tensor APIs.
Stars: ✭ 112 (-77.64%)
Mutual labels:  machine-translation, transformer, neural-machine-translation
pynmt
a simple and complete pytorch implementation of neural machine translation system
Stars: ✭ 13 (-97.41%)
Mutual labels:  transformer, nmt, attention-mechanism
Tf Seq2seq
Sequence to sequence learning using TensorFlow.
Stars: ✭ 387 (-22.75%)
Mutual labels:  neural-machine-translation, sequence-to-sequence, nmt
Transformers without tears
Transformers without Tears: Improving the Normalization of Self-Attention
Stars: ✭ 80 (-84.03%)
Mutual labels:  machine-translation, attention-is-all-you-need, transformer

NMT-Keras

Documentation Build Status Open in colab Compatibility license

Neural Machine Translation with Keras.

Library documentation: nmt-keras.readthedocs.io

Attentional recurrent neural network NMT model

alt text

Transformer NMT model

alt text

Features (in addition to the full Keras cosmos): .

Installation

Assuming that you have pip installed and updated (>18), run:

git clone https://github.com/lvapeab/nmt-keras
cd nmt-keras
pip install -e .

for installing the library.

Requirements

NMT-Keras requires the following libraries:

For accelerating the training and decoding on CUDA GPUs, you can optionally install:

For evaluating with additional metrics (Meteor, TER, etc), you can use the Coco-caption evaluation package and set METRICS='coco' in the config.py file. This package requires java (version 1.8.0 or newer).

Usage

Training

  1. Set a training configuration in the config.py script. Each parameter is commented. See the documentation file for further info about each specific hyperparameter. You can also specify the parameters when calling the main.py script following the syntax Key=Value

  2. Train!:

python main.py

Decoding

Once we have our model trained, we can translate new text using the sample_ensemble.py script. Please refer to the ensembling_tutorial for more details about this script. In short, if we want to use the models from the first three epochs to translate the examples/EuTrans/test.en file, just run:

 python sample_ensemble.py 
             --models trained_models/tutorial_model/epoch_1 \ 
                      trained_models/tutorial_model/epoch_2 \
             --dataset datasets/Dataset_tutorial_dataset.pkl \
             --text examples/EuTrans/test.en

Scoring

The score.py script can be used to obtain the (-log)probabilities of a parallel corpus. Its syntax is the following:

python score.py --help
usage: Use several translation models for scoring source--target pairs
       [-h] -ds DATASET [-src SOURCE] [-trg TARGET] [-s SPLITS [SPLITS ...]]
       [-d DEST] [-v] [-c CONFIG] --models MODELS [MODELS ...]
optional arguments:
    -h, --help            show this help message and exit
    -ds DATASET, --dataset DATASET
                            Dataset instance with data
    -src SOURCE, --source SOURCE
                            Text file with source sentences
    -trg TARGET, --target TARGET
                            Text file with target sentences
    -s SPLITS [SPLITS ...], --splits SPLITS [SPLITS ...]
                            Splits to sample. Should be already includedinto the
                            dataset object.
    -d DEST, --dest DEST  File to save scores in
    -v, --verbose         Be verbose
    -c CONFIG, --config CONFIG
                            Config pkl for loading the model configuration. If not
                            specified, hyperparameters are read from config.py
    --models MODELS [MODELS ...]
                            path to the models

Advanced features

Other features such as online learning or interactive NMT protocols are implemented in the interactiveNMT branch.

Resources

Citation

If you use this toolkit in your research, please cite:

@article{nmt-keras:2018,
 journal = {The Prague Bulletin of Mathematical Linguistics},
 title = {{NMT-Keras: a Very Flexible Toolkit with a Focus on Interactive NMT and Online Learning}},
 author = {\'{A}lvaro Peris and Francisco Casacuberta},
 year = {2018},
 volume = {111},
 pages = {113--124},
 doi = {10.2478/pralin-2018-0010},
 issn = {0032-6585},
 url = {https://ufal.mff.cuni.cz/pbml/111/art-peris-casacuberta.pdf}
}

NMT-Keras was used in a number of papers:

Acknowledgement

Much of this library has been developed together with Marc Bolaños (web page) for other sequence-to-sequence problems.

To see other projects following the same philosophy and style of NMT-Keras, take a look to:

TMA: Egocentric captioning based on temporally-linked sequences.

VIBIKNet: Visual question answering.

ABiViRNet: Video description.

Sentence SelectioNN: Sentence classification and selection.

DeepQuest: State-of-the-art models for multi-level Quality Estimation.

Warning!

The Theano backend is not tested anymore, although it should work. There is a known issue with the Theano backend. When running NMT-Keras, it will show the following message:

[...]
raise theano.gof.InconsistencyError("Trying to reintroduce a removed node")
InconsistencyError: Trying to reintroduce a removed node

It is not a critical error, the model keeps working and it is safe to ignore it. However, if you want the message to be gone, use the Theano flag optimizer_excluding=scanOp_pushout_output.

Contact

Álvaro Peris (web page): [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].