GithubHelp home page GithubHelp logo

alucardpj / opennmt-tf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opennmt/opennmt-tf

0.0 2.0 0.0 10.12 MB

Open Source Neural Machine Translation in TensorFlow

Home Page: http://opennmt.net/

License: MIT License

Python 100.00%

opennmt-tf's Introduction

This project is experimental. Feedback and testing are welcome.

Build Status Documentation Gitter

OpenNMT-tf

OpenNMT-tf is a general purpose sequence modeling tool in TensorFlow with production in mind. While neural machine translation is the main target task, it has been designed to more generally support:

  • sequence to sequence mapping
  • sequence tagging
  • sequence classification

Key features

OpenNMT-tf focuses on modularity and extensibility using standard TensorFlow modules and practices to support advanced modeling capability:

  • arbitrarily complex encoder architectures
    e.g. mixing RNNs, CNNs, self-attention, etc. in parallel or in sequence.
  • hybrid encoder-decoder models
    e.g. self-attention encoder and RNN decoder or vice versa.
  • multi-source training
    e.g. source text and Moses translation as inputs for machine translation.
  • multiple input format
    text with support of mixed word/character embeddings or real vectors serialized in TFRecord files.

and all of the above can be used simultaneously to train novel and complex architectures. See the predefined models to discover how they are defined.

OpenNMT-tf is also compatible with some of the best TensorFlow features:

Requirements

  • tensorflow (1.4)
  • pyyaml

Overview

A minimal OpenNMT-tf run consists of 3 elements:

  • a Python file describing the model
  • a YAML file describing the parameters
  • a run type

e.g.:

python -m bin.main <run_type> --model <model_file.py> --config <config_file.yml>

When loading an existing checkpoint, the --model option is optional.

  • For more information about configuration files, see the documentation.
  • For more information about command line options, see the help flag python -m bin.main -h.

Quickstart

Here is a minimal workflow to get you started in using OpenNMT-tf. This example uses a toy English-German dataset for machine translation.

1. Build the word vocabularies:

python -m bin.build_vocab --size 50000 --save_vocab data/toy-ende/src-vocab.txt data/toy-ende/src-train.txt
python -m bin.build_vocab --size 50000 --save_vocab data/toy-ende/tgt-vocab.txt data/toy-ende/tgt-train.txt

2. Train with preset parameters:

python -m bin.main train --model config/models/nmt_small.py --config config/opennmt-defaults.yml config/data/toy-ende.yml

3. Translate a test file with the latest checkpoint:

python -m bin.main infer --config config/opennmt-defaults.yml config/data/toy-ende.yml --features_file data/toy-ende/src-test.txt

Note: do not expect any good translation results with this toy example. Consider training on larger parallel datasets instead.

Compatibility with {Lua,Py}Torch implementations

OpenNMT-tf has been designed from scratch and compatibility with the {Lua,Py}Torch implementations in terms of usage, design, and features is not a priority. Please submit a feature request for any missing feature or behavior that you found useful in the {Lua,Py}Torch implementations.

Acknowledgments

The implementation is inspired by the following:

Additional resources

opennmt-tf's People

Contributors

guillaumekln avatar

Watchers

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