Skip to main content

Sequence-to-Sequence framework for Neural Machine Translation

Project description

Sockeye
=======

|Documentation Status| |Build Status|

This package contains the Sockeye project, a sequence-to-sequence
framework for Neural Machine Translation based on MXNet. It implements
the well-known encoder-decoder architecture with attention.

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*.

Dependencies
------------

Sockeye requires: - **Python3** -
`MXNet-0.10.0 <https://github.com/dmlc/mxnet/tree/v0.10.0>`__ - numpy

Installation
------------

You have two options for installing sockeye: pip and directly from
source. ### pip

CPU
^^^

.. code:: bash

> pip install sockeye

GPU
^^^

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

.. code:: bash

> pip install sockeye --no-deps -r requirements.gpu-cu80.txt

or the following for CUDA 7.5:

.. code:: bash

> pip install sockeye --no-deps -r requirements.gpu-cu75.txt

>From Source
~~~~~~~~~~~

CPU
^^^

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

.. code:: bash

> python setup.py install

after cloning the repository from git.

GPU
^^^

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

.. code:: bash

> python setup.py install -r requirements.gpu-cu80.txt

or the following for CUDA 7.5:

.. code:: bash

> python setup.py install -r requirements.gpu-cu75.txt

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:

.. code:: bash

> pip install -e '.[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

.. code:: bash

> python -m sockeye.train <args>

First Steps
-----------

Train
~~~~~

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 German to English translation model, then you
would call sockeye like this:

.. code:: bash

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

After training the directory ** will contain all model artifacts such as
parameters and model configuration.

Translate
~~~~~~~~~

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

.. code:: bash

> 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.

.. |Documentation Status| image:: https://readthedocs.org/projects/sockeye/badge/?version=latest
:target: http://sockeye.readthedocs.io/en/latest/?badge=latest
.. |Build Status| image:: https://travis-ci.org/awslabs/sockeye.svg?branch=master
:target: https://travis-ci.org/awslabs/sockeye


Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

sockeye-1.0.3.tar.gz (93.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sockeye-1.0.3-py3-none-any.whl (86.5 kB view details)

Uploaded Python 3

File details

Details for the file sockeye-1.0.3.tar.gz.

File metadata

  • Download URL: sockeye-1.0.3.tar.gz
  • Upload date:
  • Size: 93.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sockeye-1.0.3.tar.gz
Algorithm Hash digest
SHA256 5b0a280fb4b51fecfbcb48653d42a931b8395324c319d29f93babdb8995013e9
MD5 66829e1e0fe82ff94c736e2fa9732cee
BLAKE2b-256 e925414ec9dab9ff256d4667e3e46e1dab9a16d645ef425c4e38f939b5bec3c7

See more details on using hashes here.

File details

Details for the file sockeye-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sockeye-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bbacd5c8a48f27e1923d15650af77d086a13602e31b8e83507f1782f8ae8fb75
MD5 b699074da961b99fd46a98f40a74409c
BLAKE2b-256 fb727f0c685c4515a0a7fea54c5233364b3513b8e8219a5b20a45d43087f5fa8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page