Update README.md
Browse files
README.md
CHANGED
@@ -1,201 +1,128 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
|
8 |
<!-- Provide a quick summary of what the model is/does. -->
|
|
|
9 |
|
|
|
10 |
|
11 |
-
|
12 |
-
## Model Details
|
13 |
-
|
14 |
-
### Model Description
|
15 |
-
|
16 |
-
<!-- Provide a longer summary of what this model is. -->
|
17 |
-
|
18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
-
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
-
|
70 |
-
## How to Get Started with the Model
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
|
|
|
134 |
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
|
147 |
-
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
|
|
156 |
|
157 |
-
|
|
|
158 |
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
|
162 |
|
163 |
-
|
|
|
164 |
|
165 |
-
|
|
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
|
|
170 |
|
171 |
-
## Citation
|
172 |
|
173 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
license: cc-by-4.0
|
4 |
+
datasets:
|
5 |
+
- uonlp/CulturaX
|
6 |
+
language:
|
7 |
+
- uk
|
8 |
+
pipeline_tag: fill-mask
|
9 |
---
|
10 |
|
11 |
+
# LiBERTa-V2
|
12 |
|
13 |
<!-- Provide a quick summary of what the model is/does. -->
|
14 |
+
LiBERTa Large is a BERT-like model pre-trained from scratch exclusively for Ukrainian. It was presented during the [UNLP](https://unlp.org.ua/) @ [LREC-COLING 2024](https://lrec-coling-2024.org/). Further details are in the [LiBERTa: Advancing Ukrainian Language Modeling through Pre-training from Scratch](https://aclanthology.org/2024.unlp-1.14/) paper.
|
15 |
|
16 |
+
The second version follows the same procedure. The only improvements are whole-word masking, a new tokenizer with a bigger vocabulary, and a longer training.
|
17 |
|
18 |
+
All the code is available in the [Goader/ukr-lm](https://github.com/Goader/ukr-lm) repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
## Evaluation
|
21 |
|
22 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
23 |
|
24 |
+
Read the [paper](https://aclanthology.org/2024.unlp-1.14/) for more detailed tasks descriptions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
| | NER-UK (Micro F1) | WikiANN (Micro F1) | UD POS (Accuracy) | News (Macro F1) |
|
27 |
+
|:------------------------------------------------------------------------------------------------------------------------|:------------------------:|:------------------:|:------------------------------:|:----------------------------------------:|
|
28 |
+
| <tr><td colspan="5" style="text-align: center;"><strong>Base Models</strong></td></tr>
|
29 |
+
| [xlm-roberta-base](https://huggingface.co/FacebookAI/xlm-roberta-base) | 90.86 (0.81) | 92.27 (0.09) | 98.45 (0.07) | - |
|
30 |
+
| [roberta-base-wechsel-ukrainian](https://huggingface.co/benjamin/roberta-base-wechsel-ukrainian) | 90.81 (1.51) | 92.98 (0.12) | 98.57 (0.03) | - |
|
31 |
+
| [electra-base-ukrainian-cased-discriminator](https://huggingface.co/lang-uk/electra-base-ukrainian-cased-discriminator) | 90.43 (1.29) | 92.99 (0.11) | 98.59 (0.06) | - |
|
32 |
+
| <tr><td colspan="5" style="text-align: center;"><strong>Large Models</strong></td></tr>
|
33 |
+
| [xlm-roberta-large](https://huggingface.co/FacebookAI/xlm-roberta-large) | 90.16 (2.98) | 92.92 (0.19) | 98.71 (0.04) | 95.13 (0.49) |
|
34 |
+
| [roberta-large-wechsel-ukrainian](https://huggingface.co/benjamin/roberta-large-wechsel-ukrainian) | 91.24 (1.16) | __93.22 (0.17)__ | 98.74 (0.06) | __96.48 (0.09)__ |
|
35 |
+
| [liberta-large](https://huggingface.co/Goader/liberta-large) | 91.27 (1.22) | 92.50 (0.07) | 98.62 (0.08) | 95.44 (0.04) |
|
36 |
+
| [liberta-large-v2](https://huggingface.co/Goader/liberta-large-v2) | __91.73 (1.81)__ | __93.22 (0.14)__ | __98.79 (0.06)__ | 95.67 (0.12) |
|
37 |
|
38 |
|
39 |
+
## Fine-Tuning Hyperparameters
|
40 |
|
41 |
+
| Hyperparameter | Value |
|
42 |
+
|:---------------|:-----:|
|
43 |
+
| Peak Learning Rate | 3e-5 |
|
44 |
+
| Warm-up Ratio | 0.05 |
|
45 |
+
| Learning Rate Decay | Linear |
|
46 |
+
| Batch Size | 16 |
|
47 |
+
| Epochs | 10 |
|
48 |
+
| Weight Decay | 0.05 |
|
49 |
|
|
|
50 |
|
51 |
+
## How to Get Started with the Model
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
Use the code below to get started with the model. Note, that the repository contains custom code for tokenization:
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
Pipeline usage:
|
56 |
|
57 |
+
```python
|
58 |
+
>>> from transformers import pipeline
|
59 |
|
60 |
+
>>> fill_mask = pipeline("fill-mask", "Goader/liberta-large-v2", trust_remote_code=True)
|
61 |
+
>>> fill_mask("Тарас Шевченко - один з найвизначніших <mask> України.")
|
62 |
|
63 |
+
[{'score': 0.37743982672691345,
|
64 |
+
'token': 23179,
|
65 |
+
'token_str': 'поетів',
|
66 |
+
'sequence': 'Тарас Шевченко - один з найвизначніших поетів України.'},
|
67 |
+
{'score': 0.3221002519130707,
|
68 |
+
'token': 12095,
|
69 |
+
'token_str': 'письменників',
|
70 |
+
'sequence': 'Тарас Шевченко - один з найвизначніших письменників України.'},
|
71 |
+
{'score': 0.05367676541209221,
|
72 |
+
'token': 17491,
|
73 |
+
'token_str': 'художників',
|
74 |
+
'sequence': 'Тарас Шевченко - один з найвизначніших художників України.'},
|
75 |
+
{'score': 0.04778451472520828,
|
76 |
+
'token': 17124,
|
77 |
+
'token_str': 'синів',
|
78 |
+
'sequence': 'Тарас Шевченко - один з найвизначніших синів України.'},
|
79 |
+
{'score': 0.04660917446017265,
|
80 |
+
'token': 1354,
|
81 |
+
'token_str': 'людей',
|
82 |
+
'sequence': 'Тарас Шевченко - один з найвизначніших людей України.'}]
|
83 |
+
```
|
84 |
|
85 |
+
Extracting embeddings:
|
86 |
|
87 |
+
```python
|
88 |
+
from transformers import AutoTokenizer, AutoModel
|
89 |
|
90 |
+
tokenizer = AutoTokenizer.from_pretrained("Goader/liberta-large-v2", trust_remote_code=True)
|
91 |
+
model = AutoModel.from_pretrained("Goader/liberta-large-v2")
|
92 |
|
93 |
+
encoded = tokenizer('Тарас Шевченко - один з найвизначніших поетів України.', return_tensors='pt')
|
94 |
|
95 |
+
output = model(**encoded)
|
96 |
+
```
|
97 |
|
98 |
+
## Citation
|
99 |
|
100 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
101 |
|
102 |
+
```
|
103 |
+
@inproceedings{haltiuk-smywinski-pohl-2024-liberta,
|
104 |
+
title = "{L}i{BERT}a: Advancing {U}krainian Language Modeling through Pre-training from Scratch",
|
105 |
+
author = "Haltiuk, Mykola and
|
106 |
+
Smywi{\'n}ski-Pohl, Aleksander",
|
107 |
+
editor = "Romanyshyn, Mariana and
|
108 |
+
Romanyshyn, Nataliia and
|
109 |
+
Hlybovets, Andrii and
|
110 |
+
Ignatenko, Oleksii",
|
111 |
+
booktitle = "Proceedings of the Third Ukrainian Natural Language Processing Workshop (UNLP) @ LREC-COLING 2024",
|
112 |
+
month = may,
|
113 |
+
year = "2024",
|
114 |
+
address = "Torino, Italia",
|
115 |
+
publisher = "ELRA and ICCL",
|
116 |
+
url = "https://aclanthology.org/2024.unlp-1.14",
|
117 |
+
pages = "120--128",
|
118 |
+
abstract = "Recent advancements in Natural Language Processing (NLP) have spurred remarkable progress in language modeling, predominantly benefiting English. While Ukrainian NLP has long grappled with significant challenges due to limited data and computational resources, recent years have seen a shift with the emergence of new corpora, marking a pivotal moment in addressing these obstacles. This paper introduces LiBERTa Large, the inaugural BERT Large model pre-trained entirely from scratch only on Ukrainian texts. Leveraging extensive multilingual text corpora, including a substantial Ukrainian subset, LiBERTa Large establishes a foundational resource for Ukrainian NLU tasks. Our model outperforms existing multilingual and monolingual models pre-trained from scratch for Ukrainian, demonstrating competitive performance against those relying on cross-lingual transfer from English. This achievement underscores our ability to achieve superior performance through pre-training from scratch with additional enhancements, obviating the need to rely on decisions made for English models to efficiently transfer weights. We establish LiBERTa Large as a robust baseline, paving the way for future advancements in Ukrainian language modeling.",
|
119 |
+
}
|
120 |
+
```
|
121 |
+
|
122 |
+
## Licence
|
123 |
+
|
124 |
+
CC-BY 4.0
|
125 |
+
|
126 |
+
## Authors
|
127 |
+
|
128 |
+
The model was trained by Mykola Haltiuk as a part of his Master's Thesis under the supervision of Aleksander Smywiński-Pohl, PhD, AGH University of Krakow.
|