muxitox commited on
Commit
8da8e89
1 Parent(s): 4ed7ea1

First commit

Browse files
README.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - es
4
+ license: apache-2.0
5
+ tags:
6
+ - "longformer"
7
+ - "national library of spain"
8
+ - "spanish"
9
+ - "bne"
10
+ datasets:
11
+ - "bne"
12
+ widget:
13
+ - text: "Este año las campanadas de La Sexta las presentará <mask>."
14
+ - text: "David Broncano es un presentador de La <mask>."
15
+ - text: "Gracias a los datos de la BNE se ha podido <mask> este modelo del lenguaje."
16
+ - text: "Hay base legal dentro del marco <mask> actual."
17
+
18
+ ---
19
+
20
+ # Longformer base trained with data from National Library of Spain (BNE)
21
+
22
+ ## Model Description
23
+ The longformer-base-4096-bne-es is the [Longformer](https://huggingface.co/allenai/longformer-base-4096) version of the [roberta-base-bne](https://https://huggingface.co/PlanTL-GOB-ES/roberta-base-bne) masked language model for the Spanish language. The model started from the **roberta-base-bne** checkpoint and was pretrained for MLM on long documents from our biomedical and clinical corpora.
24
+
25
+ ## Intended Uses and Limitations
26
+ The longformer-base-4096-biomedical-clinical-es 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).
27
+
28
+ However, it is intended to be fine-tuned on non-generative downstream tasks such as Question Answering, Text Classification, or Named Entity Recognition.
29
+
30
+ ## How to Use
31
+
32
+ Here is how to use this model:
33
+
34
+ ```python
35
+ from transformers import AutoModelForMaskedLM
36
+ from transformers import AutoTokenizer, FillMaskPipeline
37
+ from pprint import pprint
38
+ tokenizer_hf = AutoTokenizer.from_pretrained('PlanTL-GOB-ES/longformer-base-4096-bne-es')
39
+ model = AutoModelForMaskedLM.from_pretrained('PlanTL-GOB-ES/longformer-base-4096-bne-es')
40
+ model.eval()
41
+ pipeline = FillMaskPipeline(model, tokenizer_hf)
42
+ text = f"Hay base legal dentro del marco <mask> actual."
43
+ res_hf = pipeline(text)
44
+ pprint([r['token_str'] for r in res_hf])
45
+ ```
46
+
47
+ ## Limitations and bias
48
+
49
+ At the time of submission, no measures have been taken to estimate the bias and toxicity 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.
50
+
51
+ ## Training corpora and preprocessing
52
+ The [National Library of Spain (Biblioteca Nacional de España)](http://www.bne.es/en/Inicio/index.html) crawls all .es domains once a year. The training corpus consists of 59TB of WARC files from these crawls, carried out from 2009 to 2019.
53
+
54
+ To obtain a high-quality training corpus, the corpus has been preprocessed with a pipeline of operations, including among the others, sentence splitting, language detection, filtering of bad-formed sentences and deduplication of repetitive contents. During the process document boundaries are kept. This resulted into 2TB of Spanish clean corpus. Further global deduplication among the corpus is applied, resulting into 570GB of text.
55
+
56
+ Some of the statistics of the corpus:
57
+
58
+ | Corpora | Number of documents | Number of tokens | Size (GB) |
59
+ |---------|---------------------|------------------|-----------|
60
+ | BNE | 201,080,084 | 135,733,450,668 | 570GB |
61
+
62
+ For this Longformer, we have used a small random partition of 7,2GB containing documents with less than 4096 tokens as a training split.
63
+
64
+ ## Tokenization and pre-training
65
+ 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 40 hours with 8 computing nodes each one with 2 AMD MI50 GPUs of 32GB VRAM.
66
+
67
+
68
+ ## Copyright
69
+
70
+ Copyright by the Spanish State Secretariat for Digitalization and Artificial Intelligence (SEDIA) (2022)
71
+
72
+ ## Licensing information
73
+
74
+ [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
75
+
76
+ ## Funding
77
+
78
+ This work was funded by the Spanish State Secretariat for Digitalization and Artificial Intelligence (SEDIA) within the framework of the Plan-TL.
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/gpfs/projects/bsc88/temutauro/apoc/longformer//results/longformer/bne/NNODES_8_GRADIENT-ACCUM_1_steps_65000_lr_0.00003_seed_1_DATA-AGGREGATION_SEPARATE_date_22-10-31_ID_288683/output/longformer-base-4096",
3
+ "architectures": [
4
+ "LongformerForMaskedLM"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "attention_window": [
8
+ 512,
9
+ 512,
10
+ 512,
11
+ 512,
12
+ 512,
13
+ 512,
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512,
19
+ 512
20
+ ],
21
+ "bos_token_id": 0,
22
+ "classifier_dropout": null,
23
+ "eos_token_id": 2,
24
+ "hidden_act": "gelu",
25
+ "hidden_dropout_prob": 0.1,
26
+ "hidden_size": 768,
27
+ "initializer_range": 0.02,
28
+ "intermediate_size": 3072,
29
+ "layer_norm_eps": 1e-05,
30
+ "max_position_embeddings": 4098,
31
+ "model_type": "longformer",
32
+ "num_attention_heads": 12,
33
+ "num_hidden_layers": 12,
34
+ "pad_token_id": 1,
35
+ "position_embedding_type": "absolute",
36
+ "sep_token_id": 2,
37
+ "torch_dtype": "float32",
38
+ "transformers_version": "4.20.1",
39
+ "type_vocab_size": 1,
40
+ "use_cache": true,
41
+ "vocab_size": 50262
42
+ }
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:b2db80c8e4711ecb80a7265254181303cf0abeb382f89ab2d68f0ee0890609c2
3
+ size 594958683
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": {
4
+ "__type": "AddedToken",
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false
10
+ },
11
+ "cls_token": {
12
+ "__type": "AddedToken",
13
+ "content": "<s>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false
18
+ },
19
+ "eos_token": {
20
+ "__type": "AddedToken",
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false
26
+ },
27
+ "errors": "replace",
28
+ "mask_token": {
29
+ "__type": "AddedToken",
30
+ "content": "<mask>",
31
+ "lstrip": true,
32
+ "normalized": true,
33
+ "rstrip": false,
34
+ "single_word": false
35
+ },
36
+ "max_len": 512,
37
+ "model_max_length": 4096,
38
+ "name_or_path": "/gpfs/projects/bsc88/temutauro/apoc/longformer//results/longformer/bne/NNODES_8_GRADIENT-ACCUM_1_steps_65000_lr_0.00003_seed_1_DATA-AGGREGATION_SEPARATE_date_22-10-31_ID_288683/output/roberta-base-4096",
39
+ "pad_token": {
40
+ "__type": "AddedToken",
41
+ "content": "<pad>",
42
+ "lstrip": false,
43
+ "normalized": true,
44
+ "rstrip": false,
45
+ "single_word": false
46
+ },
47
+ "sep_token": {
48
+ "__type": "AddedToken",
49
+ "content": "</s>",
50
+ "lstrip": false,
51
+ "normalized": true,
52
+ "rstrip": false,
53
+ "single_word": false
54
+ },
55
+ "special_tokens_map_file": null,
56
+ "tokenizer_class": "RobertaTokenizer",
57
+ "trim_offsets": true,
58
+ "unk_token": {
59
+ "__type": "AddedToken",
60
+ "content": "<unk>",
61
+ "lstrip": false,
62
+ "normalized": true,
63
+ "rstrip": false,
64
+ "single_word": false
65
+ }
66
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af6e502c540313387322cb92bd8cb73640347ed77a7455ae0d72cc6f3940071e
3
+ size 3759
vocab.json ADDED
The diff for this file is too large to render. See raw diff