Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,54 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- nl
|
4 |
+
tags:
|
5 |
+
- text2text generation
|
6 |
+
- spelling normalization
|
7 |
+
- 19th-century Dutch
|
8 |
license: apache-2.0
|
9 |
---
|
10 |
+
|
11 |
+
# 19th Century Dutch Spelling Normalization
|
12 |
+
|
13 |
+
This repository contains a pretrained and finetuned model of the original ByT5-small.
|
14 |
+
This model has been pretrained and finetuned for the task of 19th-century Dutch spelling normalization.
|
15 |
+
We first pretrained the model with 2 million sentences from Dutch historical novels.
|
16 |
+
Afterward, we finetuned the model with a 10k dataset consisting of 19th-century Dutch sentences;
|
17 |
+
these sentences were automatically annotated by a rule-based system built for 19th-century Dutch spelling normalization (van Cranenburgh and van Noord, 2022).
|
18 |
+
|
19 |
+
The model is only available in the TensorFlow format but can be converted to a Pytroch environment.
|
20 |
+
The pretrained only weights are also available in the Flax environment; note that this model has to be finetuned first.
|
21 |
+
The pretrained only weights are available in the directory _pretrained_ByT5_.
|
22 |
+
The train and validation sets used for finetuning are available in the repository.
|
23 |
+
For further information about the model and data, please see the [GitHub](https://github.com/Awolters123/Master-Thesis) repository.
|
24 |
+
|
25 |
+
|
26 |
+
## How to use:
|
27 |
+
|
28 |
+
```
|
29 |
+
from transformers import AutoTokenizer, TFT5ForConditionalGeneration
|
30 |
+
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained('AWolters/ByT5_DutchSpellingNormalization')
|
32 |
+
model = TFT5ForConditionalGeneration.from_pretrained('AWolters/ByT5_DutchSpellingNormalization')
|
33 |
+
|
34 |
+
text = 'De menschen waren aan het werk.'
|
35 |
+
tokenized = tokenizer(text, return_tensors='tf')
|
36 |
+
|
37 |
+
prediction = model.generate(input_ids=tokenized['input_ids'],
|
38 |
+
attention_mask=tokenized['attention_mask'],
|
39 |
+
max_new_tokens=100)
|
40 |
+
|
41 |
+
print(tokenizer.decode(prediction[0], text_target=True, skip_special_tokens=True))
|
42 |
+
```
|
43 |
+
|
44 |
+
## Setup:
|
45 |
+
|
46 |
+
The model has been finetuned with the following (hyper)parameters values:
|
47 |
+
|
48 |
+
_Learn rate_: 5e-5
|
49 |
+
_Batch size_: 32
|
50 |
+
_Optimizer_: AdamW
|
51 |
+
_Epochs_: 30, with earlystopping
|
52 |
+
|
53 |
+
To further finetune the model, use the _T5Trainer.py_ script.
|
54 |
+
If you want to finetune the pretrained weights from scratch, you have to first convert the Flax file into a Pytorch or TensorFlow environment.
|