Sockeye项目包含基于MXNet的神经机器翻译Sequence-to-sequence框架

网友投稿 772 2022-11-02

Sockeye项目包含基于MXNet的神经机器翻译Sequence-to-sequence框架

Sockeye项目包含基于MXNet的神经机器翻译Sequence-to-sequence框架

Sockeye

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:

python3MXNet-0.10.0numpy

Install them with:

> pip install -r requirements.txt

Optionally, dmlc's tensorboard fork is supported to track learning curves (pip install tensorboard).

Full dependencies are listed in requirements.txt.

Installation

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

pip

> pip install sockeye

From Source

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

> python setup.py install

after cloning the repository from git. 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

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:

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

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:

> python -m sockeye.translate --models --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.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:MapReduce原理分析之MapTask读取数据
下一篇:HDU1716排列2
相关文章

 发表评论

暂时没有评论,来抢沙发吧~