Giter Site home page Giter Site logo

mzilinec / sockeye Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awslabs/sockeye

0.0 1.0 0.0 6.39 MB

Sequence-to-sequence framework with a focus on Neural Machine Translation based on Apache MXNet

License: Apache License 2.0

Python 99.09% Dockerfile 0.07% Shell 0.50% CSS 0.06% JavaScript 0.28%

sockeye's Introduction

Sockeye

PyPI version GitHub license GitHub issues Build Status Documentation Status

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

If you use Sockeye, please cite:

Felix Hieber, Tobias Domhan, Michael Denkowski, David Vilar, Artem Sokolov, Ann Clifton and Matt Post (2017): Sockeye: A Toolkit for Neural Machine Translation. In eprint arXiv:cs-CL/1712.05690.

@article{Sockeye:17,
   author = {Hieber, Felix and Domhan, Tobias and Denkowski, Michael
           and Vilar, David and Sokolov, Artem and Clifton, Ann and Post, Matt},
    title = "{Sockeye: A Toolkit for Neural Machine Translation}",
  journal = {arXiv preprint arXiv:1712.05690},
archivePrefix = "arXiv",
   eprint = {1712.05690},
 primaryClass = "cs.CL",
 keywords = {Computer Science - Computation and Language,
             Computer Science - Learning,
             Statistics - Machine Learning},
     year = 2017,
    month = dec,
      url = {https://arxiv.org/abs/1712.05690}
}

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

Recent developments and changes are tracked in our changelog.

Dependencies

Sockeye requires:

Installation

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

CPU

> pip install sockeye

GPU

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 https://raw.githubusercontent.com/awslabs/sockeye/master/requirements/requirements.gpu-cu${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), 90 (9.0), or 91 (9.1).

Or: From Source

CPU

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

> pip install -r requirements/requirements.txt
> pip 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 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/requirements.gpu-cu${CUDA_VERSION}.txt
> pip install .

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

Optional dependencies

In order to write training statistics to a Tensorboard event file for visualization, you can optionally install mxboard (pip install mxboard). To visualize these, run the Tensorboard tool (pip install tensorboard tensorflow) with the logging directory pointed to the training output folder: tensorboard --logdir <model>

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

For easily training popular model types on known data sets, see the Sockeye Autopilot documentation. For manually training and running translation models on your data, read on.

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

> 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 <model_dir> will contain all model artifacts such as parameters and model configuration. The default setting is to train a 1-layer LSTM model with attention.

Translate

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.

sockeye's People

Contributors

fhieber avatar tdomhan avatar mjpost avatar kellensunderland avatar mjdenkowski avatar logogin avatar bricksdont avatar xingniu avatar artemsok avatar deseaus avatar lorisbaz avatar abdelrahmanbadawy avatar davvil avatar hyandell avatar beckdaniel avatar armageddonknight avatar johnrieth avatar martinpopel avatar b0noi avatar xinyu-intel avatar zarana-parekh avatar fiorillo avatar rongzha1 avatar

Watchers

Jakub Bareš avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.