Commit
•
21bdf0a
1
Parent(s):
44de49a
Upload model
Browse files- README.md +131 -0
- added_tokens.json +4 -0
- config.json +136 -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,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
- **Model Type:** SpanMarker
|
25 |
+
<!-- - **Encoder:** [Unknown](https://huggingface.co/unknown) -->
|
26 |
+
- **Maximum Sequence Length:** 512 tokens
|
27 |
+
- **Maximum Entity Length:** 8 words
|
28 |
+
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
29 |
+
<!-- - **Language:** Unknown -->
|
30 |
+
<!-- - **License:** Unknown -->
|
31 |
+
|
32 |
+
### Model Sources
|
33 |
+
|
34 |
+
- **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
|
35 |
+
- **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)
|
36 |
+
|
37 |
+
## Uses
|
38 |
+
|
39 |
+
### Direct Use for Inference
|
40 |
+
|
41 |
+
```python
|
42 |
+
from span_marker import SpanMarkerModel
|
43 |
+
|
44 |
+
# Download from the 🤗 Hub
|
45 |
+
model = SpanMarkerModel.from_pretrained("span_marker_model_id")
|
46 |
+
# Run inference
|
47 |
+
entities = model.predict("Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.")
|
48 |
+
```
|
49 |
+
|
50 |
+
### Downstream Use
|
51 |
+
You can finetune this model on your own dataset.
|
52 |
+
|
53 |
+
<details><summary>Click to expand</summary>
|
54 |
+
|
55 |
+
```python
|
56 |
+
from span_marker import SpanMarkerModel, Trainer
|
57 |
+
|
58 |
+
# Download from the 🤗 Hub
|
59 |
+
model = SpanMarkerModel.from_pretrained("span_marker_model_id")
|
60 |
+
|
61 |
+
# Specify a Dataset with "tokens" and "ner_tag" columns
|
62 |
+
dataset = load_dataset("conll2003") # For example CoNLL2003
|
63 |
+
|
64 |
+
# Initialize a Trainer using the pretrained model & dataset
|
65 |
+
trainer = Trainer(
|
66 |
+
model=model,
|
67 |
+
train_dataset=dataset["train"],
|
68 |
+
eval_dataset=dataset["validation"],
|
69 |
+
)
|
70 |
+
trainer.train()
|
71 |
+
trainer.save_model("span_marker_model_id-finetuned")
|
72 |
+
```
|
73 |
+
</details>
|
74 |
+
|
75 |
+
<!--
|
76 |
+
### Out-of-Scope Use
|
77 |
+
|
78 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
79 |
+
-->
|
80 |
+
|
81 |
+
<!--
|
82 |
+
## Bias, Risks and Limitations
|
83 |
+
|
84 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
85 |
+
-->
|
86 |
+
|
87 |
+
<!--
|
88 |
+
### Recommendations
|
89 |
+
|
90 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
91 |
+
-->
|
92 |
+
|
93 |
+
## Training Details
|
94 |
+
|
95 |
+
### Framework Versions
|
96 |
+
- Python: 3.10.12
|
97 |
+
- SpanMarker: 1.3.1.dev
|
98 |
+
- Transformers: 4.33.3
|
99 |
+
- PyTorch: 2.0.1+cu118
|
100 |
+
- Datasets: 2.14.5
|
101 |
+
- Tokenizers: 0.13.3
|
102 |
+
|
103 |
+
## Citation
|
104 |
+
|
105 |
+
### BibTeX
|
106 |
+
```
|
107 |
+
@software{Aarsen_SpanMarker,
|
108 |
+
author = {Aarsen, Tom},
|
109 |
+
license = {Apache-2.0},
|
110 |
+
title = {{SpanMarker for Named Entity Recognition}},
|
111 |
+
url = {https://github.com/tomaarsen/SpanMarkerNER}
|
112 |
+
}
|
113 |
+
```
|
114 |
+
|
115 |
+
<!--
|
116 |
+
## Glossary
|
117 |
+
|
118 |
+
*Clearly define terms in order to be accessible across audiences.*
|
119 |
+
-->
|
120 |
+
|
121 |
+
<!--
|
122 |
+
## Model Card Authors
|
123 |
+
|
124 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
125 |
+
-->
|
126 |
+
|
127 |
+
<!--
|
128 |
+
## Model Card Contact
|
129 |
+
|
130 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
131 |
+
-->
|
added_tokens.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<end>": 119548,
|
3 |
+
"<start>": 119547
|
4 |
+
}
|
config.json
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/content/models/bert_base_multilingual_cased_ner_spanish/checkpoint-final",
|
3 |
+
"architectures": [
|
4 |
+
"SpanMarkerModel"
|
5 |
+
],
|
6 |
+
"encoder": {
|
7 |
+
"_name_or_path": "bert-base-multilingual-cased",
|
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 |
+
"directionality": "bidi",
|
21 |
+
"diversity_penalty": 0.0,
|
22 |
+
"do_sample": false,
|
23 |
+
"early_stopping": false,
|
24 |
+
"encoder_no_repeat_ngram_size": 0,
|
25 |
+
"eos_token_id": null,
|
26 |
+
"exponential_decay_length_penalty": null,
|
27 |
+
"finetuning_task": null,
|
28 |
+
"forced_bos_token_id": null,
|
29 |
+
"forced_eos_token_id": null,
|
30 |
+
"hidden_act": "gelu",
|
31 |
+
"hidden_dropout_prob": 0.1,
|
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 |
+
},
|
42 |
+
"initializer_range": 0.02,
|
43 |
+
"intermediate_size": 3072,
|
44 |
+
"is_decoder": false,
|
45 |
+
"is_encoder_decoder": false,
|
46 |
+
"label2id": {
|
47 |
+
"B-LOC": 5,
|
48 |
+
"B-ORG": 3,
|
49 |
+
"B-PER": 1,
|
50 |
+
"I-LOC": 6,
|
51 |
+
"I-ORG": 4,
|
52 |
+
"I-PER": 2,
|
53 |
+
"O": 0
|
54 |
+
},
|
55 |
+
"layer_norm_eps": 1e-12,
|
56 |
+
"length_penalty": 1.0,
|
57 |
+
"max_length": 20,
|
58 |
+
"max_position_embeddings": 512,
|
59 |
+
"min_length": 0,
|
60 |
+
"model_type": "bert",
|
61 |
+
"no_repeat_ngram_size": 0,
|
62 |
+
"num_attention_heads": 12,
|
63 |
+
"num_beam_groups": 1,
|
64 |
+
"num_beams": 1,
|
65 |
+
"num_hidden_layers": 12,
|
66 |
+
"num_return_sequences": 1,
|
67 |
+
"output_attentions": false,
|
68 |
+
"output_hidden_states": false,
|
69 |
+
"output_scores": false,
|
70 |
+
"pad_token_id": 0,
|
71 |
+
"pooler_fc_size": 768,
|
72 |
+
"pooler_num_attention_heads": 12,
|
73 |
+
"pooler_num_fc_layers": 3,
|
74 |
+
"pooler_size_per_head": 128,
|
75 |
+
"pooler_type": "first_token_transform",
|
76 |
+
"position_embedding_type": "absolute",
|
77 |
+
"prefix": null,
|
78 |
+
"problem_type": null,
|
79 |
+
"pruned_heads": {},
|
80 |
+
"remove_invalid_values": false,
|
81 |
+
"repetition_penalty": 1.0,
|
82 |
+
"return_dict": true,
|
83 |
+
"return_dict_in_generate": false,
|
84 |
+
"sep_token_id": null,
|
85 |
+
"suppress_tokens": null,
|
86 |
+
"task_specific_params": null,
|
87 |
+
"temperature": 1.0,
|
88 |
+
"tf_legacy_loss": false,
|
89 |
+
"tie_encoder_decoder": false,
|
90 |
+
"tie_word_embeddings": true,
|
91 |
+
"tokenizer_class": null,
|
92 |
+
"top_k": 50,
|
93 |
+
"top_p": 1.0,
|
94 |
+
"torch_dtype": null,
|
95 |
+
"torchscript": false,
|
96 |
+
"transformers_version": "4.33.3",
|
97 |
+
"type_vocab_size": 2,
|
98 |
+
"typical_p": 1.0,
|
99 |
+
"use_bfloat16": false,
|
100 |
+
"use_cache": true,
|
101 |
+
"vocab_size": 119552
|
102 |
+
},
|
103 |
+
"entity_max_length": 8,
|
104 |
+
"id2label": {
|
105 |
+
"0": "O",
|
106 |
+
"1": "LOC",
|
107 |
+
"2": "ORG",
|
108 |
+
"3": "PER"
|
109 |
+
},
|
110 |
+
"id2reduced_id": {
|
111 |
+
"0": 0,
|
112 |
+
"1": 3,
|
113 |
+
"2": 3,
|
114 |
+
"3": 2,
|
115 |
+
"4": 2,
|
116 |
+
"5": 1,
|
117 |
+
"6": 1
|
118 |
+
},
|
119 |
+
"label2id": {
|
120 |
+
"LOC": 1,
|
121 |
+
"O": 0,
|
122 |
+
"ORG": 2,
|
123 |
+
"PER": 3
|
124 |
+
},
|
125 |
+
"marker_max_length": 256,
|
126 |
+
"max_next_context": null,
|
127 |
+
"max_prev_context": null,
|
128 |
+
"model_max_length": 512,
|
129 |
+
"model_max_length_default": 512,
|
130 |
+
"model_type": "span-marker",
|
131 |
+
"span_marker_version": "1.3.1.dev",
|
132 |
+
"torch_dtype": "float32",
|
133 |
+
"trained_with_document_context": false,
|
134 |
+
"transformers_version": "4.33.3",
|
135 |
+
"vocab_size": 119552
|
136 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a4e7c1d62b75126a17a37e97e3283da0e79c87f7f2eacc4b715f9ef34d8fa5fa
|
3 |
+
size 711519857
|
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": false,
|
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
|
|