/nar-latent-alignment

Unofficial implementation of "Non-Autoregressive Machine Translation with Latent Alignments" https://arxiv.org/abs/2004.07437

Primary LanguagePythonMIT LicenseMIT

nar-latent-alignment

Unofficial implementation of "Non-Autoregressive Machine Translation with Latent Alignments" https://arxiv.org/abs/2004.07437

Open In Colab

Memo

  • CTC model only
    • Imputer model is under construction.
  • The CTC model is inspired heavily by Libovicky and Helcl (2018)
    • Jindrich Libovicky and Jindrich Helcl. 2018. End-toEnd Non-Autoregressive Neural Machine Translation with Connectionist Temporal Classification. In EMNLP.
    • https://arxiv.org/abs/1811.04719
  • Distillation is not tested.

TODO

  • Add comments to source codes..
  • Understand and build the Imputer model.

Notebook for Google Collaboratory

https://colab.research.google.com/github/m3yrin/nar-latent-alignment/blob/master/colab/experiment.ipynb

Examples (CTC)

  1. Download datasets
$ cd datasets
$ git clone https://github.com/odashi/small_parallel_enja.git
  1. training
$ allennlp train -f --include-package src -s tmp configs/ctc.jsonnet
  1. evaluation
$ allennlp evaluate --output-file tmp/output_test.json --include-package src tmp/model.tar.gz datasets/small_parallel_enja/test
  1. prediction
    1. make json inputs
      $ python datasets/make_json.py -I datasets/small_parallel_enja/test.ja -O datasets/test.ja.json
      
    2. predict
      $ allennlp predict --output-file tmp/output_pred.json --include-package src --predictor small_parallel_enja_predictor  tmp/model.tar.gz datasets/test.ja.json