ListConfig for training, right to left models, noisy channel re-ranking and ensembling for NMT
State: closed | Pull request: yes

This PR implements the following features

1. ListConfig for training NMT datasets that aren't restricted to multilingual training. Implication - users can specify multiple training text/tar files and sample from different sources with probabilities.

For example,

```
python examples/nlp/machine_translation/enc_dec_nmt.py -cn aayn_base  \
    ...
    model.train_ds.tar_files=["/path/to/dataset1_tarfiles_OP_1..990_CL_.tar, /path/to/dataset2_tarfiles_OP_1..200_CL_.tar"] \
    model.train_ds.concat_sampling_technique=random \
    model.train_ds.concat_sampling_probabilities=["0.6, 0.4"] \
    ...
```

2. Right to left factorized models. Implication - users can train NMT models that generate sequences from right to left (YTTM only). This is typically used in offline knowledge distillation.

For example, right to left training can be enabled with the following flags.

```
python examples/nlp/machine_translation/enc_dec_nmt.py -cn aayn_base  \
    ...
    model.decoder_tokenizer.r2l=true \
    model.encoder_tokenizer.r2l=false \
    ...
```

It is also possible to create a tarred dataset that is right to left using:

```
python examples/nlp/machine_translation/create_tarred_parallel_dataset.py \
    ...
    --src_fname /path/to/source.txt \
    --tgt_fname /path/to/target.txt \
    --decoder_tokenizer_r2l \
    ...
```

3. Implements noisy channel re-ranking. Implication - given a reverse direction translation model and a target side language model, this re-ranks beam search outputs based on (a) forward direction translation model scores, (b) reverse direction scores (c) language model scores. This typically improves translation quality. Requirement: All models must be trained with the same tokenizer.

Noisy channel re-ranking involves two steps (a) Generating translations from the forward model (typically with large beam sizes) (b) Re-ranking beam candidates

```
python  examples/nlp/machine_translation/nmt_transformer_infer.py \
    --model /path/to/forward_model.nemo \
    --srctext /path/to/source_test.txt \
    --tgtout /path/to/translations.txt \
    --write_scores \
    --beam_size 15 \
    ...
```

This will generate two files (a) /path/to/translations.txt and (b) /path/to/translations.txt.scores. The second is a TSV file structured as source \t target \t score for every beam hypothesis. We will use this to re-rank beam candidates

```
python examples/nlp/machine_translation/noisy_channel_reranking.py \
      --reverse_model /path/to/reverse_model.nemo \
      --beam_size 15 \
      --tgtout /path/to/reranked_translations.txt \
      --srctext /path/to/translations.txt.scores \
      --lm_model /path/to/target_lm.nemo \
      --forward_model_coef 1.0 \
      --reverse_model_coef 0.5 \
      --target_lm_coef 0.07 \
     --len_pen 0.7 \
      ...
```

4. Ensemble decoding. Implication - given a list of translation models (trained with the same tokenizer), ensemble decoding computes the probability over the next token in the sequence as the average of the probabilities given by each individual model. The averaged probabilities are used to do beam search. This again improves translation quality.

```
python  examples/nlp/machine_translation/nmt_transformer_infer.py \
    --model /path/to/forward_model_1.nemo,/path/to/forward_model_2.nemo,/path/to/forward_model_3.nemo \
    --srctext /path/to/source_test.txt \
    --tgtout /path/to/translations_ensemble.txt \
    --beam_size 4 \
    ...
```

Note: Noisy channel re-ranking also supports an ensemble of reverse NMT models and can also be provided as a comma-separated string.