jarodrigues commited on
Commit
e2e9c15
1 Parent(s): 7932ecf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +201 -0
README.md CHANGED
@@ -1,3 +1,204 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: mit
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - pt
4
+ tags:
5
+ - albertina-pt*
6
+ - albertina-ptpt
7
+ - albertina-ptbr
8
+ - albertina-ptpt-base
9
+ - albertina-ptbr-base
10
+ - albertina-1b5-portuguese-ptpt
11
+ - albertina-1b5-portuguese-ptbr
12
+ - fill-mask
13
+ - bert
14
+ - deberta
15
+ - portuguese
16
+ - encoder
17
+ - foundation model
18
  license: mit
19
+ datasets:
20
+ - PORTULAN/glue-ptpt
21
+ widget:
22
+ - text: >-
23
+ A culinária portuguesa é rica em sabores e [MASK], tornando-se um dos
24
+ maiores tesouros do país.
25
  ---
26
+ ---
27
+ <img align="left" width="40" height="40" src="https://github.githubassets.com/images/icons/emoji/unicode/1f917.png">
28
+ <p style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;This is the model card for Albertina 1.5 billion PT-PT
29
+ You may be interested in some of the other models in the <a href="https://huggingface.co/PORTULAN">Albertina (encoders) and Gervásio (decoders) families</a>.
30
+ </p>
31
+
32
+ ---
33
+
34
+ # Albertina 1.5B PT-PT
35
+
36
+
37
+ **Albertina 1.5B PT-PT** is a foundation, large language model for European **Portuguese** from **Portugal**.
38
+
39
+ It is an **encoder** of the BERT family, based on the neural architecture Transformer and
40
+ developed over the DeBERTa model, with most competitive performance for this language.
41
+ It has different versions that were trained for different variants of Portuguese (PT),
42
+ namely the European variant from Portugal (**PT-PT**) and the American variant from Brazil (**PT-BR**),
43
+ and it is distributed free of charge and under a most permissible license.
44
+
45
+ **Albertina 1.5B PT-PT** is the version for European **Portuguese** from **Portugal**,
46
+ and to the best of our knowledge, this is an encoder specifically for this language and variant
47
+ that, at the time of its initial distribution, sets a new state of the art for it, and is made publicly available
48
+ and distributed for reuse.
49
+
50
+ It is an **encoder** of the BERT family, based on the neural architecture Transformer and
51
+ developed over the DeBERTa model, with most competitive performance for this language.
52
+ It is distributed free of charge and under a most permissible license.
53
+
54
+
55
+ **Albertina 1.5B PT-PT base** is developed by a joint team from the University of Lisbon and the University of Porto, Portugal.
56
+ For further details, check the respective [publication](https://arxiv.org/abs/?):
57
+
58
+ ``` latex
59
+ @misc{albertina-pt,
60
+ title={Fostering the Ecosystem of Open Neural Encoders for Portuguese with Albertina PT-* family},
61
+ author={Rodrigo Santos and João Rodrigues and Luís Gomes and João Silva and António Branco and Henrique Lopes Cardoso
62
+ and Tomás Freitas Osório and Bernardo Leite},
63
+ year={2024},
64
+ eprint={?},
65
+ archivePrefix={arXiv},
66
+ primaryClass={cs.CL}
67
+ }
68
+ ```
69
+
70
+ Please use the above cannonical reference when using or citing this model.
71
+
72
+ <br>
73
+
74
+
75
+ # Model Description
76
+
77
+ **This model card is for Albertina 1.5B PT-PT**, with 1.5 billion parameters, 48 layers and a hidden size of 1536.
78
+
79
+ Albertina-PT-PT base is distributed under an [MIT license](https://huggingface.co/PORTULAN/albertina-ptpt/blob/main/LICENSE).
80
+
81
+ DeBERTa is distributed under an [MIT license](https://github.com/microsoft/DeBERTa/blob/master/LICENSE).
82
+
83
+
84
+ <br>
85
+
86
+ # Training Data
87
+
88
+ [**Albertina 1.5B PT-PT**](https://huggingface.co/PORTULAN/albertina-ptpt-base) was trained over a 4 billion token data set that resulted from gathering some openly available corpora of European Portuguese from the following sources:
89
+
90
+ - [CulturaX](https://huggingface.co/datasets/uonlp/CulturaX): the CulturaX is a multilingual corpus, freely available for research and AI development, created by combining and extensively cleaning two other large datasets, mC4 and OSCAR. 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.
91
+ - [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&#39;s official website. We retained its European Portuguese portion.
92
+ - [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.
93
+ - [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.
94
+
95
+
96
+ ## Preprocessing
97
+
98
+ We filtered the PT-PT corpora using the [BLOOM pre-processing](https://github.com/bigscience-workshop/data-preparation) pipeline.
99
+ 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.
100
+
101
+
102
+ ## Training
103
+
104
+ As codebase, we resorted to the [DeBERTa V2 xxlarge](https://huggingface.co/microsoft/deberta-v2-xxlarge), for English.
105
+
106
+ To train **Albertina 1.5B PT-PT**, the data set was tokenized with the original DeBERTa tokenizer with a 128-token sequence truncation and dynamic padding for 250k steps,
107
+ a 256-token sequence-truncation for 80k steps and finally a 512-token sequence-truncation for 60k steps.
108
+ These steps correspond to the equivalent setup of 48 hours on a2-megagpu-16gb Google Cloud A2 node for the 128-token input sequences, 24 hours of computation for the 256-token
109
+ input sequences and 24 hours of computation for the 512-token input sequences.
110
+ We opted for a learning rate of 1e-5 with linear decay and 10k warm-up steps.
111
+
112
+ <br>
113
+
114
+ # Evaluation
115
+
116
+ The base model version was evaluated on downstream tasks, namely the translations into PT-PT of the English data sets used for a few of the tasks in the widely-used [GLUE benchmark](https://huggingface.co/datasets/glue).
117
+
118
+
119
+ ## GLUE tasks translated
120
+
121
+
122
+ We resorted to [GLUE-PT](https://huggingface.co/datasets/PORTULAN/glue-ptpt), a **PT-PT version of the GLUE** benchmark.
123
+ 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.
124
+
125
+ | Model | RTE (Accuracy) | WNLI (Accuracy)| MRPC (F1) | STS-B (Pearson) |
126
+ |---------------------------|----------------|----------------|-----------|-----------------|
127
+ | **Albertina 1.5B PT-PT** | **0.?** | 0. | **0. **| **0. ** |
128
+ | **Albertina PT-PT(900M)** | 0.8339 | 0.4225 | 0.9171 | 0.8801 |
129
+ | **Albertina 100M PT-PT** | 0.5848 | 0.5634 | 0.8793 | 0.8624 |
130
+
131
+ <br>
132
+
133
+ # How to use
134
+
135
+ You can use this model directly with a pipeline for masked language modeling:
136
+
137
+ ```python
138
+ >>> from transformers import pipeline
139
+ >>> unmasker = pipeline('fill-mask', model='PORTULAN/albertina-1b5-portuguese-ptpt-encoder')
140
+ >>> unmasker("A culinária portuguesa é rica em sabores e [MASK], tornando-se um dos maiores tesouros do país.")
141
+
142
+ [{'score': 0.8332648277282715, 'token': 14690, 'token_str': ' costumes', 'sequence': 'A culinária portuguesa é rica em sabores e costumes, tornando-se um dos maiores tesouros do país.'},
143
+ {'score': 0.07860890030860901, 'token': 29829, 'token_str': ' cores', 'sequence': 'A culinária portuguesa é rica em sabores e cores, tornando-se um dos maiores tesouros do país.'},
144
+ {'score': 0.03278181701898575, 'token': 35277, 'token_str': ' arte', 'sequence': 'A culinária portuguesa é rica em sabores e arte, tornando-se um dos maiores tesouros do país.'},
145
+ {'score': 0.009515956044197083, 'token': 9240, 'token_str': ' cor', 'sequence': 'A culinária portuguesa é rica em sabores e cor, tornando-se um dos maiores tesouros do país.'},
146
+ {'score': 0.009381960146129131, 'token': 33455, 'token_str': ' nuances', 'sequence': 'A culinária portuguesa é rica em sabores e nuances, tornando-se um dos maiores tesouros do país.'}]
147
+
148
+
149
+
150
+ ```
151
+
152
+ The model can be used by fine-tuning it for a specific task:
153
+
154
+ ```python
155
+ >>> from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer
156
+ >>> from datasets import load_dataset
157
+
158
+ >>> model = AutoModelForSequenceClassification.from_pretrained("PORTULAN/albertina-ptpt-base", num_labels=2)
159
+ >>> tokenizer = AutoTokenizer.from_pretrained("PORTULAN/albertina-ptpt-base")
160
+ >>> dataset = load_dataset("PORTULAN/glue-ptpt", "rte")
161
+
162
+ >>> def tokenize_function(examples):
163
+ ... return tokenizer(examples["sentence1"], examples["sentence2"], padding="max_length", truncation=True)
164
+
165
+ >>> tokenized_datasets = dataset.map(tokenize_function, batched=True)
166
+
167
+ >>> training_args = TrainingArguments(output_dir="albertina-ptpt-rte", evaluation_strategy="epoch")
168
+ >>> trainer = Trainer(
169
+ ... model=model,
170
+ ... args=training_args,
171
+ ... train_dataset=tokenized_datasets["train"],
172
+ ... eval_dataset=tokenized_datasets["validation"],
173
+ ... )
174
+
175
+ >>> trainer.train()
176
+
177
+ ```
178
+
179
+ <br>
180
+
181
+ # Citation
182
+
183
+ When using or citing this model, kindly cite the following [publication](https://arxiv.org/abs/?):
184
+
185
+ ``` latex
186
+ @misc{albertina-pt,
187
+ title={Fostering the Ecosystem of Open Neural Encoders for Portuguese with Albertina PT-* family},
188
+ author={Rodrigo Santos and João Rodrigues and Luís Gomes and João Silva and António Branco and Henrique Lopes Cardoso
189
+ and Tomás Freitas Osório and Bernardo Leite},
190
+ year={2024},
191
+ eprint={?},
192
+ archivePrefix={arXiv},
193
+ primaryClass={cs.CL}
194
+ }
195
+ ```
196
+
197
+ <br>
198
+
199
+ # Acknowledgments
200
+
201
+ The research reported here was partially supported by: PORTULAN CLARIN—Research Infrastructure for the Science and Technology of Language,
202
+ funded by Lisboa 2020, Alentejo 2020 and FCT—Fundação para a Ciência e Tecnologia under the
203
+ grant PINFRA/22117/2016; research project ALBERTINA - Foundation Encoder Model for Portuguese and AI, funded by FCT—Fundação para a Ciência e Tecnologia under the
204
+ grant CPCA-IAC/AV/478394/2022; innovation project ACCELERAT.AI - Multilingual Intelligent Contact Centers, funded by IAPMEI, I.P. - Agência para a Competitividade e Inovação under the grant C625734525-00462629, of Plano de Recuperação e Resiliência, call RE-C05-i01.01 – Agendas/Alianças Mobilizadoras para a Reindustrialização; and LIACC - Laboratory for AI and Computer Science, funded by FCT—Fundação para a Ciência e Tecnologia under the grant FCT/UID/CEC/0027/2020.