MaziyarPanahi commited on
Commit
42af6ae
·
verified ·
1 Parent(s): 29ba94c

feat: Upload fine-tuned medical NER model OpenMed-ZeroShot-NER-Genomic-Medium-209M

Browse files
README.md ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ widget:
3
+ - text: "The BRCA2 gene is associated with hereditary breast cancer."
4
+ - text: "Mutations in the CFTR gene cause cystic fibrosis."
5
+ - text: "The APOE gene variant affects Alzheimer's disease risk."
6
+ - text: "The HTT gene provides instructions for making a protein called huntingtin."
7
+ - text: "Sickle cell disease is caused by a mutation in the HBB gene."
8
+ tags:
9
+ - token-classification
10
+ - entity recognition
11
+ - named-entity-recognition
12
+ - zero-shot
13
+ - zero-shot-ner
14
+ - zero shot
15
+ - biomedical-nlp
16
+ - gliner
17
+ - gene-recognition
18
+ - genetics
19
+ - genomics
20
+ - molecular-biology
21
+ - gene
22
+ - genetic_variant
23
+ language:
24
+ - en
25
+ license: apache-2.0
26
+ ---
27
+
28
+ # 🧬 [OpenMed-ZeroShot-NER-Genomic-Medium-209M](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-Medium-209M)
29
+
30
+ **Specialized model for Gene Entity Recognition - Gene-related entities**
31
+
32
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
33
+ [![Python](https://img.shields.io/badge/Python-3.11%2B-blue)]()
34
+ [![GliNER](https://img.shields.io/badge/🤗-GliNER-yellow)]()
35
+ [![OpenMed](https://img.shields.io/badge/🏥-OpenMed-green)](https://huggingface.co/OpenMed)
36
+
37
+ ## 📋 Model Overview
38
+
39
+ Targets **gene and genetics entities**, handling symbol/name variants commonly found in genomics literature.Useful for **genetic association studies**, **variant curation**, and **genomics informatics**.
40
+
41
+ OpenMed ZeroShot NER is an advanced, domain-adapted Named Entity Recognition (NER) model designed specifically for medical, biomedical, and clinical text mining. Leveraging state-of-the-art zero-shot learning, this model empowers researchers, clinicians, and data scientists to extract expert-level biomedical entities—such as diseases, chemicals, genes, species, and clinical findings—directly from unstructured text, without the need for task-specific retraining.
42
+
43
+ Built on the robust GLiNER architecture and fine-tuned on curated biomedical corpora, OpenMed ZeroShot NER delivers high-precision entity recognition for critical healthcare and life sciences applications. Its zero-shot capability means you can flexibly define and extract any entity type relevant to your workflow, from standard biomedical categories to custom clinical concepts, supporting rapid adaptation to new research domains and regulatory requirements.
44
+
45
+ Whether you are working on clinical NLP, biomedical research, electronic health record (EHR) de-identification, or large-scale literature mining, OpenMed ZeroShot NER provides a production-ready, open-source solution that combines expert-level accuracy with unmatched flexibility. Join the OpenMed community to accelerate your medical text analytics with cutting-edge, zero-shot NER technology.
46
+
47
+ ### 🎯 Key Features
48
+ - **Zero-Shot Capability**: Can recognize any entity type without specific training
49
+ - **High Precision**: Optimized for biomedical entity recognition
50
+ - **Domain-Specific**: Fine-tuned on curated GELLUS dataset
51
+ - **Production-Ready**: Validated on clinical benchmarks
52
+ - **Easy Integration**: Compatible with Hugging Face Transformers ecosystem
53
+ - **Flexible Entity Recognition**: Add custom entity types without retraining
54
+
55
+ ### 🏷️ Supported Entity Types
56
+
57
+ This zero-shot model can identify and classify biomedical entities, including but not limited to these entity types. **You can also add custom entity types without retraining the model**:
58
+
59
+ - `Cell-line-name`
60
+
61
+ **💡 Zero-Shot Flexibility**: As a GliNER-based model, you can specify any entity types you want to detect, even if they weren't part of the original training. Simply provide the entity labels when using the model, and it will adapt to recognize them.
62
+
63
+ ## 📊 Dataset
64
+
65
+ Gellus corpus targets gene recognition and genetics entities for genomics and molecular biology applications.
66
+
67
+ The Gellus corpus is a biomedical NER dataset specifically designed for gene recognition and genetics entity extraction in molecular biology literature. This corpus contains comprehensive annotations for gene names, genetic variants, and genomics-related entities that are essential for genetic research and genomics applications. The dataset supports the development of automated systems for gene mention identification, genetic association studies, and genomics text mining. It is particularly valuable for identifying genes involved in hereditary diseases, genetic disorders, and molecular genetics research. The corpus serves as a benchmark for evaluating NER models used in genetics research, personalized medicine, and genomics informatics, contributing to advances in precision medicine and genetic counseling applications.
68
+
69
+
70
+ ## 📊 Performance Metrics
71
+
72
+ ### Current Model Performance
73
+
74
+ - **Finetuned F1 vs. Base Model (on test dataset excluded from training)**: `0.97`
75
+ - **F1 Improvement vs Base Model**: `79.9%`
76
+
77
+ ### 🏆 Top F1 Improvements on GELLUS Dataset
78
+
79
+ | Rank | Model | Base F1 | Finetuned F1 | ΔF1 | ΔF1 % |
80
+ |------|-------|--------:|------------:|----:|------:|
81
+ | 🥇 1 | [OpenMed-ZeroShot-NER-Genomic-Large-459M](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-Large-459M) | 0.5361 | 0.9775 | 0.4414 | 82.3% |
82
+ | 🥈 2 | [OpenMed-ZeroShot-NER-Genomic-Medium-209M](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-Medium-209M) | 0.5376 | 0.9674 | 0.4298 | 79.9% |
83
+ | 🥉 3 | [OpenMed-ZeroShot-NER-Genomic-XLarge-770M](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-XLarge-770M) | 0.6875 | 0.9003 | 0.2128 | 30.9% |
84
+ | 4 | [OpenMed-ZeroShot-NER-Genomic-Small-166M](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-Small-166M) | 0.4694 | 0.8082 | 0.3388 | 72.2% |
85
+ | 5 | [OpenMed-ZeroShot-NER-Genomic-Multi-209M](https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-Multi-209M) | 0.4000 | 0.7333 | 0.3333 | 83.3% |
86
+
87
+
88
+ *Rankings are sorted by finetuned F1 and show ΔF1% over base model. Test dataset is excluded from training.*
89
+
90
+ ![OpenMed ZeroShot Clinical & Biomedical NER vs. Original GLiNER models](https://huggingface.co/spaces/OpenMed/README/resolve/main/openmed-zero-shot-clinical-ner-finetuned.png)
91
+
92
+ *Figure: OpenMed ZeroShot Clinical & Biomedical NER vs. Original GLiNER models.*
93
+
94
+ ## 🚀 Quick Start
95
+
96
+ ### Installation
97
+
98
+ ```bash
99
+ pip install gliner==0.2.21
100
+ ```
101
+
102
+ ### Usage
103
+
104
+ ```python
105
+ from transformers import pipeline
106
+
107
+ # Load the model and tokenizer
108
+ # Model: https://huggingface.co/OpenMed/OpenMed-ZeroShot-NER-Genomic-Medium-209M
109
+ model_name = "OpenMed/OpenMed-ZeroShot-NER-Genomic-Medium-209M"
110
+
111
+ from gliner import GLiNER
112
+ model = GLiNER.from_pretrained("OpenMed-ZeroShot-NER-Genomic-Medium-209M")
113
+
114
+ # Example usage with default entity types
115
+ text = "The BRCA2 gene is associated with hereditary breast cancer."
116
+
117
+ labels = ['Cell-line-name']
118
+ entities = model.predict_entities(text, labels, flat_ner=True, threshold=0.5)
119
+ for entity in entities:
120
+ print(entity)
121
+ ```
122
+
123
+ ### Zero-Shot Usage with Custom Entity Types
124
+ 💡 **Tip:** If you want to extract entities that are not present in the original training set (i.e., use custom or rare entity types), you may get better results by lowering the `threshold` parameter in `model.predict_entities`. For example, try `threshold=0.3` or even lower, depending on your use case:
125
+
126
+ ```python
127
+ # You can specify custom entity types for zero-shot recognition - for instance:
128
+ custom_entities = ["MISC", "Cell-line-name", "PERSON", "LOCATION", "MEDICATION", "PROCEDURE"]
129
+
130
+ entities = model.predict_entities(text, custom_entities, flat_ner=True, threshold=0.1)
131
+ for entity in entities:
132
+ print(entity)
133
+ ```
134
+
135
+ > Lowering the threshold makes the model more permissive and can help it recognize new or less common entity types, but may also increase false positives. Adjust as needed for your application.
136
+
137
+ ## 📚 Dataset Information
138
+
139
+ - **Dataset**: GELLUS
140
+ - **Description**: Gene Entity Recognition - Gene-related entities
141
+
142
+ ### Training Details
143
+ - **Base Model**: gliner_medium-v2.1
144
+ - **Training Framework**: Hugging Face Transformers
145
+ - **Optimization**: AdamW optimizer with learning rate scheduling
146
+ - **Validation**: Cross-validation on held-out test set
147
+
148
+ ## 💡 Use Cases
149
+
150
+ This model is particularly useful for:
151
+ - **Clinical Text Mining**: Extracting entities from medical records
152
+ - **Biomedical Research**: Processing scientific literature
153
+ - **Drug Discovery**: Identifying chemical compounds and drugs
154
+ - **Healthcare Analytics**: Analyzing patient data and outcomes
155
+ - **Academic Research**: Supporting biomedical NLP research
156
+ - **Custom Entity Recognition**: Zero-shot detection of domain-specific entities
157
+
158
+ ## 🔬 Model Architecture
159
+
160
+ - **Task**: Zero-Shot Classification (Named Entity Recognition)
161
+ - **Labels**: Dataset-specific entity types
162
+ - **Input**: Biomedical text
163
+ - **Output**: Named entity predictions
164
+
165
+ ## 📜 License
166
+
167
+ Licensed under the Apache License 2.0. See [LICENSE](https://www.apache.org/licenses/LICENSE-2.0) for details.
168
+
169
+ ## 🤝 Contributing
170
+
171
+ I welcome contributions of all kinds! Whether you have ideas, feature requests, or want to join my mission to advance open-source Healthcare AI, I'd love to hear from you.
172
+
173
+ Follow [OpenMed Org](https://huggingface.co/OpenMed) on Hugging Face 🤗 and click "Watch" to stay updated on my latest releases and developments.
174
+
175
+ ## Citation
176
+
177
+ If you use this model in your research or applications, please cite the following paper:
178
+
179
+ ```latex
180
+ @misc{panahi2025openmedneropensourcedomainadapted,
181
+ title={OpenMed NER: Open-Source, Domain-Adapted State-of-the-Art Transformers for Biomedical NER Across 12 Public Datasets},
182
+ author={Maziyar Panahi},
183
+ year={2025},
184
+ eprint={2508.01630},
185
+ archivePrefix={arXiv},
186
+ primaryClass={cs.CL},
187
+ url={https://arxiv.org/abs/2508.01630},
188
+ }
189
+ ```
190
+
191
+ Proper citation helps support and acknowledge my work. Thank you!
192
+
added_tokens.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "<<ENT>>": 128002,
3
+ "<<SEP>>": 128003,
4
+ "[FLERT]": 128001,
5
+ "[MASK]": 128000
6
+ }
gliner_config.json ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "class_token_index": 128002,
3
+ "dropout": 0.4,
4
+ "embed_ent_token": true,
5
+ "encoder_config": {
6
+ "_name_or_path": "microsoft/deberta-v3-base",
7
+ "add_cross_attention": false,
8
+ "architectures": null,
9
+ "attention_probs_dropout_prob": 0.1,
10
+ "bad_words_ids": null,
11
+ "begin_suppress_tokens": null,
12
+ "bos_token_id": null,
13
+ "chunk_size_feed_forward": 0,
14
+ "cross_attention_hidden_size": null,
15
+ "decoder_start_token_id": null,
16
+ "diversity_penalty": 0.0,
17
+ "do_sample": false,
18
+ "early_stopping": false,
19
+ "encoder_no_repeat_ngram_size": 0,
20
+ "eos_token_id": null,
21
+ "exponential_decay_length_penalty": null,
22
+ "finetuning_task": null,
23
+ "forced_bos_token_id": null,
24
+ "forced_eos_token_id": null,
25
+ "hidden_act": "gelu",
26
+ "hidden_dropout_prob": 0.1,
27
+ "hidden_size": 768,
28
+ "id2label": {
29
+ "0": "LABEL_0",
30
+ "1": "LABEL_1"
31
+ },
32
+ "initializer_range": 0.02,
33
+ "intermediate_size": 3072,
34
+ "is_decoder": false,
35
+ "is_encoder_decoder": false,
36
+ "label2id": {
37
+ "LABEL_0": 0,
38
+ "LABEL_1": 1
39
+ },
40
+ "layer_norm_eps": 1e-07,
41
+ "length_penalty": 1.0,
42
+ "max_length": 20,
43
+ "max_position_embeddings": 512,
44
+ "max_relative_positions": -1,
45
+ "min_length": 0,
46
+ "model_type": "deberta-v2",
47
+ "no_repeat_ngram_size": 0,
48
+ "norm_rel_ebd": "layer_norm",
49
+ "num_attention_heads": 12,
50
+ "num_beam_groups": 1,
51
+ "num_beams": 1,
52
+ "num_hidden_layers": 12,
53
+ "num_return_sequences": 1,
54
+ "output_attentions": false,
55
+ "output_hidden_states": false,
56
+ "output_scores": false,
57
+ "pad_token_id": 0,
58
+ "pooler_dropout": 0,
59
+ "pooler_hidden_act": "gelu",
60
+ "pooler_hidden_size": 768,
61
+ "pos_att_type": [
62
+ "p2c",
63
+ "c2p"
64
+ ],
65
+ "position_biased_input": false,
66
+ "position_buckets": 256,
67
+ "prefix": null,
68
+ "problem_type": null,
69
+ "pruned_heads": {},
70
+ "relative_attention": true,
71
+ "remove_invalid_values": false,
72
+ "repetition_penalty": 1.0,
73
+ "return_dict": true,
74
+ "return_dict_in_generate": false,
75
+ "sep_token_id": null,
76
+ "share_att_key": true,
77
+ "suppress_tokens": null,
78
+ "task_specific_params": null,
79
+ "temperature": 1.0,
80
+ "tf_legacy_loss": false,
81
+ "tie_encoder_decoder": false,
82
+ "tie_word_embeddings": true,
83
+ "tokenizer_class": null,
84
+ "top_k": 50,
85
+ "top_p": 1.0,
86
+ "torch_dtype": null,
87
+ "torchscript": false,
88
+ "type_vocab_size": 0,
89
+ "typical_p": 1.0,
90
+ "use_bfloat16": false,
91
+ "vocab_size": 128004
92
+ },
93
+ "ent_token": "<<ENT>>",
94
+ "eval_every": 5000,
95
+ "fine_tune": true,
96
+ "fuse_layers": false,
97
+ "has_rnn": true,
98
+ "hidden_size": 512,
99
+ "labels_encoder": null,
100
+ "labels_encoder_config": null,
101
+ "lr_encoder": "1e-5",
102
+ "lr_others": "5e-5",
103
+ "max_len": 384,
104
+ "max_neg_type_ratio": 1,
105
+ "max_types": 25,
106
+ "max_width": 12,
107
+ "model_name": "microsoft/deberta-v3-base",
108
+ "model_type": "gliner",
109
+ "name": "correct",
110
+ "num_post_fusion_layers": 1,
111
+ "num_steps": 30000,
112
+ "post_fusion_schema": "",
113
+ "random_drop": true,
114
+ "sep_token": "<<SEP>>",
115
+ "shuffle_types": true,
116
+ "size_sup": -1,
117
+ "span_mode": "markerV0",
118
+ "subtoken_pooling": "first",
119
+ "train_batch_size": 8,
120
+ "transformers_version": "4.43.4",
121
+ "vocab_size": 128004,
122
+ "warmup_ratio": 3000,
123
+ "words_splitter_type": "whitespace"
124
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23bb652566e9838e11d51bcff07f938790c205bc7be0ca659fcc9aab7e1d4f27
3
+ size 780784814
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[CLS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": "[MASK]",
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "unk_token": {
9
+ "content": "[UNK]",
10
+ "lstrip": false,
11
+ "normalized": true,
12
+ "rstrip": false,
13
+ "single_word": false
14
+ }
15
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
test_results.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "eval_loss": 4.513314247131348,
3
+ "seqeval_accuracy": 0.9967172753385309,
4
+ "seqeval_f1": 0.9673913043478259,
5
+ "seqeval_precision": 0.9417989417989417,
6
+ "seqeval_recall": 0.994413407821229
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[CLS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[SEP]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128000": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128001": {
44
+ "content": "[FLERT]",
45
+ "lstrip": false,
46
+ "normalized": true,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": false
50
+ },
51
+ "128002": {
52
+ "content": "<<ENT>>",
53
+ "lstrip": false,
54
+ "normalized": true,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": false
58
+ },
59
+ "128003": {
60
+ "content": "<<SEP>>",
61
+ "lstrip": false,
62
+ "normalized": true,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": false
66
+ }
67
+ },
68
+ "bos_token": "[CLS]",
69
+ "clean_up_tokenization_spaces": true,
70
+ "cls_token": "[CLS]",
71
+ "do_lower_case": false,
72
+ "eos_token": "[SEP]",
73
+ "mask_token": "[MASK]",
74
+ "model_max_length": 1000000000000000019884624838656,
75
+ "pad_token": "[PAD]",
76
+ "sep_token": "[SEP]",
77
+ "sp_model_kwargs": {},
78
+ "split_by_punct": false,
79
+ "tokenizer_class": "DebertaV2Tokenizer",
80
+ "unk_token": "[UNK]",
81
+ "vocab_type": "spm"
82
+ }