Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,148 @@
|
|
1 |
---
|
|
|
|
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- ca
|
4 |
license: apache-2.0
|
5 |
+
tags:
|
6 |
+
- "catalan"
|
7 |
+
- "masked-lm"
|
8 |
+
- "longformer"
|
9 |
+
- "longformer-base-4096-ca"
|
10 |
+
- "CaText"
|
11 |
+
- "Catalan Textual Corpus"
|
12 |
+
|
13 |
+
widget:
|
14 |
+
- text: "El Català és una llengua molt <mask>."
|
15 |
+
- text: "Salvador Dalí va viure a <mask>."
|
16 |
+
- text: "La Costa Brava té les millors <mask> d'Espanya."
|
17 |
+
- text: "El cacaolat és un batut de <mask>."
|
18 |
+
- text: "<mask> és la capital de la Garrotxa."
|
19 |
+
- text: "Vaig al <mask> a buscar bolets."
|
20 |
+
- text: "Antoni Gaudí vas ser un <mask> molt important per la ciutat."
|
21 |
+
- text: "Catalunya és una referència en <mask> a nivell europeu."
|
22 |
+
|
23 |
---
|
24 |
+
|
25 |
+
# Catalan Longformer (longformer-base-4096-ca) base model
|
26 |
+
|
27 |
+
## Table of Contents
|
28 |
+
<details>
|
29 |
+
<summary>Click to expand</summary>
|
30 |
+
|
31 |
+
- [Model description](#model-description)
|
32 |
+
- [Intended uses and limitations](#intended-use)
|
33 |
+
- [How to use](#how-to-use)
|
34 |
+
- [Limitations and bias](#limitations-and-bias)
|
35 |
+
- [Training](#training)
|
36 |
+
- [Training data](#training-data)
|
37 |
+
- [Training procedure](#training-procedure)
|
38 |
+
- [Evaluation](#evaluation)
|
39 |
+
- [CLUB benchmark](#club-benchmark)
|
40 |
+
- [Evaluation results](#evaluation-results)
|
41 |
+
- [Licensing Information](#licensing-information)
|
42 |
+
- [Additional information](#additional-information)
|
43 |
+
- [Author](#author)
|
44 |
+
- [Contact information](#contact-information)
|
45 |
+
- [Copyright](#copyright)
|
46 |
+
- [Licensing information](#licensing-information)
|
47 |
+
- [Funding](#funding)
|
48 |
+
- [Citing information](#citing-information)
|
49 |
+
- [Disclaimer](#disclaimer)
|
50 |
+
|
51 |
+
</details>
|
52 |
+
|
53 |
+
## Model description
|
54 |
+
|
55 |
+
The **longformer-base-4096-ca** is a transformer-based masked language model for the Catalan language.
|
56 |
+
It is based on the [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) base model
|
57 |
+
and has been trained on a medium-size corpus collected from publicly available corpora and crawlers.
|
58 |
+
|
59 |
+
The **longformer-base-4096-ca** is the [Longformer](https://huggingface.co/allenai/longformer-base-4096) version of the [roberta-base-ca-v2](https://huggingface.co/projecte-aina/roberta-base-ca-v2) masked language model for the Catalan language. Using this Longformer architecture we can process contexts of up to 4096 tokens without the need of additional aggregation strategies. The pretraining process of this model started from the **roberta-base-ca-v2** checkpoint and was pretrained for MLM on both short and long documents in Catalan.
|
60 |
+
|
61 |
+
The Longformer model uses a combination of sliding window (local) attention and global attention. Global attention is user-configured based on the task to allow the model to learn task-specific representations. Please refer to the original [paper](https://arxiv.org/abs/2004.05150) for more details on how to set global attention.
|
62 |
+
|
63 |
+
## Intended uses and limitations
|
64 |
+
|
65 |
+
**longformer-base-4096-ca** model is ready-to-use only for masked language modeling to perform the Fill Mask task (try the inference API or read the next section).
|
66 |
+
However, it is intended to be fine-tuned on non-generative downstream tasks such as Question Answering, Text Classification, or Named Entity Recognition.
|
67 |
+
|
68 |
+
## How to use
|
69 |
+
|
70 |
+
Here is how to use this model:
|
71 |
+
|
72 |
+
```python
|
73 |
+
from transformers import AutoModelForMaskedLM
|
74 |
+
from transformers import AutoTokenizer, FillMaskPipeline
|
75 |
+
from pprint import pprint
|
76 |
+
tokenizer_hf = AutoTokenizer.from_pretrained('projecte-aina/longformer-base-4096-ca')
|
77 |
+
model = AutoModelForMaskedLM.from_pretrained('projecte-aina/longformer-base-4096-ca')
|
78 |
+
model.eval()
|
79 |
+
pipeline = FillMaskPipeline(model, tokenizer_hf)
|
80 |
+
text = f"Em dic <mask>."
|
81 |
+
res_hf = pipeline(text)
|
82 |
+
pprint([r['token_str'] for r in res_hf])
|
83 |
+
```
|
84 |
+
|
85 |
+
## Limitations and bias
|
86 |
+
At the time of submission, no measures have been taken to estimate the bias embedded in the model. However, we are well aware that our models may be biased since the corpus have been collected using crawling techniques on multiple web sources. We intend to conduct research in these areas in the future, and if completed, this model card will be updated.
|
87 |
+
|
88 |
+
|
89 |
+
## Training
|
90 |
+
|
91 |
+
### Training data
|
92 |
+
|
93 |
+
The training corpus consists of several corpora gathered from web crawling and public corpora.
|
94 |
+
|
95 |
+
|
96 |
+
| Corpus | Size in GB |
|
97 |
+
|-------------------------|------------|
|
98 |
+
| Catalan Crawling | 13.00 |
|
99 |
+
| Wikipedia | 1.10 |
|
100 |
+
| DOGC | 0.78 |
|
101 |
+
| Catalan Open Subtitles | 0.02 |
|
102 |
+
| Catalan Oscar | 4.00 |
|
103 |
+
| CaWaC | 3.60 |
|
104 |
+
| Cat. General Crawling | 2.50 |
|
105 |
+
| Cat. Goverment Crawling | 0.24 |
|
106 |
+
| ACN | 0.42 |
|
107 |
+
| Padicat | 0.63 |
|
108 |
+
| RacoCatalá | 8.10 |
|
109 |
+
| Nació Digital | 0.42 |
|
110 |
+
| Vilaweb | 0.06 |
|
111 |
+
| Tweets | 0.02 |
|
112 |
+
|
113 |
+
For this specific pre-training process we have used a subset of this corpus of 5,3 GB.
|
114 |
+
|
115 |
+
### Training procedure
|
116 |
+
|
117 |
+
The training corpus has been tokenized using a byte version of Byte-Pair Encoding (BPE) used in the original [RoBERTA](https://arxiv.org/abs/1907.11692) model with a vocabulary size of 50,262 tokens. The RoBERTa-base-bne pre-training consists of a masked language model training that follows the approach employed for the RoBERTa base. The training lasted a total of 37 hours with 8 computing nodes each one with 2 AMD MI50 GPUs of 32GB VRAM.
|
118 |
+
|
119 |
+
## Additional information
|
120 |
+
|
121 |
+
### Author
|
122 |
+
Text Mining Unit (TeMU) at the Barcelona Supercomputing Center ([email protected])
|
123 |
+
|
124 |
+
### Contact information
|
125 |
+
For further information, send an email to [email protected]
|
126 |
+
|
127 |
+
### Copyright
|
128 |
+
Copyright (c) 2022 Text Mining Unit at Barcelona Supercomputing Center
|
129 |
+
|
130 |
+
### Licensing information
|
131 |
+
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
132 |
+
|
133 |
+
### Funding
|
134 |
+
This work was funded by the [Departament de la Vicepresidència i de Polítiques Digitals i Territori de la Generalitat de Catalunya](https://politiquesdigitals.gencat.cat/ca/inici/index.html#googtrans(ca|en) within the framework of [Projecte AINA](https://politiquesdigitals.gencat.cat/ca/economia/catalonia-ai/aina).
|
135 |
+
|
136 |
+
|
137 |
+
### Disclaimer
|
138 |
+
|
139 |
+
<details>
|
140 |
+
<summary>Click to expand</summary>
|
141 |
+
|
142 |
+
The models published in this repository are intended for a generalist purpose and are available to third parties. These models may have bias and/or any other undesirable distortions.
|
143 |
+
|
144 |
+
When third parties, deploy or provide systems and/or services to other parties using any of these models (or using systems based on these models) or become users of the models, they should note that it is their responsibility to mitigate the risks arising from their use and, in any event, to comply with applicable regulations, including regulations regarding the use of Artificial Intelligence.
|
145 |
+
|
146 |
+
In no event shall the owner and creator of the models (BSC – Barcelona Supercomputing Center) be liable for any results arising from the use made by third parties of these models.
|
147 |
+
|
148 |
+
</details>
|