tomaarsen HF staff commited on
Commit
111bd4a
1 Parent(s): 10576fe

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,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "models\\tomaarsen\\span-marker-bert-base-uncased-bionlp\\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-DNA",
36
+ "2": "I-DNA",
37
+ "3": "B-protein",
38
+ "4": "I-protein",
39
+ "5": "B-cell_type",
40
+ "6": "I-cell_type",
41
+ "7": "B-cell_line",
42
+ "8": "I-cell_line",
43
+ "9": "B-RNA",
44
+ "10": "I-RNA"
45
+ },
46
+ "initializer_range": 0.02,
47
+ "intermediate_size": 3072,
48
+ "is_decoder": false,
49
+ "is_encoder_decoder": false,
50
+ "label2id": {
51
+ "B-DNA": 1,
52
+ "B-RNA": 9,
53
+ "B-cell_line": 7,
54
+ "B-cell_type": 5,
55
+ "B-protein": 3,
56
+ "I-DNA": 2,
57
+ "I-RNA": 10,
58
+ "I-cell_line": 8,
59
+ "I-cell_type": 6,
60
+ "I-protein": 4,
61
+ "O": 0
62
+ },
63
+ "layer_norm_eps": 1e-12,
64
+ "length_penalty": 1.0,
65
+ "max_length": 20,
66
+ "max_position_embeddings": 512,
67
+ "min_length": 0,
68
+ "model_type": "bert",
69
+ "no_repeat_ngram_size": 0,
70
+ "num_attention_heads": 12,
71
+ "num_beam_groups": 1,
72
+ "num_beams": 1,
73
+ "num_hidden_layers": 12,
74
+ "num_return_sequences": 1,
75
+ "output_attentions": false,
76
+ "output_hidden_states": false,
77
+ "output_scores": false,
78
+ "pad_token_id": 0,
79
+ "position_embedding_type": "absolute",
80
+ "prefix": null,
81
+ "problem_type": null,
82
+ "pruned_heads": {},
83
+ "remove_invalid_values": false,
84
+ "repetition_penalty": 1.0,
85
+ "return_dict": true,
86
+ "return_dict_in_generate": false,
87
+ "sep_token_id": null,
88
+ "suppress_tokens": null,
89
+ "task_specific_params": null,
90
+ "temperature": 1.0,
91
+ "tf_legacy_loss": false,
92
+ "tie_encoder_decoder": false,
93
+ "tie_word_embeddings": true,
94
+ "tokenizer_class": null,
95
+ "top_k": 50,
96
+ "top_p": 1.0,
97
+ "torch_dtype": null,
98
+ "torchscript": false,
99
+ "transformers_version": "4.29.2",
100
+ "type_vocab_size": 2,
101
+ "typical_p": 1.0,
102
+ "use_bfloat16": false,
103
+ "use_cache": true,
104
+ "vocab_size": 30524
105
+ },
106
+ "entity_max_length": 8,
107
+ "id2label": {
108
+ "0": "O",
109
+ "1": "DNA",
110
+ "2": "RNA",
111
+ "3": "cell_line",
112
+ "4": "cell_type",
113
+ "5": "protein"
114
+ },
115
+ "id2reduced_id": {
116
+ "0": 0,
117
+ "1": 1,
118
+ "2": 1,
119
+ "3": 5,
120
+ "4": 5,
121
+ "5": 4,
122
+ "6": 4,
123
+ "7": 3,
124
+ "8": 3,
125
+ "9": 2,
126
+ "10": 2
127
+ },
128
+ "label2id": {
129
+ "DNA": 1,
130
+ "O": 0,
131
+ "RNA": 2,
132
+ "cell_line": 3,
133
+ "cell_type": 4,
134
+ "protein": 5
135
+ },
136
+ "marker_max_length": 128,
137
+ "max_next_context": null,
138
+ "max_prev_context": null,
139
+ "model_max_length": 256,
140
+ "model_max_length_default": 512,
141
+ "model_type": "span-marker",
142
+ "span_marker_version": "1.3.1.dev",
143
+ "torch_dtype": "float32",
144
+ "trained_with_document_context": false,
145
+ "transformers_version": "4.29.2",
146
+ "vocab_size": 30524
147
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b4ff2e5adb07f22a0d76242ea3845e6e6e1bb87a084c1910984e467faac016f
3
+ size 438042549
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