Upload model
Browse files- README.md +133 -0
- added_tokens.json +4 -0
- config.json +179 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +14 -0
- vocab.txt +0 -0
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.9.16
|
99 |
+
- SpanMarker: 1.3.1.dev
|
100 |
+
- Transformers: 4.33.0
|
101 |
+
- PyTorch: 2.0.1+cu118
|
102 |
+
- Datasets: 2.14.0
|
103 |
+
- Tokenizers: 0.13.2
|
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>": 30523,
|
3 |
+
"<start>": 30522
|
4 |
+
}
|
config.json
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "models\\tomaarsen\\span-marker-bert-base-uncased-sourcedata\\checkpoint-final",
|
3 |
+
"architectures": [
|
4 |
+
"SpanMarkerModel"
|
5 |
+
],
|
6 |
+
"encoder": {
|
7 |
+
"_name_or_path": "bert-base-uncased",
|
8 |
+
"add_cross_attention": false,
|
9 |
+
"architectures": [
|
10 |
+
"BertForMaskedLM"
|
11 |
+
],
|
12 |
+
"attention_probs_dropout_prob": 0.1,
|
13 |
+
"bad_words_ids": null,
|
14 |
+
"begin_suppress_tokens": null,
|
15 |
+
"bos_token_id": null,
|
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": null,
|
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.1,
|
32 |
+
"hidden_size": 768,
|
33 |
+
"id2label": {
|
34 |
+
"0": "O",
|
35 |
+
"1": "B-SMALL_MOLECULE",
|
36 |
+
"2": "I-SMALL_MOLECULE",
|
37 |
+
"3": "B-GENEPROD",
|
38 |
+
"4": "I-GENEPROD",
|
39 |
+
"5": "B-SUBCELLULAR",
|
40 |
+
"6": "I-SUBCELLULAR",
|
41 |
+
"7": "B-CELL_TYPE",
|
42 |
+
"8": "I-CELL_TYPE",
|
43 |
+
"9": "B-TISSUE",
|
44 |
+
"10": "I-TISSUE",
|
45 |
+
"11": "B-ORGANISM",
|
46 |
+
"12": "I-ORGANISM",
|
47 |
+
"13": "B-EXP_ASSAY",
|
48 |
+
"14": "I-EXP_ASSAY",
|
49 |
+
"15": "B-DISEASE",
|
50 |
+
"16": "I-DISEASE",
|
51 |
+
"17": "B-CELL_LINE",
|
52 |
+
"18": "I-CELL_LINE"
|
53 |
+
},
|
54 |
+
"initializer_range": 0.02,
|
55 |
+
"intermediate_size": 3072,
|
56 |
+
"is_decoder": false,
|
57 |
+
"is_encoder_decoder": false,
|
58 |
+
"label2id": {
|
59 |
+
"B-CELL_LINE": 17,
|
60 |
+
"B-CELL_TYPE": 7,
|
61 |
+
"B-DISEASE": 15,
|
62 |
+
"B-EXP_ASSAY": 13,
|
63 |
+
"B-GENEPROD": 3,
|
64 |
+
"B-ORGANISM": 11,
|
65 |
+
"B-SMALL_MOLECULE": 1,
|
66 |
+
"B-SUBCELLULAR": 5,
|
67 |
+
"B-TISSUE": 9,
|
68 |
+
"I-CELL_LINE": 18,
|
69 |
+
"I-CELL_TYPE": 8,
|
70 |
+
"I-DISEASE": 16,
|
71 |
+
"I-EXP_ASSAY": 14,
|
72 |
+
"I-GENEPROD": 4,
|
73 |
+
"I-ORGANISM": 12,
|
74 |
+
"I-SMALL_MOLECULE": 2,
|
75 |
+
"I-SUBCELLULAR": 6,
|
76 |
+
"I-TISSUE": 10,
|
77 |
+
"O": 0
|
78 |
+
},
|
79 |
+
"layer_norm_eps": 1e-12,
|
80 |
+
"length_penalty": 1.0,
|
81 |
+
"max_length": 20,
|
82 |
+
"max_position_embeddings": 512,
|
83 |
+
"min_length": 0,
|
84 |
+
"model_type": "bert",
|
85 |
+
"no_repeat_ngram_size": 0,
|
86 |
+
"num_attention_heads": 12,
|
87 |
+
"num_beam_groups": 1,
|
88 |
+
"num_beams": 1,
|
89 |
+
"num_hidden_layers": 12,
|
90 |
+
"num_return_sequences": 1,
|
91 |
+
"output_attentions": false,
|
92 |
+
"output_hidden_states": false,
|
93 |
+
"output_scores": false,
|
94 |
+
"pad_token_id": 0,
|
95 |
+
"position_embedding_type": "absolute",
|
96 |
+
"prefix": null,
|
97 |
+
"problem_type": null,
|
98 |
+
"pruned_heads": {},
|
99 |
+
"remove_invalid_values": false,
|
100 |
+
"repetition_penalty": 1.0,
|
101 |
+
"return_dict": true,
|
102 |
+
"return_dict_in_generate": false,
|
103 |
+
"sep_token_id": null,
|
104 |
+
"suppress_tokens": null,
|
105 |
+
"task_specific_params": null,
|
106 |
+
"temperature": 1.0,
|
107 |
+
"tf_legacy_loss": false,
|
108 |
+
"tie_encoder_decoder": false,
|
109 |
+
"tie_word_embeddings": true,
|
110 |
+
"tokenizer_class": null,
|
111 |
+
"top_k": 50,
|
112 |
+
"top_p": 1.0,
|
113 |
+
"torch_dtype": null,
|
114 |
+
"torchscript": false,
|
115 |
+
"transformers_version": "4.33.0",
|
116 |
+
"type_vocab_size": 2,
|
117 |
+
"typical_p": 1.0,
|
118 |
+
"use_bfloat16": false,
|
119 |
+
"use_cache": true,
|
120 |
+
"vocab_size": 30524
|
121 |
+
},
|
122 |
+
"entity_max_length": 8,
|
123 |
+
"id2label": {
|
124 |
+
"0": "O",
|
125 |
+
"1": "CELL_LINE",
|
126 |
+
"2": "CELL_TYPE",
|
127 |
+
"3": "DISEASE",
|
128 |
+
"4": "EXP_ASSAY",
|
129 |
+
"5": "GENEPROD",
|
130 |
+
"6": "ORGANISM",
|
131 |
+
"7": "SMALL_MOLECULE",
|
132 |
+
"8": "SUBCELLULAR",
|
133 |
+
"9": "TISSUE"
|
134 |
+
},
|
135 |
+
"id2reduced_id": {
|
136 |
+
"0": 0,
|
137 |
+
"1": 7,
|
138 |
+
"2": 7,
|
139 |
+
"3": 5,
|
140 |
+
"4": 5,
|
141 |
+
"5": 8,
|
142 |
+
"6": 8,
|
143 |
+
"7": 2,
|
144 |
+
"8": 2,
|
145 |
+
"9": 9,
|
146 |
+
"10": 9,
|
147 |
+
"11": 6,
|
148 |
+
"12": 6,
|
149 |
+
"13": 4,
|
150 |
+
"14": 4,
|
151 |
+
"15": 3,
|
152 |
+
"16": 3,
|
153 |
+
"17": 1,
|
154 |
+
"18": 1
|
155 |
+
},
|
156 |
+
"label2id": {
|
157 |
+
"CELL_LINE": 1,
|
158 |
+
"CELL_TYPE": 2,
|
159 |
+
"DISEASE": 3,
|
160 |
+
"EXP_ASSAY": 4,
|
161 |
+
"GENEPROD": 5,
|
162 |
+
"O": 0,
|
163 |
+
"ORGANISM": 6,
|
164 |
+
"SMALL_MOLECULE": 7,
|
165 |
+
"SUBCELLULAR": 8,
|
166 |
+
"TISSUE": 9
|
167 |
+
},
|
168 |
+
"marker_max_length": 128,
|
169 |
+
"max_next_context": null,
|
170 |
+
"max_prev_context": null,
|
171 |
+
"model_max_length": 256,
|
172 |
+
"model_max_length_default": 512,
|
173 |
+
"model_type": "span-marker",
|
174 |
+
"span_marker_version": "1.3.1.dev",
|
175 |
+
"torch_dtype": "float32",
|
176 |
+
"trained_with_document_context": false,
|
177 |
+
"transformers_version": "4.33.0",
|
178 |
+
"vocab_size": 30524
|
179 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b2d1e3e40aa72cffd3f6fd38bb23a67b54ccdfda67e781ce4b717b111934267b
|
3 |
+
size 438062705
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": true,
|
3 |
+
"clean_up_tokenization_spaces": true,
|
4 |
+
"cls_token": "[CLS]",
|
5 |
+
"do_lower_case": true,
|
6 |
+
"mask_token": "[MASK]",
|
7 |
+
"model_max_length": 512,
|
8 |
+
"pad_token": "[PAD]",
|
9 |
+
"sep_token": "[SEP]",
|
10 |
+
"strip_accents": null,
|
11 |
+
"tokenize_chinese_chars": true,
|
12 |
+
"tokenizer_class": "BertTokenizer",
|
13 |
+
"unk_token": "[UNK]"
|
14 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|