gonzalez-agirre commited on
Commit
6efed62
1 Parent(s): fe621e1

Model uploaded

Browse files
README.md CHANGED
@@ -1,3 +1,218 @@
1
  ---
 
 
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+
4
+ - ca
5
+
6
  license: apache-2.0
7
+
8
+ tags:
9
+
10
+ - "catalan"
11
+
12
+ - "masked-lm"
13
+
14
+ - "RoBERTa-large-ca"
15
+
16
+ - "CaText"
17
+
18
+ - "Catalan Textual Corpus"
19
+
20
+ widget:
21
+ - text: "El Català és una llengua molt <mask>."
22
+ - text: "Salvador Dalí va viure a <mask>."
23
+ - text: "La Costa Brava té les millors <mask> d'Espanya."
24
+ - text: "El cacaolat és un batut de <mask>."
25
+ - text: "<mask> és la capital de la Garrotxa."
26
+ - text: "Vaig al <mask> a buscar bolets."
27
+ - text: "Antoni Gaudí vas ser un <mask> molt important per la ciutat."
28
+ - text: "Catalunya és una referència en <mask> a nivell europeu."
29
+
30
  ---
31
+
32
+ # Catalan BERTa (roberta-large-ca) large model
33
+
34
+ ## Table of Contents
35
+ <details>
36
+ <summary>Click to expand</summary>
37
+
38
+ - [Model Description](#model-description)
39
+ - [Intended Uses and Limitations](#intended-uses-and-limitations)
40
+ - [How to Use](#how-to-use)
41
+ - [Training](#training)
42
+ - [Training Data](#training-data)
43
+ - [Training Procedure](#training-procedure)
44
+ - [Evaluation](#evaluation)
45
+ - [CLUB Benchmark](#club-benchmark)
46
+ - [Evaluation Results](#evaluation-results)
47
+ - [Licensing Information](#licensing-information)
48
+ - [Citation Information](#citation-information)
49
+ - [Funding](#funding)
50
+ - [Contributions](#contributions)
51
+
52
+ </details>
53
+
54
+ ## Model description
55
+
56
+ The **roberta-large-ca** is a transformer-based masked language model for the Catalan language.
57
+ It is based on the [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) large model
58
+ and has been trained on a medium-size corpus collected from publicly available corpora and crawlers.
59
+
60
+ ## Intended Uses and Limitations
61
+
62
+ **roberta-large-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).
63
+ However, it is intended to be fine-tuned on non-generative downstream tasks such as Question Answering, Text Classification, or Named Entity Recognition.
64
+
65
+ ## How to Use
66
+
67
+ Here is how to use this model:
68
+
69
+ ```python
70
+ from transformers import AutoModelForMaskedLM
71
+ from transformers import AutoTokenizer, FillMaskPipeline
72
+ from pprint import pprint
73
+ tokenizer_hf = AutoTokenizer.from_pretrained('projecte-aina/roberta-large-ca')
74
+ model = AutoModelForMaskedLM.from_pretrained('projecte-aina/roberta-large-ca')
75
+ model.eval()
76
+ pipeline = FillMaskPipeline(model, tokenizer_hf)
77
+ text = f"Em dic <mask>."
78
+ res_hf = pipeline(text)
79
+ pprint([r['token_str'] for r in res_hf])
80
+ ```
81
+
82
+ ## Training
83
+
84
+ ### Training data
85
+
86
+ The training corpus consists of several corpora gathered from web crawling and public corpora.
87
+
88
+
89
+ | Corpus | Size in GB |
90
+ |-------------------------|------------|
91
+ | Catalan Crawling | 13.00 |
92
+ | Wikipedia | 1.10 |
93
+ | DOGC | 0.78 |
94
+ | Catalan Open Subtitles | 0.02 |
95
+ | Catalan Oscar | 4.00 |
96
+ | CaWaC | 3.60 |
97
+ | Cat. General Crawling | 2.50 |
98
+ | Cat. Goverment Crawling | 0.24 |
99
+ | ACN | 0.42 |
100
+ | Padicat | 0.63 |
101
+ | RacoCatalá | 8.10 |
102
+ | Nació Digital | 0.42 |
103
+ | Vilaweb | 0.06 |
104
+ | Tweets | 0.02 |
105
+
106
+ ### Training Procedure
107
+
108
+ The training corpus has been tokenized using a byte version of [Byte-Pair Encoding (BPE)](https://github.com/openai/gpt-2)
109
+ used in the original [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model with a vocabulary size of 52,000 tokens.
110
+ The RoBERTa-large pretraining consists of a masked language model training that follows the approach employed for the RoBERTa large model
111
+ with the same hyperparameters as in the original work.
112
+ The training lasted a total of 96 hours with 32 NVIDIA V100 GPUs of 16GB DDRAM.
113
+
114
+
115
+ ## Evaluation
116
+
117
+ ### CLUB Benchmark
118
+
119
+ The BERTa-large model has been fine-tuned on the downstream tasks of the Catalan Language Understanding Evaluation benchmark (CLUB),
120
+ that has been created along with the model.
121
+
122
+ It contains the following tasks and their related datasets:
123
+
124
+ 1. Named Entity Recognition (NER)
125
+
126
+
127
+ **[NER (AnCora)](https://zenodo.org/record/4762031#.YKaFjqGxWUk)**: extracted named entities from the original [Ancora](https://doi.org/10.5281/zenodo.4762030) version,
128
+ filtering out some unconventional ones, like book titles, and transcribed them into a standard CONLL-IOB format
129
+
130
+
131
+ 2. Part-of-Speech Tagging (POS)
132
+
133
+ **[POS (AnCora)](https://zenodo.org/record/4762031#.YKaFjqGxWUk)**: from the [Universal Dependencies treebank](https://github.com/UniversalDependencies/UD_Catalan-AnCora) of the well-known Ancora corpus.
134
+
135
+ 3. Text Classification (TC)
136
+
137
+ **[TeCla](https://huggingface.co/datasets/projecte-aina/tecla)**: consisting of 137k news pieces from the Catalan News Agency ([ACN](https://www.acn.cat/)) corpus, with 30 labels.
138
+
139
+ 4. Textual Entailment (TE)
140
+
141
+ **[TE-ca](https://huggingface.co/datasets/projecte-aina/teca)**: consisting of 21,163 pairs of premises and hypotheses, annotated according to the inference relation they have (implication, contradiction, or neutral), extracted from the [Catalan Textual Corpus](https://huggingface.co/datasets/projecte-aina/catalan_textual_corpus).
142
+
143
+ 5. Semantic Textual Similarity (STS)
144
+
145
+ **[STS-ca](https://huggingface.co/datasets/projecte-aina/sts-ca)**: consisting of more than 3000 sentence pairs, annotated with the semantic similarity between them, scraped from the [Catalan Textual Corpus](https://huggingface.co/datasets/projecte-aina/catalan_textual_corpus).
146
+
147
+ 6. Question Answering (QA):
148
+
149
+ **[VilaQuAD](https://huggingface.co/datasets/projecte-aina/vilaquad)**: contains 6,282 pairs of questions and answers, outsourced from 2095 Catalan language articles from VilaWeb newswire text.
150
+
151
+ **[ViquiQuAD](https://huggingface.co/datasets/projecte-aina/viquiquad)**: consisting of more than 15,000 questions outsourced from Catalan Wikipedia randomly chosen from a set of 596 articles that were originally written in Catalan.
152
+
153
+ **[CatalanQA](https://huggingface.co/datasets/projecte-aina/catalanqa)**: an aggregation of 2 previous datasets (VilaQuAD and ViquiQuAD), 21,427 pairs of Q/A balanced by type of question, containing one question and one answer per context, although the contexts can repeat multiple times.
154
+
155
+ **[XQuAD-ca](https://huggingface.co/datasets/projecte-aina/xquad-ca)**: the Catalan translation of XQuAD, a multilingual collection of manual translations of 1,190 question-answer pairs from English Wikipedia used only as a _test set_.
156
+
157
+ Here are the train/dev/test splits of the datasets:
158
+
159
+ | Task (Dataset) | Total | Train | Dev | Test |
160
+ |:--|:--|:--|:--|:--|
161
+ | NER (Ancora) |13,581 | 10,628 | 1,427 | 1,526 |
162
+ | POS (Ancora)| 16,678 | 13,123 | 1,709 | 1,846 |
163
+ | STS (STS-ca) | 3,073 | 2,073 | 500 | 500 |
164
+ | TC (TeCla) | 137,775 | 110,203 | 13,786 | 13,786|
165
+ | TE (TE-ca) | 21,163 | 16,930 | 2,116 | 2,117
166
+ | QA (VilaQuAD) | 6,282 | 3,882 | 1,200 | 1,200 |
167
+ | QA (ViquiQuAD) | 14,239 | 11,255 | 1,492 | 1,429 |
168
+ | QA (CatalanQA) | 21,427 | 17,135 | 2,157 | 2,135 |
169
+
170
+ ### Evaluation Results
171
+
172
+ | Task | NER (F1) | POS (F1) | STS-ca (Comb) | TeCla (Acc.) | TEca (Acc.) | VilaQuAD (F1/EM)| ViquiQuAD (F1/EM) | CatalanQA (F1/EM) | XQuAD-ca <sup>1</sup> (F1/EM) |
173
+ | ------------|:-------------:| -----:|:------|:------|:-------|:------|:----|:----|:----|
174
+ | RoBERTa-large-ca | **89.82** | **99.02** | **83.41** | **75.46** | **83.61** | **89.34**/75.50 | **89.20**/75.77 | **90.72/79.06** | **73.79**/55.34 |
175
+ | RoBERTa-base-ca-v2 | 89.29 | 98.96 | 79.07 | 74.26 | 83.14 | 87.74/72.58 | 88.72/**75.91** | 89.50/76.63 | 73.64/**55.42** |
176
+ | BERTa | 89.76 | 98.96 | 80.19 | 73.65 | 79.26 | 85.93/70.58 | 87.12/73.11 | 89.17/77.14 | 69.20/51.47 |
177
+ | mBERT | 86.87 | 98.83 | 74.26 | 69.90 | 74.63 | 82.78/67.33 | 86.89/73.53 | 86.90/74.19 | 68.79/50.80 |
178
+ | XLM-RoBERTa | 86.31 | 98.89 | 61.61 | 70.14 | 33.30 | 86.29/71.83 | 86.88/73.11 | 88.17/75.93 | 72.55/54.16 |
179
+
180
+ <sup>1</sup> : Trained on CatalanQA, tested on XQuAD-ca.
181
+
182
+ ## Licensing Information
183
+
184
+ [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
185
+
186
+ ## Citation Information
187
+
188
+ If you use any of these resources (datasets or models) in your work, please cite our latest paper:
189
+ ```bibtex
190
+ @inproceedings{armengol-estape-etal-2021-multilingual,
191
+ title = "Are Multilingual Models the Best Choice for Moderately Under-resourced Languages? {A} Comprehensive Assessment for {C}atalan",
192
+ author = "Armengol-Estap{\'e}, Jordi and
193
+ Carrino, Casimiro Pio and
194
+ Rodriguez-Penagos, Carlos and
195
+ de Gibert Bonet, Ona and
196
+ Armentano-Oller, Carme and
197
+ Gonzalez-Agirre, Aitor and
198
+ Melero, Maite and
199
+ Villegas, Marta",
200
+ booktitle = "Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021",
201
+ month = aug,
202
+ year = "2021",
203
+ address = "Online",
204
+ publisher = "Association for Computational Linguistics",
205
+ url = "https://aclanthology.org/2021.findings-acl.437",
206
+ doi = "10.18653/v1/2021.findings-acl.437",
207
+ pages = "4933--4946",
208
+ }
209
+ ```
210
+
211
+ ### Funding
212
+
213
+ 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).
214
+
215
+ ## Contributions
216
+
217
+ [N/A]
218
+
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "RobertaForMaskedLM"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 1024,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 4096,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "roberta",
17
+ "num_attention_heads": 16,
18
+ "num_hidden_layers": 24,
19
+ "pad_token_id": 1,
20
+ "position_embedding_type": "absolute",
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.20.1",
23
+ "type_vocab_size": 1,
24
+ "use_cache": true,
25
+ "vocab_size": 50262
26
+ }
dict.txt ADDED
The diff for this file is too large to render. See raw diff
 
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb19948b086142bf513a7ad2d818c42e57edb5bfd8032c832130f5837584abfb
3
+ size 1421767851
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "add_prefix_space": true, "errors": "replace", "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "max_len": 512, "special_tokens_map_file": null, "name_or_path": "/gpfs/projects/bsc88/tools/corpus-utils-lm/17-06-2021-python/output/jsc_ca_output/roberta-2022-03-21-1502-3a6a-69ad/train_tokenizer_output_fix/train-tokenizer-2022-03-21-1502-3a6a-0e8b"}
vocab.json ADDED
The diff for this file is too large to render. See raw diff