jarodrigues
commited on
Commit
•
12c2bc5
1
Parent(s):
e21b759
Update README.md
Browse files
README.md
CHANGED
@@ -5,6 +5,7 @@ tags:
|
|
5 |
- albertina-pt*
|
6 |
- albertina-ptpt
|
7 |
- albertina-ptbr
|
|
|
8 |
- fill-mask
|
9 |
- bert
|
10 |
- deberta
|
@@ -13,7 +14,6 @@ tags:
|
|
13 |
- foundation model
|
14 |
license: other
|
15 |
datasets:
|
16 |
-
- brwac
|
17 |
- PORTULAN/glue-ptpt
|
18 |
- assin2
|
19 |
- dlb/plue
|
@@ -24,14 +24,8 @@ widget:
|
|
24 |
---
|
25 |
|
26 |
|
27 |
-
# Albertina PT-BR
|
28 |
|
29 |
-
---
|
30 |
-
<img align="left" width="40" height="40" src="https://github.githubassets.com/images/icons/emoji/unicode/1f917.png">
|
31 |
-
<p style="text-align: center;"> <b>We just released</b> the base models and <b>Albertina PT-BR nobrwac</b>,
|
32 |
-
trained on a data set with most permissive license.</p>
|
33 |
-
|
34 |
-
---
|
35 |
|
36 |
**Albertina PT-*** is a foundation, large language model for the **Portuguese language**.
|
37 |
|
@@ -73,10 +67,11 @@ Please use the above cannonical reference when using or citing this model.
|
|
73 |
|
74 |
# Model Description
|
75 |
|
76 |
-
**This model card is for Albertina-PT-BR-
|
77 |
|
78 |
-
|
79 |
|
|
|
80 |
|
81 |
|
82 |
<br>
|
@@ -84,24 +79,15 @@ TODO:Licence
|
|
84 |
# Training Data
|
85 |
|
86 |
|
87 |
-
**Albertina PT-BR** was trained over
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
[**Albertina PT-PT**](https://huggingface.co/PORTULAN/albertina-ptpt), in turn, was trained over a 2.2 billion token data set that resulted from gathering some openly available corpora of European Portuguese from the following sources:
|
94 |
-
|
95 |
-
- [OSCAR](https://huggingface.co/datasets/oscar-corpus/OSCAR-2301): the OSCAR data set includes documents in more than one hundred languages, including Portuguese, and it is widely used in the literature. It is the result of a selection performed over the [Common Crawl](https://commoncrawl.org/) data set, crawled from the Web, that retains only pages whose metadata indicates permission to be crawled, that performs deduplication, and that removes some boilerplate, among other filters. Given that it does not discriminate between the Portuguese variants, we performed extra filtering by retaining only documents whose meta-data indicate the Internet country code top-level domain of Portugal. We used the January 2023 version of OSCAR, which is based on the November/December 2022 version of Common Crawl.
|
96 |
-
- [DCEP](https://joint-research-centre.ec.europa.eu/language-technology-resources/dcep-digital-corpus-european-parliament_en): the Digital Corpus of the European Parliament is a multilingual corpus including documents in all official EU languages published on the European Parliament's official website. We retained its European Portuguese portion.
|
97 |
-
- [Europarl](https://www.statmt.org/europarl/): the European Parliament Proceedings Parallel Corpus is extracted from the proceedings of the European Parliament from 1996 to 2011. We retained its European Portuguese portion.
|
98 |
-
- [ParlamentoPT](https://huggingface.co/datasets/PORTULAN/parlamento-pt): the ParlamentoPT is a data set we obtained by gathering the publicly available documents with the transcription of the debates in the Portuguese Parliament.
|
99 |
-
|
100 |
-
|
101 |
|
102 |
## Preprocessing
|
103 |
|
104 |
-
We filtered the PT-
|
105 |
We skipped the default filtering of stopwords since it would disrupt the syntactic structure, and also the filtering for language identification given the corpus was pre-selected as Portuguese.
|
106 |
|
107 |
|
@@ -109,27 +95,12 @@ We skipped the default filtering of stopwords since it would disrupt the syntact
|
|
109 |
|
110 |
As codebase, we resorted to the [DeBERTa V2 XLarge](https://huggingface.co/microsoft/deberta-v2-xlarge), for English.
|
111 |
|
112 |
-
To train **Albertina-PT-
|
113 |
-
The model was trained using the maximum available memory capacity resulting in a batch size of 896 samples (56 samples per GPU
|
114 |
-
We chose a learning rate of 1e-5 with linear decay and 10k warm-up steps
|
115 |
-
In total, around 200k training steps were taken across 50 epochs.
|
116 |
-
The model was trained for 1 day and 11 hours on a2-megagpu-16gb Google Cloud A2 VMs with 16 GPUs, 96 vCPUs and 1.360 GB of RAM.
|
117 |
-
|
118 |
-
TODO:
|
119 |
-
To train **Albertina-PT-BR-nobrwac** the OSCAR data set was tokenized with the original DeBERTA tokenizer with a 128 token sequence truncation and dynamic padding.
|
120 |
-
The model was trained using the maximum available memory capacity resulting in a batch size of 896 samples (56 samples per GPU without gradient accumulation steps).
|
121 |
-
We chose a learning rate of 1e-5 with linear decay and 10k warm-up steps based on the results of exploratory experiments.
|
122 |
In total, around 200k training steps were taken across 50 epochs.
|
123 |
The model was trained for 1 day and 13 hours on a2-megagpu-16gb Google Cloud A2 VMs with 16 GPUs, 96 vCPUs and 1.360 GB of RAM.
|
124 |
|
125 |
-
|
126 |
-
To train [**Albertina PT-PT**](https://huggingface.co/PORTULAN/albertina-ptpt), the data set was tokenized with the original DeBERTa tokenizer with a 128 token sequence truncation and dynamic padding.
|
127 |
-
The model was trained using the maximum available memory capacity resulting in a batch size of 832 samples (52 samples per GPU and applying gradient accumulation in order to approximate the batch size of the PT-BR model).
|
128 |
-
Similarly to the PT-BR variant above, we opted for a learning rate of 1e-5 with linear decay and 10k warm-up steps.
|
129 |
-
However, since the number of training examples is approximately twice of that in the PT-BR variant, we reduced the number of training epochs to half and completed only 25 epochs, which resulted in approximately 245k steps.
|
130 |
-
The model was trained for 3 days on a2-highgpu-8gb Google Cloud A2 VMs with 8 GPUs, 96 vCPUs and 680 GB of RAM.
|
131 |
-
|
132 |
-
|
133 |
<br>
|
134 |
|
135 |
# Evaluation
|
@@ -137,7 +108,7 @@ The model was trained for 3 days on a2-highgpu-8gb Google Cloud A2 VMs with 8 GP
|
|
137 |
The two model versions were evaluated on downstream tasks organized into two groups.
|
138 |
|
139 |
In one group, we have the two data sets from the [ASSIN 2 benchmark](https://huggingface.co/datasets/assin2), namely STS and RTE, that were used to evaluate the previous state-of-the-art model [BERTimbau Large](https://huggingface.co/neuralmind/bert-large-portuguese-cased).
|
140 |
-
In the other group of data sets, we have the translations into PT-BR
|
141 |
|
142 |
|
143 |
## ASSIN 2
|
@@ -145,10 +116,11 @@ In the other group of data sets, we have the translations into PT-BR and PT-PT o
|
|
145 |
[ASSIN 2](https://huggingface.co/datasets/assin2) is a **PT-BR data** set of approximately 10.000 sentence pairs, split into 6.500 for training, 500 for validation, and 2.448 for testing, annotated with semantic relatedness scores (range 1 to 5) and with binary entailment judgments.
|
146 |
This data set supports the task of semantic textual similarity (STS), which consists of assigning a score of how semantically related two sentences are; and the task of recognizing textual entailment (RTE), which given a pair of sentences, consists of determining whether the first entails the second.
|
147 |
|
148 |
-
| Model
|
149 |
-
|
150 |
-
| **Albertina-PT-BR**
|
151 |
-
|
|
|
|
152 |
|
153 |
|
154 |
## GLUE tasks translated
|
@@ -159,22 +131,15 @@ We address four tasks from those in PLUE, namely:
|
|
159 |
- and two inference tasks: RTE, for recognizing textual entailment and WNLI, for coreference and natural language inference.
|
160 |
|
161 |
|
162 |
-
| Model
|
163 |
-
|
164 |
-
| **Albertina-PT-BR** | 0.
|
165 |
-
|
|
|
|
166 |
| | | | | |
|
167 |
-
| **Albertina-PT-PT**
|
168 |
|
169 |
|
170 |
-
We resorted to [GLUE-PT](https://huggingface.co/datasets/PORTULAN/glue-ptpt), a **PT-PT version of the GLUE** benchmark.
|
171 |
-
We automatically translated the same four tasks from GLUE using [DeepL Translate](https://www.deepl.com/), which specifically provides translation from English to PT-PT as an option.
|
172 |
-
|
173 |
-
| Model | RTE (Accuracy) | WNLI (Accuracy)| MRPC (F1) | STS-B (Pearson) |
|
174 |
-
|---------------------|----------------|----------------|-----------|-----------------|
|
175 |
-
| **Albertina-PT-PT** | **0.8339** | **0.4225** | **0.9171**| 0.8801 |
|
176 |
-
| | | | | |
|
177 |
-
| **Albertina-PT-BR** | 0.7942 | 0.4085 | 0.9048 | **0.8847** |
|
178 |
|
179 |
<br>
|
180 |
|
@@ -184,14 +149,14 @@ You can use this model directly with a pipeline for masked language modeling:
|
|
184 |
|
185 |
```python
|
186 |
>>> from transformers import pipeline
|
187 |
-
>>> unmasker = pipeline('fill-mask', model='PORTULAN/albertina-ptbr')
|
188 |
>>> unmasker("A culinária brasileira é rica em sabores e [MASK], tornando-se um dos maiores patrimônios do país.")
|
189 |
|
190 |
-
[{'score': 0.
|
191 |
-
{'score': 0.
|
192 |
-
{'score': 0.
|
193 |
-
{'score': 0.
|
194 |
-
{'score': 0.
|
195 |
|
196 |
|
197 |
```
|
@@ -202,7 +167,7 @@ The model can be used by fine-tuning it for a specific task:
|
|
202 |
>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer
|
203 |
>>> from datasets import load_dataset
|
204 |
|
205 |
-
>>> model = AutoModelForSequenceClassification.from_pretrained("PORTULAN/albertina-ptbr", num_labels=2)
|
206 |
>>> tokenizer = AutoTokenizer.from_pretrained("PORTULAN/albertina-ptbr")
|
207 |
>>> dataset = load_dataset("PORTULAN/glue-ptpt", "rte")
|
208 |
|
|
|
5 |
- albertina-pt*
|
6 |
- albertina-ptpt
|
7 |
- albertina-ptbr
|
8 |
+
- albertina-ptbr-nobrwac
|
9 |
- fill-mask
|
10 |
- bert
|
11 |
- deberta
|
|
|
14 |
- foundation model
|
15 |
license: other
|
16 |
datasets:
|
|
|
17 |
- PORTULAN/glue-ptpt
|
18 |
- assin2
|
19 |
- dlb/plue
|
|
|
24 |
---
|
25 |
|
26 |
|
27 |
+
# Albertina PT-BR No-brWaC
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
**Albertina PT-*** is a foundation, large language model for the **Portuguese language**.
|
31 |
|
|
|
67 |
|
68 |
# Model Description
|
69 |
|
70 |
+
**This model card is for Albertina-PT-BR No-brWaC**, with 900M parameters, 24 layers and a hidden size of 1536.
|
71 |
|
72 |
+
Albertina-PT-BR No-brWaC is distributed under an [MIT license](https://huggingface.co/PORTULAN/albertina-ptpt/blob/main/LICENSE).
|
73 |
|
74 |
+
DeBERTa is distributed under an [MIT license](https://github.com/microsoft/DeBERTa/blob/master/LICENSE).
|
75 |
|
76 |
|
77 |
<br>
|
|
|
79 |
# Training Data
|
80 |
|
81 |
|
82 |
+
**Albertina PT-BR No-brWac** was trained over a 3.7 billion token curated selection of documents from the [OSCAR](https://huggingface.co/datasets/oscar-corpus/OSCAR-2301) data set.
|
83 |
+
The OSCAR data set includes documents in more than one hundred languages, including Portuguese, and it is widely used in the literature.
|
84 |
+
It is the result of a selection performed over the [Common Crawl](https://commoncrawl.org/) data set, crawled from the Web, that retains only pages whose metadata indicates permission to be crawled, that performs deduplication, and that removes some boilerplate, among other filters.
|
85 |
+
Given that it does not discriminate between the Portuguese variants, we performed extra filtering by retaining only documents whose meta-data indicate the Internet country code top-level domain of Brazil.
|
86 |
+
We used the January 2023 version of OSCAR, which is based on the November/December 2022 version of Common Crawl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
## Preprocessing
|
89 |
|
90 |
+
We filtered the PT-BR corpora using the [BLOOM pre-processing](https://github.com/bigscience-workshop/data-preparation) pipeline.
|
91 |
We skipped the default filtering of stopwords since it would disrupt the syntactic structure, and also the filtering for language identification given the corpus was pre-selected as Portuguese.
|
92 |
|
93 |
|
|
|
95 |
|
96 |
As codebase, we resorted to the [DeBERTa V2 XLarge](https://huggingface.co/microsoft/deberta-v2-xlarge), for English.
|
97 |
|
98 |
+
To train [**Albertina PT-PT No-brWac**](https://huggingface.co/PORTULAN/albertina-ptpt-nobrwac), the data set was tokenized with the original DeBERTa tokenizer with a 128 token sequence truncation and dynamic padding.
|
99 |
+
The model was trained using the maximum available memory capacity resulting in a batch size of 896 samples (56 samples per GPU).
|
100 |
+
We chose a learning rate of 1e-5 with linear decay and 10k warm-up steps.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
In total, around 200k training steps were taken across 50 epochs.
|
102 |
The model was trained for 1 day and 13 hours on a2-megagpu-16gb Google Cloud A2 VMs with 16 GPUs, 96 vCPUs and 1.360 GB of RAM.
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
<br>
|
105 |
|
106 |
# Evaluation
|
|
|
108 |
The two model versions were evaluated on downstream tasks organized into two groups.
|
109 |
|
110 |
In one group, we have the two data sets from the [ASSIN 2 benchmark](https://huggingface.co/datasets/assin2), namely STS and RTE, that were used to evaluate the previous state-of-the-art model [BERTimbau Large](https://huggingface.co/neuralmind/bert-large-portuguese-cased).
|
111 |
+
In the other group of data sets, we have the translations into PT-BR of the English data sets used for a few of the tasks in the widely-used [GLUE benchmark](https://huggingface.co/datasets/glue), which allowed us to test both Albertina-PT-* variants on a wider variety of downstream tasks.
|
112 |
|
113 |
|
114 |
## ASSIN 2
|
|
|
116 |
[ASSIN 2](https://huggingface.co/datasets/assin2) is a **PT-BR data** set of approximately 10.000 sentence pairs, split into 6.500 for training, 500 for validation, and 2.448 for testing, annotated with semantic relatedness scores (range 1 to 5) and with binary entailment judgments.
|
117 |
This data set supports the task of semantic textual similarity (STS), which consists of assigning a score of how semantically related two sentences are; and the task of recognizing textual entailment (RTE), which given a pair of sentences, consists of determining whether the first entails the second.
|
118 |
|
119 |
+
| Model | RTE (Accuracy) | STS (Pearson)|
|
120 |
+
|------------------------------|----------------|--------------|
|
121 |
+
| **Albertina-PT-BR** | **0.9130** | **0.8676** |
|
122 |
+
| **Albertina-PT-BR No-brWaC** | 0.8950 | 0.8547 |
|
123 |
+
| BERTimbau-large | 0.8913 | 0.8531 |
|
124 |
|
125 |
|
126 |
## GLUE tasks translated
|
|
|
131 |
- and two inference tasks: RTE, for recognizing textual entailment and WNLI, for coreference and natural language inference.
|
132 |
|
133 |
|
134 |
+
| Model | RTE (Accuracy) | WNLI (Accuracy)| MRPC (F1) | STS-B (Pearson) |
|
135 |
+
|------------------------------|----------------|----------------|-----------|-----------------|
|
136 |
+
| **Albertina-PT-BR No-brWaC** | 0.7798 | 0.5070 | **0.9167**| 0.8743
|
137 |
+
| **Albertina-PT-BR** | 0.7545 | 0.4601 | 0.9071 | **0.8910** |
|
138 |
+
| BERTimbau-large | 0.6546 | **0.5634** | 0.8870 | 0.8842 |
|
139 |
| | | | | |
|
140 |
+
| **Albertina-PT-PT** | **0.7960** | 0.4507 | 0.9151 | 0.8799 |
|
141 |
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
<br>
|
145 |
|
|
|
149 |
|
150 |
```python
|
151 |
>>> from transformers import pipeline
|
152 |
+
>>> unmasker = pipeline('fill-mask', model='PORTULAN/albertina-ptbr-nobrwac')
|
153 |
>>> unmasker("A culinária brasileira é rica em sabores e [MASK], tornando-se um dos maiores patrimônios do país.")
|
154 |
|
155 |
+
[{'score': 0.3866911828517914, 'token': 23395, 'token_str': 'aromas', 'sequence': 'A culinária brasileira é rica em sabores e aromas, tornando-se um dos maiores patrimônios do país.'},
|
156 |
+
{'score': 0.2926434874534607, 'token': 10392, 'token_str': 'costumes', 'sequence': 'A culinária brasileira é rica em sabores e costumes, tornando-se um dos maiores patrimônios do país.'},
|
157 |
+
{'score': 0.1913347691297531, 'token': 21925, 'token_str': 'cores', 'sequence': 'A culinária brasileira é rica em sabores e cores, tornando-se um dos maiores patrimônios do país.'},
|
158 |
+
{'score': 0.06453365087509155, 'token': 117371, 'token_str': 'cultura', 'sequence': 'A culinária brasileira é rica em sabores e cultura, tornando-se um dos maiores patrimônios do país.'},
|
159 |
+
{'score': 0.019388679414987564, 'token': 22647, 'token_str': 'nuances', 'sequence': 'A culinária brasileira é rica em sabores e nuances, tornando-se um dos maiores patrimônios do país.'}]
|
160 |
|
161 |
|
162 |
```
|
|
|
167 |
>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer
|
168 |
>>> from datasets import load_dataset
|
169 |
|
170 |
+
>>> model = AutoModelForSequenceClassification.from_pretrained("PORTULAN/albertina-ptbr-nobrwac", num_labels=2)
|
171 |
>>> tokenizer = AutoTokenizer.from_pretrained("PORTULAN/albertina-ptbr")
|
172 |
>>> dataset = load_dataset("PORTULAN/glue-ptpt", "rte")
|
173 |
|