Giter VIP home page Giter VIP logo

improving_lexical_choice_in_nmt's Introduction

Good friend lol

Tested with Python 2.7.3 and Tensorflow 1.1
Talk: https://www3.nd.edu/~tnguye28/naacl18.pdf

General

This is the code for the paper Improving Lexical Choice in Neural Machine Translation (accepted at NAACL HLT 2018). The branches are:

  • master: baseline NMT
  • tied_embedding: baseline NMT with tied embedding
  • fixnorm: fixnorm model in paper
  • fixnorm_lex: fixnorm+lex model in paper
  • arthur: apply the method of Arthur et al. on top of tied_embedding NMT

To train a model:

  • write a configuration function in configurations.py
  • run: python -m nmt --proto your_config_func

Depending on your config function, the code generates a direction under nmt/saved_models/your_model_name and saves all dev validations there, as well as dev perplexities, train perplexities, best model checkpoint, checkpoint so far (I've tested with saving 1 best checkpoint, not sure about > 1). You should use this checkpoint to translate on any other input.

To translate with UNK replacement:

  • run: python -m nmt --proto your_config_func --mode translate --unk-repl --model-file path_your_saved_checkpoint.cpkt --input-file path_to_input_file

Remember the checkpoint includes data file, meta file, ... but just link to .cpkt, ignore the extension.

References

Code & scripts might be inspired/borrowed from some sources:

improving_lexical_choice_in_nmt's People

Contributors

tnq177 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

improving_lexical_choice_in_nmt's Issues

Other activation function other than tanh?

Just wondering have you try other activation function other than tanh? Do you think it is worth exploring other activation functions? Is there any motivation for choosing tanh?

what if src_embedding_dim and tgt_embedding_dim is different

@tnq177 just wondering what if the src_embedding_dim and tgt_embedding_dim is different. For the implementation fixnorm+lex, in model.py 153 line:

lexicons = lex_hider.transform(lex_inputs) + lex_inputs

And If I understand correctly, this should be in corresponding with the following equation in your paper:
image

Here the output of lex_hider(i.e., tanh(W*f_t^l)) should be in dimension of tgt_embedding_dim, but the lex_inputs(i.e., f_t^l) is still in the dimension of src_embedding_dim, how to add the two matrix with different dimensions?

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.