Giter Club home page Giter Club logo

dual-learning's Introduction

Dual-learning for machine translation


An implementation of Dual Learning For Machine Translation and Joint Training for Neural Machine Translation Models with Monolingual Data on tensorflow.

INSTALLATION

This project is heavily depend on nematus v0.3.

Nematus requires the following packages:

  • Python >= 2.7
  • tensorflow

See more details about nematus in above link.

And I use kenlm as language model:

It seems you need complie it from source code for getting binary executing file. See more details about kenlm in above link.

The code inside which related to language model are independent, so you could use other language model as long as it could offer the function of score a sentence .

USAGE INSTRUCTIONS

You shall prepare the following models:

  • A pair of small parallel dataset of two language.
  • A pair of large monolingual dataset of two language.
  • NMT model X 2, using nematus and small dataset.
  • Language model X2 , using the script of /LM/train_lm.py. You need set the KENLM_PATH and TEMP_DIR inside.

I preprocessed dataset by subword.

Then set the parameter in /test/test_train_dual.sh , especial :

  • LdataPath
  • SdataPath
  • modelDir
  • LMDir

Description as their name. And you could write your own training script, see the following new added configs for dual learning:

dual; parameters for dual learning.

parameter description
--dual active dual learning
--para active parallel dataset using in dual learning
--reinforce active reinforcement learning
--alpha weight of lm score in dual learning.
--joint active joint training
--model_rev or --saveto_rev reverse model file name
--reload_rev load existing model from this path. Set to "latest_checkpoint" to reload the latest checkpoint in the same directory of --model
--source_lm language model (source)
--target_lm language model (target)
--lms language models (one for source, and one for target.)
--source_dataset_mono parallel training corpus (source)
--target_dataset_mono parallel training corpus (target)
--datasets_mono parallel training corpus (one for source, and one for target.)

For replaying the paper of Dual Learning For Machine Translation, you need add --reinforce. For replaying the paper Joint Training for Neural Machine Translation Models with Monolingual Data, you need add --reinforce.

TODO

The result of dual learning isn't good, while joint training works well, later I would post the results.

History

V1.0
V1.1
  • bug fixed.
V1.2
V1.3
  • bug fixed.

dual-learning's People

Contributors

0uo avatar

Watchers

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