joanllop commited on
Commit
08c2ea5
1 Parent(s): 3222ad2

MLDoc best base model

Browse files
README.md CHANGED
@@ -1,3 +1,187 @@
1
  ---
 
 
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+
4
+ - es
5
+
6
  license: apache-2.0
7
+
8
+ tags:
9
+
10
+ - "national library of spain"
11
+ - "spanish"
12
+ - "bne"
13
+ - "PlanTL-GOB-ES/MLDoc"
14
+ - "text-classification"
15
+
16
+ datasets:
17
+
18
+ - "PlanTL-GOB-ES/MLDoc"
19
+
20
+ metrics:
21
+ - "f1"
22
+
23
+ model-index:
24
+ - name: roberta-base-bne-mldoc
25
+ results:
26
+ - task:
27
+ type: text-classification
28
+ dataset:
29
+ type: mldoc
30
+ name: PlanTL-GOB-ES/MLDoc
31
+ metrics:
32
+ - name: F1
33
+ type: f1
34
+ value: 0.9664
35
+
36
+
37
+ widget:
38
+
39
+ - ' FRANCFORT, 17 feb (Reuter) - La Bolsa de Francfort abrió la sesión de corros con baja por la caída del viernes en Wall Street y una toma de beneficios. El dólar ayudaba a apuntalar al mercado, que pronto podría reanudar su tendencia alcista. Volkswagen bajaba por los daños ocasionados por la huelga de camioneros en España. Preussag participaba en un joint venture de exploración petrolífera en Filipinas con Atlantic Richfield Co. A las 0951 GMT, el Dax 30 bajaba 10,49 puntos, un 0,32 pct, a 3.237,69 tras abrir a un máximo de 3.237,69. (c) Reuters Limited 1997. '
40
+
41
  ---
42
+
43
+ # Spanish RoBERTa-base trained on BNE finetuned for the Spanish portion of the MLDoc dataset.
44
+
45
+ ## Table of contents
46
+ <details>
47
+ <summary>Click to expand</summary>
48
+
49
+ - [Model description](#model-description)
50
+ - [Intended uses and limitations](#intended-use)
51
+ - [How to use](#how-to-use)
52
+ - [Limitations and bias](#limitations-and-bias)
53
+ - [Training](#training)
54
+ - [Training](#training)
55
+ - [Training data](#training-data)
56
+ - [Training procedure](#training-procedure)
57
+ - [Evaluation](#evaluation)
58
+ - [Evaluation](#evaluation)
59
+ - [Variable and metrics](#variable-and-metrics)
60
+ - [Evaluation results](#evaluation-results)
61
+ - [Additional information](#additional-information)
62
+ - [Author](#author)
63
+ - [Contact information](#contact-information)
64
+ - [Copyright](#copyright)
65
+ - [Licensing information](#licensing-information)
66
+ - [Funding](#funding)
67
+ - [Citing information](#citing-information)
68
+ - [Disclaimer](#disclaimer)
69
+
70
+ </details>
71
+
72
+ ## Model description
73
+ The **roberta-base-bne-mldoc** is a text classification model for the Spanish language fine-tuned from the [roberta-base-bne](https://huggingface.co/PlanTL-GOB-ES/roberta-base-bne) model, a [RoBERTa](https://arxiv.org/abs/1907.11692) base model pre-trained using the largest Spanish corpus known to date, with a total of 570GB of clean and deduplicated text, processed for this work, compiled from the web crawlings performed by the [National Library of Spain (Biblioteca Nacional de España)](http://www.bne.es/en/Inicio/index.html) from 2009 to 2019.
74
+ The finetuning corpus consists of 14,458 news articles from Reuters classified in four categories: CCAT (Corporate/Industrial), ECAT (Economics), GCAT (Government/Social) and MCAT (Markets).
75
+
76
+
77
+
78
+ ## Intended uses and limitations
79
+
80
+ **roberta-base-bne-mldoc** model can be used to classify texts into four hierarchical groups: CCAT (Corporate/Industrial), ECAT (Economics), GCAT (Government/Social) and MCAT (Markets). The model is limited by its training dataset (news stories) and may not generalize well for all use cases.
81
+
82
+
83
+ ## How to use
84
+
85
+ Here is how to use this model:
86
+
87
+ ```python
88
+ from transformers import pipeline
89
+ from pprint import pprint
90
+
91
+ nlp = pipeline("text-classification", model="PlanTL-GOB-ES/roberta-base-bne-mldoc")
92
+ example = ' FRANCFORT, 17 feb (Reuter) - La Bolsa de Francfort abrió la sesión de corros con baja por la caída del viernes en Wall Street y una toma de beneficios. El dólar ayudaba a apuntalar al mercado, que pronto podría reanudar su tendencia alcista. Volkswagen bajaba por los daños ocasionados por la huelga de camioneros en España. Preussag participaba en un joint venture de exploración petrolífera en Filipinas con Atlantic Richfield Co. A las 0951 GMT, el Dax 30 bajaba 10,49 puntos, un 0,32 pct, a 3.237,69 tras abrir a un máximo de 3.237,69. (c) Reuters Limited 1997. '
93
+
94
+ results = nlp(example)
95
+ pprint(results)
96
+ ```
97
+
98
+ ## Limitations and bias
99
+ 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 corpora 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.
100
+
101
+ ## Training
102
+
103
+ For training and evaluation we used the Spanish portion of the Multilingual Document Classification Corpus (MLDoc) [(Schwenk and Li, 2018)](http://www.lrec-conf.org/proceedings/lrec2018/pdf/658.pdf), a cross-lingual document classification dataset covering 8 languages.
104
+
105
+ ### Training procedure
106
+ The model was trained with a batch size of 32 and a learning rate of 1e-5 for 5 epochs. We then selected the best checkpoint using the downstream task metric in the corresponding development set and then evaluated it on the test set.
107
+
108
+
109
+ ## Evaluation
110
+
111
+ ### Variable and metrics
112
+
113
+ This model was finetuned maximizing F1.
114
+
115
+ ## Evaluation results
116
+ We evaluated the *roberta-base-bne-mldoc* on the XNLI test set against standard multilingual and monolingual baselines:
117
+
118
+
119
+ | Model | MLDoc (F1) |
120
+ | ------------|:----|
121
+ | roberta-base-bne | 96.64 |
122
+ | roberta-large-bne | 97.02 |
123
+ | BETO | **97.14** |
124
+ | mBERT | 96.17 |
125
+ | BERTIN | 96.68 |
126
+ | ELECTRA | 95.65 |
127
+
128
+ For more details, check the fine-tuning and evaluation scripts in the official [GitHub repository](https://github.com/PlanTL-GOB-ES/lm-spanish).
129
+
130
+
131
+ ## Additional information
132
+
133
+ ### Author
134
+ Text Mining Unit (TeMU) at the Barcelona Supercomputing Center (bsc-temu@bsc.es)
135
+
136
+ ### Contact information
137
+ For further information, send an email to <plantl-gob-es@bsc.es>
138
+
139
+ ### Copyright
140
+ Copyright by the Spanish State Secretariat for Digitalization and Artificial Intelligence (SEDIA) (2022)
141
+
142
+ ### Licensing information
143
+ [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
144
+
145
+ ### Funding
146
+ This work was funded by the Spanish State Secretariat for Digitalization and Artificial Intelligence (SEDIA) within the framework of the Plan-TL.
147
+
148
+ ## Citing information
149
+
150
+ If you use this model, please cite our [paper](http://journal.sepln.org/sepln/ojs/ojs/index.php/pln/article/view/6405):
151
+ ```
152
+ @article{,
153
+ abstract = {We want to thank the National Library of Spain for such a large effort on the data gathering and the Future of Computing Center, a
154
+ Barcelona Supercomputing Center and IBM initiative (2020). This work was funded by the Spanish State Secretariat for Digitalization and Artificial
155
+ Intelligence (SEDIA) within the framework of the Plan-TL.},
156
+ author = {Asier Gutiérrez Fandiño and Jordi Armengol Estapé and Marc Pàmies and Joan Llop Palao and Joaquin Silveira Ocampo and Casimiro Pio Carrino and Carme Armentano Oller and Carlos Rodriguez Penagos and Aitor Gonzalez Agirre and Marta Villegas},
157
+ doi = {10.26342/2022-68-3},
158
+ issn = {1135-5948},
159
+ journal = {Procesamiento del Lenguaje Natural},
160
+ keywords = {Artificial intelligence,Benchmarking,Data processing.,MarIA,Natural language processing,Spanish language modelling,Spanish language resources,Tractament del llenguatge natural (Informàtica),Àrees temàtiques de la UPC::Informàtica::Intel·ligència artificial::Llenguatge natural},
161
+ publisher = {Sociedad Española para el Procesamiento del Lenguaje Natural},
162
+ title = {MarIA: Spanish Language Models},
163
+ volume = {68},
164
+ url = {https://upcommons.upc.edu/handle/2117/367156#.YyMTB4X9A-0.mendeley},
165
+ year = {2022},
166
+ }
167
+
168
+ ```
169
+
170
+ ## Disclaimer
171
+
172
+ <details>
173
+ <summary>Click to expand</summary>
174
+
175
+ 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.
176
+
177
+ 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.
178
+
179
+ In no event shall the owner of the models (SEDIA – State Secretariat for digitalization and artificial intelligence) nor the creator (BSC – Barcelona Supercomputing Center) be liable for any results arising from the use made by third parties of these models.
180
+
181
+
182
+ Los modelos publicados en este repositorio tienen una finalidad generalista y están a disposición de terceros. Estos modelos pueden tener sesgos y/u otro tipo de distorsiones indeseables.
183
+
184
+ Cuando terceros desplieguen o proporcionen sistemas y/o servicios a otras partes usando alguno de estos modelos (o utilizando sistemas basados en estos modelos) o se conviertan en usuarios de los modelos, deben tener en cuenta que es su responsabilidad mitigar los riesgos derivados de su uso y, en todo caso, cumplir con la normativa aplicable, incluyendo la normativa en materia de uso de inteligencia artificial.
185
+
186
+ En ningún caso el propietario de los modelos (SEDIA – Secretaría de Estado de Digitalización e Inteligencia Artificial) ni el creador (BSC – Barcelona Supercomputing Center) serán responsables de los resultados derivados del uso que hagan terceros de estos modelos.
187
+ </details>
config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "PlanTL-GOB-ES/roberta-base-bne",
3
+ "architectures": [
4
+ "RobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "bos_token_id": 0,
8
+ "eos_token_id": 2,
9
+ "finetuning_task": "mldocs",
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.0,
13
+ "hidden_size": 768,
14
+ "id2label": {
15
+ "0": "MCAT",
16
+ "1": "GCAT",
17
+ "2": "ECAT",
18
+ "3": "CCAT"
19
+ },
20
+ "initializer_range": 0.02,
21
+ "intermediate_size": 3072,
22
+ "label2id": {
23
+ "MCAT": 0,
24
+ "GCAT": 1,
25
+ "ECAT": 2,
26
+ "CCAT": 3
27
+ },
28
+ "layer_norm_eps": 1e-05,
29
+ "max_position_embeddings": 514,
30
+ "model_type": "roberta",
31
+ "num_attention_heads": 12,
32
+ "num_hidden_layers": 12,
33
+ "pad_token_id": 1,
34
+ "position_embedding_type": "absolute",
35
+ "problem_type": "single_label_classification",
36
+ "transformers_version": "4.6.1",
37
+ "type_vocab_size": 1,
38
+ "use_cache": true,
39
+ "vocab_size": 50262
40
+ }
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:2ab3ca62513aeb9e6b393703dd429c8568621b7fbdfcf448ca81621cb94e3c87
3
+ size 498671021
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
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": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "add_prefix_space": false, "errors": "replace", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": "<mask>", "special_tokens_map_file": null, "name_or_path": "./", "tokenizer_class": "RobertaTokenizer"}
vocab.json ADDED
The diff for this file is too large to render. See raw diff