GithubHelp home page GithubHelp logo

mrl_nmt22's People

Contributors

j0ma avatar

Watchers

 avatar

mrl_nmt22's Issues

Multilingual subword models & UNK handling

Multilingual training in fairseq requires a joint subword vocabulary for all the languages. Since it can be difficult to train huge SentencePiece models, it seems common to use pre-trained ones that come packaged with large multilingual models, e.g. mBART or mBART50.

Issue 1: disjoint dictionaries

This is problematic when working with a language like Inuktitut that uses its own script, as the character set is completely disjoint from what the model saw at training time.

Issue 2: UNK handling

Since we can't add IU characters to the SPM model dictionaries, every surface-level token is an UNK as far as sentencepiece is concerned. By default, SPM outputs these OOV tokens as is as noted in #5 . Thus, fairseq-preprocess sees a near-unsegmeted Inuktitut corpus.

The way to get around this is to decompose all OOVs to bytes. This can be accomplished by setting byte_fallback=True---something which the multilingual models did not do.

How to get around this? Maybe by using the python module like this

Feature: Subsampler for multilingual corpora

Multilingual corpora tend to get large, and higher-resourced languages can overpower lower-resourced ones.

To get around this, need functionality to subsample corpora. Should be easy to specify in a YAML config.

Bilingual models with back-translation

Need to take bilingual baselines and improve upon them using (iterative) backtranslation.

Started work on this by training a German to English reverse model on HPCC (ongoing)

Random comment: damn SLURM jobs getting preempted :D

Approach to implementing the logic will follow the backtranslation example from fairseq.

Oddly large vocabularies

As mjpost noted on Twitter, models often have large vocabs.

I noticed that this is happening here too. Here are SP model counts grepped from logs of fairseq-preprocess:

./data-bin/en-cs/en_sp32k_cs_sp32k/default-train/preprocess.log:[cs] Dictionary: 43696 types
./data-bin/en-cs/en_sp32k_cs_sp32k/wmt-early/preprocess.log:[cs] Dictionary: 43696 types
./data-bin/en-cs/en_sp32k_cs_sp32k/wmt-late/preprocess.log:[cs] Dictionary: 43696 types
./data-bin/en-de/en_sp32k_de_sp32k/default-train/preprocess.log:[de] Dictionary: 53648 types
./data-bin/en-de/en_sp32k_de_sp32k/wmt-early/preprocess.log:[de] Dictionary: 53648 types
./data-bin/en-de/en_sp32k_de_sp32k/wmt-late/preprocess.log:[de] Dictionary: 53648 types
./data-bin/en-et/en_sp32k_et_sp32k/default-train/preprocess.log:[et] Dictionary: 42712 types
./data-bin/en-fi/en_sp32k_fi_sp32k/default-train/preprocess.log:[fi] Dictionary: 34904 types
./data-bin/en-fi/en_sp32k_fi_sp32k/newstest-2018/preprocess.log:[fi] Dictionary: 34904 types
./data-bin/en-fi/en_sp32k_fi_sp32k/newstest-2019/preprocess.log:[fi] Dictionary: 34904 types
./data-bin/en-iu/en_sp1k_iu_sp1k/hansard/preprocess.log:[iu] Dictionary: 1008 types
./data-bin/en-iu/en_sp1k_iu_sp1k/wmt20/preprocess.log:[iu] Dictionary: 1008 types
./data-bin/en-iu/en_sp32k_iu_sp32k/hansard/preprocess.log:[iu] Dictionary: 32008 types
./data-bin/en-iu/en_sp32k_iu_sp32k/wmt20/preprocess.log:[iu] Dictionary: 32008 types
./data-bin/en-ru/en_sp32k_ru_sp32k/default-train/preprocess.log:[ru] Dictionary: 148016 types
./data-bin/en-ru/en_sp32k_ru_sp32k/wmt-18-20/preprocess.log:[ru] Dictionary: 148016 types
./data-bin/en-tr/en_sp32k_tr_sp32k/default-train/preprocess.log:[tr] Dictionary: 37240 types
./data-bin/en-uz/en_sp32k_uz_sp32k/default-train/preprocess.log:[uz] Dictionary: 32200 types
./data-bin/en-vi/en_sp32k_vi_sp32k/default-train/preprocess.log:[vi] Dictionary: 39824 types
./data-bin/en-vi/en_sp32k_vi_sp32k/default-train-tokenized/preprocess.log:[vi] Dictionary: 39824 types

Problem? Maybe not, but certainly not optimal. Consider rerunning bilingual baselines later with better vocabs once multilingual / multi-task is running (resources are limited)

Support sharded binarization in ExperimentPreprocessingPipeline

The current design is intended to be used so that each split of a corpus will have one CorpusSplit object associated with it.

Another approach that requires no changes to code would be to list the various shards as different splits (shard1, shard2, ...) but that is cumbersome in terms of writing YAML and defeats the purpose of using an input file regex anyway`.

Maybe I could just accept an iterable of CorpusSplits here?

Inuktitut vocabulary contains UNK

When preprocesing the raw Inuktitut data, the dev and test sets seem to contains an abnormally high <unk> replacement ratio:

(fairseq-py3.8) [jonnesaleva@gpu-1-1 hansard]$ cat preprocess.log
Namespace(align_suffix=None, alignfile=None, all_gather_list_size=16384, bf16=False, bpe=None, checkpoint_shard_count=1, checkpoint_suffix='', cpu=True, criterion='cross_entropy', dataset_impl='mmap', destdir='data-bin/en-iu/en_sp32k_iu_sp32k/hansard', empty_cache_freq=0, fp16=False, fp16_init_scale=128, fp16_no_flatten_grads=False, fp16_scale_tolerance=0.0, fp16_scale_window=None, joined_dictionary=False, log_format=None, log_interval=100, lr_scheduler='fixed', memory_efficient_bf16=False, memory_efficient_fp16=False, min_loss_scale=0.0001, model_parallel_size=1, no_progress_bar=False, nwordssrc=-1, nwordstgt=-1, only_source=False, optimizer=None, padding_factor=8, profile=False, quantization_config_path=None, scoring='bleu', seed=1, source_lang='en', srcdict=None, target_lang='iu', task='translation', tensorboard_logdir=None, testpref='/home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.test', tgtdict=None, threshold_loss_scale=None, thresholdsrc=0, thresholdtgt=0, tokenizer=None, tpu=False, trainpref='/home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.train', user_dir=None, validpref='/home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.dev', workers=40)
[en] Dictionary: 32096 types
[en] /home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.train.en: 1293439 sents, 22538091 tokens, 0.0% replaced by <unk>
[en] Dictionary: 32096 types
[en] /home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.dev.en: 2674 sents, 74173 tokens, 4.0% replaced by <unk>
[en] Dictionary: 32096 types
[en] /home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.test.en: 3602 sents, 98545 tokens, 4.06% replaced by <unk>
[iu] Dictionary: 32256 types
[iu] /home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.train.iu: 1293439 sents, 16342339 tokens, 0.0% replaced by <unk>
[iu] Dictionary: 32256 types
[iu] /home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.dev.iu: 2674 sents, 56715 tokens, 33.5% replaced by <unk>
[iu] Dictionary: 32256 types
[iu] /home/jonnesaleva/datasets/mrl_nmt22/processed/en-iu/en_sp32k_iu_sp32k/hansard/en-iu.test.iu: 3602 sents, 80675 tokens, 34.3% replaced by <unk>
Wrote preprocessed data to data-bin/en-iu/en_sp32k_iu_sp32k/hansard

Training on this data yields clearly degenerate BLEU scores even on hansard-dev:

iu-BLEU-13a-mixed	2.17573
iu-BLEU-intl-mixed	2.15823
iu-BLEU-char-mixed	0.96862
iu-BLEU-spm-mixed	1.52165
iu-BLEU-none-mixed	0.03631
iu-BLEU-13a-lc	2.17573
iu-BLEU-intl-lc	2.15823
iu-BLEU-char-lc	0.96862
iu-BLEU-spm-lc	1.52213
iu-BLEU-none-lc	0.03631
iu-CHRF3-min1-max6	4.43602
iu-CHRF2-char6-word0	3.17176

TODO: fix the preprocessing so the <unk> replacement is minimized.

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.