Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,119 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
|
|
|
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
|
|
10 |
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
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 |
-
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
|
|
|
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
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 |
-
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
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 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
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 |
-
- **Hardware Type:** [More Information Needed]
|
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 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
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 |
-
**BibTeX:**
|
176 |
|
177 |
-
|
|
|
|
|
178 |
|
179 |
-
|
180 |
|
181 |
-
|
182 |
|
183 |
-
|
|
|
|
|
184 |
|
185 |
-
|
|
|
|
|
186 |
|
187 |
-
|
|
|
|
|
188 |
|
189 |
-
## More Information [optional]
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
194 |
|
195 |
-
|
196 |
|
197 |
-
|
198 |
|
199 |
-
|
|
|
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
license: apache-2.0
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
- fr
|
7 |
+
- de
|
8 |
+
- es
|
9 |
+
- zh
|
10 |
+
- it
|
11 |
+
- ru
|
12 |
+
- pl
|
13 |
+
- pt
|
14 |
+
- ja
|
15 |
+
- vi
|
16 |
+
- nl
|
17 |
+
- ar
|
18 |
+
- tr
|
19 |
+
- hi
|
20 |
+
pipeline_tag: fill-mask
|
21 |
+
tags:
|
22 |
+
- code
|
23 |
---
|
24 |
|
25 |
+
# EuroBERT-210m
|
26 |
+
<div>
|
27 |
+
<img src="img/banner.png" width="100%" alt="EuroBERT" />
|
28 |
+
</div>
|
29 |
|
30 |
+
## Table of Contents
|
31 |
+
1. [Overview](#overview)
|
32 |
+
2. [Usage](#Usage)
|
33 |
+
3. [Evaluation](#Evaluation)
|
34 |
+
4. [License](#license)
|
35 |
+
5. [Citation](#citation)
|
36 |
|
37 |
+
## Overview
|
38 |
|
39 |
+
EuroBERT is a family of multilingual encoder models designed for a variety of tasks—such as classification, retrieval, or evaluation metrics— supporting 15 languages, mathematics and code, and sequences of up to 8,192 tokens.
|
40 |
+
EuroBERT models exhibit the strongest multilingual performance across [domains and tasks](#Evaluation) compared to similarly sized systems.
|
41 |
|
42 |
+
It is available in 3 sizes:
|
43 |
|
44 |
+
- [EuroBERT-210m](https://huggingface.co/EuroBERT/EuroBERT-210m) - 210 million parameters
|
45 |
+
- [EuroBERT-610m](https://huggingface.co/EuroBERT/EuroBERT-610m) - 610 million parameters
|
46 |
+
- [EuroBERT-2.1B](https://huggingface.co/EuroBERT/EuroBERT-2.1B) - 2.1 billion parameters
|
47 |
|
48 |
+
For more information about EuroBERT, please check our [blog](***) post and the [arXiv](***) preprint.
|
49 |
|
50 |
+
## Usage
|
51 |
|
52 |
+
```python
|
53 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
model_id = "EuroBERT/EuroBERT-2.1B"
|
56 |
|
57 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
58 |
+
model = AutoModelForMaskedLM.from_pretrained(model_id, trust_remote_code=True)
|
59 |
|
60 |
+
text = "The capital of France is <|mask|>."
|
61 |
+
inputs = tokenizer(text, return_tensors="pt")
|
62 |
+
outputs = model(**inputs)
|
63 |
|
64 |
+
# To get predictions for the mask:
|
65 |
+
masked_index = inputs["input_ids"][0].tolist().index(tokenizer.mask_token_id)
|
66 |
+
predicted_token_id = outputs.logits[0, masked_index].argmax(axis=-1)
|
67 |
+
predicted_token = tokenizer.decode(predicted_token_id)
|
68 |
+
print("Predicted token:", predicted_token)
|
69 |
+
# Predicted token: Paris
|
70 |
+
```
|
71 |
|
72 |
+
**💻 You can use these models directly with the transformers library starting from v4.48.0:**
|
73 |
|
74 |
+
```sh
|
75 |
+
pip install -U transformers>=4.48.0
|
76 |
+
```
|
77 |
|
78 |
+
**🏎️ If your GPU supports it, we recommend using EuroBERT with Flash Attention 2 to achieve the highest efficiency. To do so, install Flash Attention 2 as follows, then use the model as normal:**
|
79 |
|
80 |
+
```bash
|
81 |
+
pip install flash-attn
|
82 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
## Evaluation
|
85 |
|
86 |
+
We evaluate EuroBERT on a suite of tasks to cover various real-world use cases for multilingual encoders, including retrieval performance, classification, sequence regression, quality estimation, summary evaluation, code-related tasks, and mathematical tasks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
+
**Key highlights:**
|
89 |
+
The EuroBERT family exhibits strong multilingual performance across domains and tasks.
|
90 |
+
- EuroBERT-2.1B, our largest model, achieves the highest performance among all evaluated systems. It outperforms the largest system, XLM-RoBERTa-XL.
|
91 |
|
92 |
+
- EuroBERT-610m is competitive with XLM-RoBERTa-XL, a model 5 times its size, on most multilingual tasks and surpasses it in code and mathematics tasks.
|
93 |
|
94 |
+
- The smaller EuroBERT-210m generally outperforms all similarly sized systems.
|
95 |
|
96 |
+
<div>
|
97 |
+
<img src="img/multilingual.png" width="100%" alt="EuroBERT" />
|
98 |
+
</div>
|
99 |
|
100 |
+
<div>
|
101 |
+
<img src="img/code_math.png" width="100%" alt="EuroBERT" />
|
102 |
+
</div>
|
103 |
|
104 |
+
<div>
|
105 |
+
<img src="img/long_context.png" width="100%" alt="EuroBERT" />
|
106 |
+
</div>
|
107 |
|
|
|
108 |
|
109 |
+
## License
|
110 |
|
111 |
+
We release the EuroBERT model architectures, model weights, and training codebase under the Apache 2.0 license.
|
112 |
|
113 |
+
## Citation
|
114 |
|
115 |
+
If you use EuroBERT in your work, please cite:
|
116 |
|
117 |
+
```
|
118 |
+
SOON
|
119 |
+
```
|