Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Sequence-to-Sequence framework for Neural Machine Translation

Project Description

This package contains the Sockeye project, a sequence-to-sequence framework for Neural Machine Translation based on Apache MXNet Incubating. It implements state-of-the-art encoder-decoder architectures, such as - Deep Recurrent Neural Networks with Attention [Bahdanau, ‘14] - Transformer Models with self-attention [Vaswani et al, ‘17] - Fully convolutional sequence-to-sequence models [Gehring et al, ‘17]

If you are interested in collaborating or have any questions, please submit a pull request or issue. You can also send questions to sockeye-dev-at-amazon-dot-com.

Recent developments and changes are tracked in our changelog.


Sockeye requires: - Python3 - MXNet-0.12.1 - numpy


There are several options for installing Sockeye and it’s dependencies. Below we list several alternatives and the corresponding instructions.

Either: AWS DeepLearning AMI

AWS DeepLearning AMI users only need to run the following line to install sockeye:

> sudo pip3 install sockeye --no-deps

For other environments, you can choose between installing via pip or directly from source. Note that for the remaining instructions to work you will need to use python3 instead of python and pip3 instead of pip.

Or: pip package


> pip install sockeye


If you want to run sockeye on a GPU you need to make sure your version of Apache MXNet Incubating contains the GPU bindings. Depending on your version of CUDA, you can do this by running the following:

> wget${CUDA_VERSION}.txt
> pip install sockeye --no-deps -r requirements.gpu-cu${CUDA_VERSION}.txt
> rm requirements.gpu-cu${CUDA_VERSION}.txt

where ${CUDA_VERSION} can be 75 (7.5), 80 (8.0), or 90 (9.0).

Or: From Source


If you want to just use sockeye without extending it, simply install it via

> pip install -r requirements.txt
> pip install .

after cloning the repository from git.


If you want to run sockeye on a GPU you need to make sure your version of Apache MXNet Incubating contains the GPU bindings. Depending on your version of CUDA you can do this by running the following:

> pip install -r requirements.gpu-cu${CUDA_VERSION}.txt
> pip install .

where ${CUDA_VERSION} can be 75 (7.5), 80 (8.0), or 90 (9.0).

Optional dependencies

In order to track learning curves during training you can optionally install dmlc’s tensorboard fork (pip install tensorboard). If you want to create alignment plots you will need to install matplotlib (pip install matplotlib).

In general you can install all optional dependencies from the Sockeye source folder using:

> pip install '.[optional]'

Running sockeye

After installation, command line tools such as sockeye-train, sockeye-translate, sockeye-average and sockeye-embeddings are available. Alternatively, if the sockeye directory is on your PYTHONPATH you can run the modules directly. For example sockeye-train can also be invoked as

> python -m sockeye.train <args>

First Steps


In order to train your first Neural Machine Translation model you will need two sets of parallel files: one for training and one for validation. The latter will be used for computing various metrics during training. Each set should consist of two files: one with source sentences and one with target sentences (translations). Both files should have the same number of lines, each line containing a single sentence. Each sentence should be a whitespace delimited list of tokens.

Say you wanted to train a RNN German-to-English translation model, then you would call sockeye like this:

> python -m sockeye.train --source \
                       --target sentences.en \
                       --validation-source \
                       --validation-target \
                       --use-cpu \
                       --output <model_dir>

After training the directory ** will contain all model artifacts such as parameters and model configuration. The default setting is to train a 1-layer LSTM model with attention.


Input data for translation should be in the same format as the training data (tokenization, preprocessing scheme). You can translate as follows:

> python -m sockeye.translate --models <model_dir> --use-cpu

This will take the best set of parameters found during training and then translate strings from STDIN and write translations to STDOUT.

For more detailed examples check out our user documentation.

Step-by-step tutorial

More detailed step-by-step tutorials can be found in the tutorials directory.

Release History

This version
History Node


History Node


History Node

History Node

History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(218.0 kB) Copy SHA256 Hash SHA256
Wheel py3 Nov 29, 2017
(463.5 kB) Copy SHA256 Hash SHA256
Source None Nov 29, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting