alvarobartt HF staff commited on
Commit
f18c243
1 Parent(s): 3fd6d0f

Upload model

Browse files
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: span-marker
3
+ tags:
4
+ - span-marker
5
+ - token-classification
6
+ - ner
7
+ - named-entity-recognition
8
+ - generated_from_span_marker_trainer
9
+ metrics:
10
+ - precision
11
+ - recall
12
+ - f1
13
+ widget: []
14
+ pipeline_tag: token-classification
15
+ ---
16
+
17
+ # SpanMarker
18
+
19
+ This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model that can be used for Named Entity Recognition.
20
+
21
+ ## Model Details
22
+
23
+ ### Model Description
24
+
25
+ - **Model Type:** SpanMarker
26
+ <!-- - **Encoder:** [Unknown](https://huggingface.co/models/unknown) -->
27
+ - **Maximum Sequence Length:** 256 tokens
28
+ - **Maximum Entity Length:** 8 words
29
+ <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
30
+ <!-- - **Language:** Unknown -->
31
+ <!-- - **License:** Unknown -->
32
+
33
+ ### Model Sources
34
+
35
+ - **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
36
+ - **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)
37
+
38
+ ## Uses
39
+
40
+ ### Direct Use for Inference
41
+
42
+ ```python
43
+ from span_marker import SpanMarkerModel
44
+
45
+ # Download from the 🤗 Hub
46
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
47
+ # Run inference
48
+ entities = model.predict("Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.")
49
+ ```
50
+
51
+ ### Downstream Use
52
+ You can finetune this model on your own dataset.
53
+
54
+ <details><summary>Click to expand</summary>
55
+
56
+ ```python
57
+ from span_marker import SpanMarkerModel, Trainer
58
+
59
+ # Download from the 🤗 Hub
60
+ model = SpanMarkerModel.from_pretrained("span_marker_model_id")
61
+
62
+ # Specify a Dataset with "tokens" and "ner_tag" columns
63
+ dataset = load_dataset("conll2003") # For example CoNLL2003
64
+
65
+ # Initialize a Trainer using the pretrained model & dataset
66
+ trainer = Trainer(
67
+ model=model,
68
+ train_dataset=dataset["train"],
69
+ eval_dataset=dataset["validation"],
70
+ )
71
+ trainer.train()
72
+ trainer.save_model("span_marker_model_id-finetuned")
73
+ ```
74
+ </details>
75
+
76
+ <!--
77
+ ### Out-of-Scope Use
78
+
79
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
80
+ -->
81
+
82
+ <!--
83
+ ## Bias, Risks and Limitations
84
+
85
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
86
+ -->
87
+
88
+ <!--
89
+ ### Recommendations
90
+
91
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
92
+ -->
93
+
94
+ ## Training Details
95
+
96
+ ### Framework Versions
97
+
98
+ - Python: 3.10.12
99
+ - SpanMarker: 1.3.1.dev
100
+ - Transformers: 4.33.2
101
+ - PyTorch: 2.0.1+cu118
102
+ - Datasets: 2.14.5
103
+ - Tokenizers: 0.13.3
104
+
105
+ ## Citation
106
+
107
+ ### BibTeX
108
+ ```
109
+ @software{Aarsen_SpanMarker,
110
+ author = {Aarsen, Tom},
111
+ license = {Apache-2.0},
112
+ title = {{SpanMarker for Named Entity Recognition}},
113
+ url = {https://github.com/tomaarsen/SpanMarkerNER}
114
+ }
115
+ ```
116
+
117
+ <!--
118
+ ## Glossary
119
+
120
+ *Clearly define terms in order to be accessible across audiences.*
121
+ -->
122
+
123
+ <!--
124
+ ## Model Card Authors
125
+
126
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
127
+ -->
128
+
129
+ <!--
130
+ ## Model Card Contact
131
+
132
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
133
+ -->
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<end>": 50263,
3
+ "<start>": 50262
4
+ }
config.json ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/content/models/span_marker_roberta_base_bne_conll_2002_es/checkpoint-final",
3
+ "architectures": [
4
+ "SpanMarkerModel"
5
+ ],
6
+ "encoder": {
7
+ "_name_or_path": "PlanTL-GOB-ES/roberta-base-bne",
8
+ "add_cross_attention": false,
9
+ "architectures": [
10
+ "RobertaForMaskedLM"
11
+ ],
12
+ "attention_probs_dropout_prob": 0.0,
13
+ "bad_words_ids": null,
14
+ "begin_suppress_tokens": null,
15
+ "bos_token_id": 0,
16
+ "chunk_size_feed_forward": 0,
17
+ "classifier_dropout": null,
18
+ "cross_attention_hidden_size": null,
19
+ "decoder_start_token_id": null,
20
+ "diversity_penalty": 0.0,
21
+ "do_sample": false,
22
+ "early_stopping": false,
23
+ "encoder_no_repeat_ngram_size": 0,
24
+ "eos_token_id": 2,
25
+ "exponential_decay_length_penalty": null,
26
+ "finetuning_task": null,
27
+ "forced_bos_token_id": null,
28
+ "forced_eos_token_id": null,
29
+ "gradient_checkpointing": false,
30
+ "hidden_act": "gelu",
31
+ "hidden_dropout_prob": 0.0,
32
+ "hidden_size": 768,
33
+ "id2label": {
34
+ "0": "O",
35
+ "1": "B-PER",
36
+ "2": "I-PER",
37
+ "3": "B-ORG",
38
+ "4": "I-ORG",
39
+ "5": "B-LOC",
40
+ "6": "I-LOC",
41
+ "7": "B-MISC",
42
+ "8": "I-MISC"
43
+ },
44
+ "initializer_range": 0.02,
45
+ "intermediate_size": 3072,
46
+ "is_decoder": false,
47
+ "is_encoder_decoder": false,
48
+ "label2id": {
49
+ "B-LOC": 5,
50
+ "B-MISC": 7,
51
+ "B-ORG": 3,
52
+ "B-PER": 1,
53
+ "I-LOC": 6,
54
+ "I-MISC": 8,
55
+ "I-ORG": 4,
56
+ "I-PER": 2,
57
+ "O": 0
58
+ },
59
+ "layer_norm_eps": 1e-05,
60
+ "length_penalty": 1.0,
61
+ "max_length": 20,
62
+ "max_position_embeddings": 514,
63
+ "min_length": 0,
64
+ "model_type": "roberta",
65
+ "no_repeat_ngram_size": 0,
66
+ "num_attention_heads": 12,
67
+ "num_beam_groups": 1,
68
+ "num_beams": 1,
69
+ "num_hidden_layers": 12,
70
+ "num_return_sequences": 1,
71
+ "output_attentions": false,
72
+ "output_hidden_states": false,
73
+ "output_scores": false,
74
+ "pad_token_id": 1,
75
+ "position_embedding_type": "absolute",
76
+ "prefix": null,
77
+ "problem_type": null,
78
+ "pruned_heads": {},
79
+ "remove_invalid_values": false,
80
+ "repetition_penalty": 1.0,
81
+ "return_dict": true,
82
+ "return_dict_in_generate": false,
83
+ "sep_token_id": null,
84
+ "suppress_tokens": null,
85
+ "task_specific_params": null,
86
+ "temperature": 1.0,
87
+ "tf_legacy_loss": false,
88
+ "tie_encoder_decoder": false,
89
+ "tie_word_embeddings": true,
90
+ "tokenizer_class": null,
91
+ "top_k": 50,
92
+ "top_p": 1.0,
93
+ "torch_dtype": null,
94
+ "torchscript": false,
95
+ "transformers_version": "4.33.2",
96
+ "type_vocab_size": 1,
97
+ "typical_p": 1.0,
98
+ "use_bfloat16": false,
99
+ "use_cache": true,
100
+ "vocab_size": 50264
101
+ },
102
+ "entity_max_length": 8,
103
+ "id2label": {
104
+ "0": "O",
105
+ "1": "LOC",
106
+ "2": "MISC",
107
+ "3": "ORG",
108
+ "4": "PER"
109
+ },
110
+ "id2reduced_id": {
111
+ "0": 0,
112
+ "1": 4,
113
+ "2": 4,
114
+ "3": 3,
115
+ "4": 3,
116
+ "5": 1,
117
+ "6": 1,
118
+ "7": 2,
119
+ "8": 2
120
+ },
121
+ "label2id": {
122
+ "LOC": 1,
123
+ "MISC": 2,
124
+ "O": 0,
125
+ "ORG": 3,
126
+ "PER": 4
127
+ },
128
+ "marker_max_length": 128,
129
+ "max_next_context": null,
130
+ "max_prev_context": null,
131
+ "model_max_length": 256,
132
+ "model_max_length_default": 512,
133
+ "model_type": "span-marker",
134
+ "span_marker_version": "1.3.1.dev",
135
+ "torch_dtype": "float32",
136
+ "trained_with_document_context": false,
137
+ "transformers_version": "4.33.2",
138
+ "vocab_size": 50264
139
+ }
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:e7662a097d32ea1d5d24f15efd8fd0376766d62f571c7dc4a2458b5755e63f54
3
+ size 498676337
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,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "bos_token": {
4
+ "__type": "AddedToken",
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false
10
+ },
11
+ "clean_up_tokenization_spaces": true,
12
+ "cls_token": {
13
+ "__type": "AddedToken",
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "eos_token": {
21
+ "__type": "AddedToken",
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": true,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ },
28
+ "errors": "replace",
29
+ "mask_token": {
30
+ "__type": "AddedToken",
31
+ "content": "<mask>",
32
+ "lstrip": true,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "max_len": 512,
38
+ "model_max_length": 512,
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
+ "tokenizer_class": "RobertaTokenizer",
56
+ "trim_offsets": true,
57
+ "unk_token": {
58
+ "__type": "AddedToken",
59
+ "content": "<unk>",
60
+ "lstrip": false,
61
+ "normalized": true,
62
+ "rstrip": false,
63
+ "single_word": false
64
+ }
65
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff