CoolFace
Modelpublic

yhavinga/t5-small-24L-dutch-english

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
1likes16downloads
Model Card

t5-small-24L-dutch-english

A T5 sequence to sequence model pre-trained from scratch on cleaned Dutch ๐Ÿ‡ณ๐Ÿ‡ฑ๐Ÿ‡ง๐Ÿ‡ช mC4 and cleaned English ๐Ÿ‡ฌ๐Ÿ‡ง C4.

This t5 eff model has 249M parameters. It was pre-trained with masked language modeling (denoise token span corruption) objective on the dataset mc4_nl_cleaned config large_en_nl for 1 epoch(s) and a duration of 4d10h, with a sequence length of 512, batch size 128 and 851852 total steps (56B tokens). Pre-training evaluation loss and accuracy are 1,18 and 0,74. Refer to the evaluation section below for a comparison of the pre-trained models on summarization and translation.

  • โ€”Pre-trained T5 models need to be finetuned before they can be used for downstream tasks, therefore the inference widget on the right has been turned off.
  • โ€”For a demo of the Dutch CNN summarization models, head over to the Hugging Face Spaces for the [Netherformer ๐Ÿ“ฐ](https://huggingface.co/spaces/flax-community/netherformer) example application!

Please refer to the original T5 papers and Scale Efficiently papers for more information about the T5 architecture and configs, though it must be noted that this model (t5-small-24L-dutch-english) is unrelated to these projects and not an 'official' checkpoint.

  • โ€”[Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/pdf/1910.10683.pdf) by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu.
  • โ€”[Scale Efficiently: Insights from Pre-training and Fine-tuning Transformers](https://arxiv.org/abs/2109.10686) by Yi Tay, Mostafa Dehghani, Jinfeng Rao, William Fedus, Samira Abnar, Hyung Won Chung, Sharan Narang, Dani Yogatama, Ashish Vaswani, Donald Metzler.

Tokenizer

The model uses a cased SentencePiece tokenizer configured with the Nmt, NFKC, Replace multi-space to single-space normalizers and has 32003 tokens. It was trained on Dutch and English with scripts from the Huggingface Transformers Flax examples. See ./raw/main/tokenizer.json for details.

Dataset(s)

All models listed below are pre-trained on cleaned Dutch mC4, which is the original mC4, except

  • โ€”Documents that contained words from a selection of the Dutch and English List of Dirty Naught Obscene and Otherwise Bad Words are removed
  • โ€”Sentences with less than 3 words are removed
  • โ€”Sentences with a word of more than 1000 characters are removed
  • โ€”Documents with less than 5 sentences are removed
  • โ€”Documents with "javascript", "lorum ipsum", "terms of use", "privacy policy", "cookie policy", "uses cookies", "use of cookies", "use cookies", "elementen ontbreken", "deze printversie" are removed.

The Dutch and English models are pre-trained on a 50/50% mix of Dutch mC4 and English C4.

The translation models are fine-tuned on CCMatrix.

Dutch T5 Models

Three types of Dutch T5 models have been trained (blog). t5-base-dutch is the only model with an original T5 config. The other model types t5-v1.1 and t5-eff have gated-relu instead of relu as activation function, and trained with a drop-out of 0.0 unless training would diverge (t5-v1.1-large-dutch-cased). The T5-eff models are models that differ in their number of layers. The table will list the several dimensions of these models. Not all t5-eff models are efficient, the best example being the inefficient t5-xl-4L-dutch-english-cased.

[t5-base-dutch](https://huggingface.co/yhavinga/t5-base-dutch)[t5-v1.1-base-dutch-uncased](https://huggingface.co/yhavinga/t5-v1.1-base-dutch-uncased)[t5-v1.1-base-dutch-cased](https://huggingface.co/yhavinga/t5-v1.1-base-dutch-cased)[t5-v1.1-large-dutch-cased](https://huggingface.co/yhavinga/t5-v1.1-large-dutch-cased)[t5-v1_1-base-dutch-english-cased](https://huggingface.co/yhavinga/t5-v1_1-base-dutch-english-cased)[t5-v1_1-base-dutch-english-cased-1024](https://huggingface.co/yhavinga/t5-v1_1-base-dutch-english-cased-1024)[t5-small-24L-dutch-english](https://huggingface.co/yhavinga/t5-small-24L-dutch-english)[t5-xl-4L-dutch-english-cased](https://huggingface.co/yhavinga/t5-xl-4L-dutch-english-cased)[t5-base-36L-dutch-english-cased](https://huggingface.co/yhavinga/t5-base-36L-dutch-english-cased)[t5-eff-xl-8l-dutch-english-cased](https://huggingface.co/yhavinga/t5-eff-xl-8l-dutch-english-cased)[t5-eff-large-8l-dutch-english-cased](https://huggingface.co/yhavinga/t5-eff-large-8l-dutch-english-cased)
typet5t5-v1.1t5-v1.1t5-v1.1t5-v1.1t5-v1.1t5 efft5 efft5 efft5 efft5 eff
d_model7687687681024768768512204876810241024
d_ff307220482048281620482048192051202560163844096
num_heads121212161212832123216
d_kv64646464646464646412864
num_layers1212122412122443688
num parameters223M248M248M783M248M248M250M585M729M1241M335M
feed_forward_projrelugated-gelugated-gelugated-gelugated-gelugated-gelugated-gelugated-gelugated-gelugated-gelugated-gelu
dropout0.10.00.00.10.00.00.00.10.00.00.0
datasetmc4nlcleanedmc4nlcleaned fullmc4nlcleaned fullmc4nlcleanedmc4nlcleaned smallennlmc4nlcleaned largeennlmc4nlcleaned largeennlmc4nlcleaned largeennlmc4nlcleaned largeennlmc4nlcleaned largeennlmc4nlcleaned largeennl
tr. seq len512102410245125121024512512512512512
batch size1286464641286412851251264128
total steps527500101452512101541120k/242749828396301520k/3397024851852212963212963538k/1703705851850
epochs122210411111
duration2d9h5d5h6d6h8d13h11d18h9d1h4d10h6d1h17d15h4d 19h3d 23h
optimizeradafactoradafactoradafactoradafactoradafactoradafactoradafactoradafactoradafactoradafactoradafactor
lr0.0050.0050.0050.0050.0050.0050.0050.0050.0090.0050.005
warmup10000.010000.010000.010000.010000.05000.020000.02500.01000.01500.01500.0
eval loss1,381,200,961,071,111,131,181,271,051,30191,15
eval acc0,700,730,780,760,750,740,740,720,760,710,74

Evaluation

Most models from the list above have been fine-tuned for summarization and translation. The figure below shows the evaluation scores, where the x-axis shows the translation Bleu score (higher is better) and y-axis the summarization Rouge1 translation score (higher is better). Point size is proportional to the model size. Models with faster inference speed are green, slower inference speed is plotted as bleu.

[image]

Evaluation was run on fine-tuned models trained with the following settings:

SummarizationTranslation
DatasetCNN Dailymail NLCCMatrix en -> nl
#train samples50K50K
OptimizerAdamAdam
learning rate0.0010.0005
source length1024128
target length142128
label smoothing0.050.1
#eval samples10001000

Note that the amount of training data is limited to a fraction of the total dataset sizes, therefore the scores below can only be used to compare the 'transfer-learning' strength. The fine-tuned checkpoints for this evaluation are not saved, since they were trained for comparison of pre-trained models only.

The numbers for summarization are the Rouge scores on 1000 documents from the test split.

[t5-base-dutch](https://huggingface.co/yhavinga/t5-base-dutch)[t5-v1.1-base-dutch-uncased](https://huggingface.co/yhavinga/t5-v1.1-base-dutch-uncased)[t5-v1.1-base-dutch-cased](https://huggingface.co/yhavinga/t5-v1.1-base-dutch-cased)[t5-v1_1-base-dutch-english-cased](https://huggingface.co/yhavinga/t5-v1_1-base-dutch-english-cased)[t5-v1_1-base-dutch-english-cased-1024](https://huggingface.co/yhavinga/t5-v1_1-base-dutch-english-cased-1024)[t5-small-24L-dutch-english](https://huggingface.co/yhavinga/t5-small-24L-dutch-english)[t5-xl-4L-dutch-english-cased](https://huggingface.co/yhavinga/t5-xl-4L-dutch-english-cased)[t5-base-36L-dutch-english-cased](https://huggingface.co/yhavinga/t5-base-36L-dutch-english-cased)[t5-eff-large-8l-dutch-english-cased](https://huggingface.co/yhavinga/t5-eff-large-8l-dutch-english-cased)mt5-base
rouge133.3833.9734.3933.3834.9734.3830.3535.0434.0433.25
rouge213.3213.8513.9813.4714.0113.8911.5714.2313.7612.74
rougeL24.2224.7225.124.3424.9925.2522.6925.0524.7523.5
rougeLsum30.2330.931.4430.5132.0131.3827.532.1231.1230.15
samples_per_second3.183.022.993.222.971.572.80.613.271.22

The models below have been evaluated for English to Dutch translation. Note that the first four models are pre-trained on Dutch only. That they still perform adequate is probably because the translation direction is English to Dutch. The numbers reported are the Bleu scores on 1000 documents from the test split.

[t5-base-dutch](https://huggingface.co/yhavinga/t5-base-dutch)[t5-v1.1-base-dutch-uncased](https://huggingface.co/yhavinga/t5-v1.1-base-dutch-uncased)[t5-v1.1-base-dutch-cased](https://huggingface.co/yhavinga/t5-v1.1-base-dutch-cased)[t5-v1.1-large-dutch-cased](https://huggingface.co/yhavinga/t5-v1.1-large-dutch-cased)[t5-v1_1-base-dutch-english-cased](https://huggingface.co/yhavinga/t5-v1_1-base-dutch-english-cased)[t5-v1_1-base-dutch-english-cased-1024](https://huggingface.co/yhavinga/t5-v1_1-base-dutch-english-cased-1024)[t5-small-24L-dutch-english](https://huggingface.co/yhavinga/t5-small-24L-dutch-english)[t5-xl-4L-dutch-english-cased](https://huggingface.co/yhavinga/t5-xl-4L-dutch-english-cased)[t5-base-36L-dutch-english-cased](https://huggingface.co/yhavinga/t5-base-36L-dutch-english-cased)[t5-eff-large-8l-dutch-english-cased](https://huggingface.co/yhavinga/t5-eff-large-8l-dutch-english-cased)mt5-base
precision_ng174.1778.0977.0872.1277.1978.7678.5977.379.7578.8873.47
precision_ng252.4257.5255.3148.755.3958.0157.8355.2759.8958.2750.12
precision_ng339.5545.242.5435.5442.2545.1345.0242.0647.445.9536.59
precision_ng430.2336.0433.2626.2732.7435.7235.4132.6138.136.9127.26
bp0.990.980.970.980.980.980.980.970.980.980.98
score45.8851.2148.3141.5948.1751.3150.8247.835351.7942.74
samples_per_second45.1945.0538.6710.1242.1942.6112.8533.749.0737.869.03

Translation models

The models t5-small-24L-dutch-english and t5-base-36L-dutch-english have been fine-tuned for both language directions on the first 25M samples from CCMatrix, giving a total of 50M training samples. Evaluation is performed on out-of-sample CCMatrix and also on Tatoeba and Opus Books. The _bp columns list the brevity penalty. The avg_bleu score is the bleu score averaged over all three evaluation datasets. The best scores displayed in bold for both translation directions.

[t5-base-36L-ccmatrix-multi](https://huggingface.co/yhavinga/t5-base-36L-ccmatrix-multi)[t5-base-36L-ccmatrix-multi](https://huggingface.co/yhavinga/t5-base-36L-ccmatrix-multi)[t5-small-24L-ccmatrix-multi](https://huggingface.co/yhavinga/t5-small-24L-ccmatrix-multi)[t5-small-24L-ccmatrix-multi](https://huggingface.co/yhavinga/t5-small-24L-ccmatrix-multi)
source_langennlennl
target_langnlennlen
source_prefixtranslate English to Dutch:translate Dutch to English:translate English to Dutch:translate Dutch to English:
ccmatrix_bleu56.862.857.463.1
tatoeba_bleu46.652.846.451.7
opus_books_bleu13.524.912.923.4
ccmatrix_bp0.950.960.950.96
tatoeba_bp0.970.940.980.94
opus_books_bp0.80.940.770.89
avg_bleu38.9646.8638.9246.06
max_source_length128128128128
max_target_length128128128128
adam_beta10.90.90.90.9
adam_beta20.9970.9970.9970.997
weight_decay0.050.050.0020.002
lr5e-055e-050.00050.0005
label_smoothing_factor0.150.150.10.1
train_batch_size128128128128
warmup_steps2000200020002000
total steps390625390625390625390625
duration4d 5h4d 5h3d 2h3d 2h
num parameters729M729M250M250M

Acknowledgements

This project would not have been possible without compute generously provided by Google through the TPU Research Cloud. The HuggingFace ๐Ÿค— ecosystem was instrumental in all parts of the training. Weights & Biases made it possible to keep track of many training sessions and orchestrate hyper-parameter sweeps with insightful visualizations. The following repositories where helpful in setting up the TPU-VM, and getting an idea what sensible hyper-parameters are for training gpt2 from scratch:

Created by Yeb Havinga