Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/allegro/herbert-klej-cased-v1/README.md
README.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: pl
|
3 |
+
---
|
4 |
+
|
5 |
+
# HerBERT
|
6 |
+
**[HerBERT](https://en.wikipedia.org/wiki/Zbigniew_Herbert)** is a BERT-based Language Model trained on Polish Corpora
|
7 |
+
using only MLM objective with dynamic masking of whole words. For more details, please refer to:
|
8 |
+
[KLEJ: Comprehensive Benchmark for Polish Language Understanding](https://arxiv.org/abs/2005.00630).
|
9 |
+
|
10 |
+
## Dataset
|
11 |
+
**HerBERT** training dataset is a combination of several publicly available corpora for Polish language:
|
12 |
+
|
13 |
+
| Corpus | Tokens | Texts |
|
14 |
+
| :------ | ------: | ------: |
|
15 |
+
| [OSCAR](https://traces1.inria.fr/oscar/)| 6710M | 145M |
|
16 |
+
| [Open Subtitles](http://opus.nlpl.eu/OpenSubtitles-v2018.php) | 1084M | 1.1M |
|
17 |
+
| [Wikipedia](https://dumps.wikimedia.org/) | 260M | 1.5M |
|
18 |
+
| [Wolne Lektury](https://wolnelektury.pl/) | 41M | 5.5k |
|
19 |
+
| [Allegro Articles](https://allegro.pl/artykuly) | 18M | 33k |
|
20 |
+
|
21 |
+
## Tokenizer
|
22 |
+
The training dataset was tokenized into subwords using [HerBERT Tokenizer](https://huggingface.co/allegro/herbert-klej-cased-tokenizer-v1); a character level byte-pair encoding with
|
23 |
+
a vocabulary size of 50k tokens. The tokenizer itself was trained on [Wolne Lektury](https://wolnelektury.pl/) and a publicly available subset of
|
24 |
+
[National Corpus of Polish](http://nkjp.pl/index.php?page=14&lang=0) with a [fastBPE](https://github.com/glample/fastBPE) library.
|
25 |
+
|
26 |
+
Tokenizer utilizes `XLMTokenizer` implementation for that reason, one should load it as `allegro/herbert-klej-cased-tokenizer-v1`.
|
27 |
+
|
28 |
+
## HerBERT models summary
|
29 |
+
| Model | WWM | Cased | Tokenizer | Vocab Size | Batch Size | Train Steps |
|
30 |
+
| :------ | ------: | ------: | ------: | ------: | ------: | ------: |
|
31 |
+
| herbert-klej-cased-v1 | YES | YES | BPE | 50K | 570 | 180k |
|
32 |
+
|
33 |
+
## Model evaluation
|
34 |
+
HerBERT was evaluated on the [KLEJ](https://klejbenchmark.com/) benchmark, publicly available set of nine evaluation tasks for the Polish language understanding.
|
35 |
+
It had the best average performance and obtained the best results for three of them.
|
36 |
+
|
37 |
+
| Model | Average | NKJP-NER | CDSC-E | CDSC-R | CBD | PolEmo2.0-IN |PolEmo2.0-OUT | DYK | PSC | AR |
|
38 |
+
| :------ | ------: | ------: | ------: | ------: | ------: | ------: | ------: | ------: | ------: | ------: |
|
39 |
+
| herbert-klej-cased-v1 | **80.5** | 92.7 | 92.5 | 91.9 | **50.3** | **89.2** |**76.3** |52.1 |95.3 | 84.5 |
|
40 |
+
|
41 |
+
Full leaderboard is available [online](https://klejbenchmark.com/leaderboard).
|
42 |
+
|
43 |
+
|
44 |
+
## HerBERT usage
|
45 |
+
Model training and experiments were conducted with [transformers](https://github.com/huggingface/transformers) in version 2.0.
|
46 |
+
|
47 |
+
Example code:
|
48 |
+
```python
|
49 |
+
from transformers import XLMTokenizer, RobertaModel
|
50 |
+
|
51 |
+
tokenizer = XLMTokenizer.from_pretrained("allegro/herbert-klej-cased-tokenizer-v1")
|
52 |
+
model = RobertaModel.from_pretrained("allegro/herbert-klej-cased-v1")
|
53 |
+
|
54 |
+
encoded_input = tokenizer.encode("Kto ma lepszą sztukę, ma lepszy rząd – to jasne.", return_tensors='pt')
|
55 |
+
outputs = model(encoded_input)
|
56 |
+
```
|
57 |
+
|
58 |
+
HerBERT can also be loaded using `AutoTokenizer` and `AutoModel`:
|
59 |
+
|
60 |
+
```python
|
61 |
+
tokenizer = AutoTokenizer.from_pretrained("allegro/herbert-klej-cased-tokenizer-v1")
|
62 |
+
model = AutoModel.from_pretrained("allegro/herbert-klej-cased-v1")
|
63 |
+
```
|
64 |
+
|
65 |
+
## License
|
66 |
+
CC BY-SA 4.0
|
67 |
+
|
68 |
+
## Citation
|
69 |
+
If you use this model, please cite the following paper:
|
70 |
+
```
|
71 |
+
@misc{rybak2020klej,
|
72 |
+
title={KLEJ: Comprehensive Benchmark for Polish Language Understanding},
|
73 |
+
author={Piotr Rybak and Robert Mroczkowski and Janusz Tracz and Ireneusz Gawlik},
|
74 |
+
year={2020},
|
75 |
+
eprint={2005.00630},
|
76 |
+
archivePrefix={arXiv},
|
77 |
+
primaryClass={cs.CL}
|
78 |
+
}
|
79 |
+
```
|
80 |
+
Paper is accepted at ACL 2020, as soon as proceedings appear, we will update the BibTeX.
|
81 |
+
|
82 |
+
## Authors
|
83 |
+
Model was trained by **Allegro Machine Learning Research** team.
|
84 |
+
|
85 |
+
You can contact us at: <a href="mailto:klejbenchmark@allegro.pl">klejbenchmark@allegro.pl</a>
|