tomaarsen HF staff commited on
Commit
2c6bf5e
1 Parent(s): b82fb4c

Upload model

Browse files
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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
+ ## Training Details
77
+
78
+ ### Framework Versions
79
+
80
+ - Python: 3.9.16
81
+ - SpanMarker: 1.3.1.dev
82
+ - Transformers : 4.29.2
83
+ - PyTorch: 2.0.1+cu118
84
+ - Datasets: 2.14.3
85
+ - Tokenizers: 0.13.2
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<end>": 30523,
3
+ "<start>": 30522
4
+ }
config.json ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "models\\tomaarsen\\span_marker_bert_base_uncased_keyphrase_inspec\\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-KEY",
36
+ "2": "I-KEY"
37
+ },
38
+ "initializer_range": 0.02,
39
+ "intermediate_size": 3072,
40
+ "is_decoder": false,
41
+ "is_encoder_decoder": false,
42
+ "label2id": {
43
+ "B-KEY": 1,
44
+ "I-KEY": 2,
45
+ "O": 0
46
+ },
47
+ "layer_norm_eps": 1e-12,
48
+ "length_penalty": 1.0,
49
+ "max_length": 20,
50
+ "max_position_embeddings": 512,
51
+ "min_length": 0,
52
+ "model_type": "bert",
53
+ "no_repeat_ngram_size": 0,
54
+ "num_attention_heads": 12,
55
+ "num_beam_groups": 1,
56
+ "num_beams": 1,
57
+ "num_hidden_layers": 12,
58
+ "num_return_sequences": 1,
59
+ "output_attentions": false,
60
+ "output_hidden_states": false,
61
+ "output_scores": false,
62
+ "pad_token_id": 0,
63
+ "position_embedding_type": "absolute",
64
+ "prefix": null,
65
+ "problem_type": null,
66
+ "pruned_heads": {},
67
+ "remove_invalid_values": false,
68
+ "repetition_penalty": 1.0,
69
+ "return_dict": true,
70
+ "return_dict_in_generate": false,
71
+ "sep_token_id": null,
72
+ "suppress_tokens": null,
73
+ "task_specific_params": null,
74
+ "temperature": 1.0,
75
+ "tf_legacy_loss": false,
76
+ "tie_encoder_decoder": false,
77
+ "tie_word_embeddings": true,
78
+ "tokenizer_class": null,
79
+ "top_k": 50,
80
+ "top_p": 1.0,
81
+ "torch_dtype": null,
82
+ "torchscript": false,
83
+ "transformers_version": "4.29.2",
84
+ "type_vocab_size": 2,
85
+ "typical_p": 1.0,
86
+ "use_bfloat16": false,
87
+ "use_cache": true,
88
+ "vocab_size": 30524
89
+ },
90
+ "entity_max_length": 8,
91
+ "id2label": {
92
+ "0": "O",
93
+ "1": "KEY"
94
+ },
95
+ "id2reduced_id": {
96
+ "0": 0,
97
+ "1": 1,
98
+ "2": 1
99
+ },
100
+ "label2id": {
101
+ "KEY": 1,
102
+ "O": 0
103
+ },
104
+ "marker_max_length": 128,
105
+ "max_next_context": null,
106
+ "max_prev_context": null,
107
+ "model_max_length": 256,
108
+ "model_max_length_default": 512,
109
+ "model_type": "span-marker",
110
+ "span_marker_version": "1.3.1.dev",
111
+ "torch_dtype": "float32",
112
+ "trained_with_document_context": false,
113
+ "transformers_version": "4.29.2",
114
+ "vocab_size": 30524
115
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7176780513b41d13a6b864d4c6f131141c245037515fb7898abe22ae23b414f3
3
+ size 438017973
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