GitHub

Code for our ACL2021 paper Neural Machine Translation with Monolingual Translation Memory

Data

The preprocessed JRC data is available at Google Drive.

Environment

The code is written and tested with the following packages:

  • transformers==2.11.0
  • faiss-gpu==1.6.1
  • torch==1.5.1+cu101

Instructions

The scripts to reproduce our results can be found in the scripts folder. Here we give an example to reproduce our experiments (es=>en translation). NOTE: You should check detailed information in the corresponding shell scripts.

  1. do export MTPATH=where_you_hold_your_data_and_models

  2. data preprocessing: sh scripts/prepare.sh

  3. cross-alignment pre-training for the retrieval model: sh scripts/esen/pretrain.sh

  4. build the initial index: sh scripts/esen/build_index.sh (the input_file contains target-side sentences after bpe, and pls make sure to remove duplicates (sort -u))

  5. training: sh scripts/esen/train.multihead.dynamic.sh (model #4: fixed

Read the original on github.com ↗