Update model card with info
Browse files
README.md
CHANGED
|
@@ -1,199 +1,174 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
-
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
-
|
| 36 |
-
## Uses
|
| 37 |
-
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
-
### Direct Use
|
| 41 |
-
|
| 42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
- **
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
|
| 141 |
-
##
|
| 142 |
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
-
|
| 146 |
|
| 147 |
-
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
|
| 153 |
-
|
|
|
|
| 154 |
|
| 155 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
-
|
|
|
|
| 158 |
|
| 159 |
-
#
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
-
|
| 162 |
|
| 163 |
-
|
|
|
|
|
|
|
| 164 |
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
#
|
|
|
|
|
|
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
#
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
-
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
| 190 |
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
-
##
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
-
##
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
license: other
|
| 3 |
+
base_model: DedalusHealthCare/tinybert-mlm-en
|
| 4 |
+
datasets:
|
| 5 |
+
- DedalusHealthCare/ner_demo_en
|
| 6 |
+
task_categories:
|
| 7 |
+
- token-classification
|
| 8 |
+
task_ids:
|
| 9 |
+
- named-entity-recognition
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
tags:
|
| 13 |
+
- token-classification
|
| 14 |
+
- ner
|
| 15 |
+
- named-entity-recognition
|
| 16 |
+
- en
|
| 17 |
+
- disorder_finding
|
| 18 |
library_name: transformers
|
| 19 |
+
pipeline_tag: token-classification
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# TinyBERT for Demo NER (English)
|
| 23 |
|
| 24 |
+
## Model Description
|
| 25 |
|
| 26 |
+
This model is a fine-tuned TinyBERT model for Named Entity Recognition (NER) of DISORDER_FINDING entities in English medical texts.
|
| 27 |
|
| 28 |
+
It was fine-tuned from the [DedalusHealthCare/tinybert-mlm-en](https://huggingface.co/DedalusHealthCare/tinybert-mlm-en) masked language model using the [DedalusHealthCare/ner_demo_en](https://huggingface.co/datasets/DedalusHealthCare/ner_demo_en) dataset.
|
| 29 |
|
| 30 |
+
**Base Model**: [DedalusHealthCare/tinybert-mlm-en](https://huggingface.co/DedalusHealthCare/tinybert-mlm-en)
|
| 31 |
|
| 32 |
+
**Training Dataset**: [DedalusHealthCare/ner_demo_en](https://huggingface.co/datasets/DedalusHealthCare/ner_demo_en)
|
| 33 |
|
| 34 |
+
**Task**: Token Classification (Named Entity Recognition)
|
| 35 |
|
| 36 |
+
**Language**: English (en)
|
| 37 |
|
| 38 |
+
**Entities**: DISORDER_FINDING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
**Model Format**: PYTORCH
|
| 41 |
|
| 42 |
+
**Please use `max` as aggregation strategy in the NER pipeline (see example below)**.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
## Training Details
|
| 45 |
|
| 46 |
+
- **Training epochs**: 1
|
| 47 |
+
- **Learning rate**: 5e-05
|
| 48 |
+
- **Training batch size**: 32
|
| 49 |
+
- **Evaluation batch size**: 32
|
| 50 |
+
- **Max sequence length**: 256
|
| 51 |
+
- **Warmup ratio**: 0.1
|
| 52 |
+
- **Weight decay**: 0.01
|
| 53 |
+
- **FP16**: True
|
| 54 |
+
- **Gradient accumulation steps**: 2
|
| 55 |
+
- **Save steps**: 50000
|
| 56 |
+
- **Evaluation steps**: 50000
|
| 57 |
+
- **Evaluation strategy**: steps
|
| 58 |
+
- **Random seed**: 1
|
| 59 |
+
- **Label all tokens**: True
|
| 60 |
+
- **Balanced training**: False
|
| 61 |
+
- **Chunk mode**: sliding_window
|
| 62 |
+
- **Stride**: 16
|
| 63 |
+
- **Max training samples**: None
|
| 64 |
+
- **Max evaluation samples**: None
|
| 65 |
+
- **Early stopping patience**: 0
|
| 66 |
+
- **Early stopping threshold**: 0.0
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
### Build Information
|
| 70 |
+
- **Git Commit**: [9583c80](https://github.com/Dedalus-clinalytix/prod/commit/9583c80da9b9567b72c69d953854871a9badc139)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
+
## Use Case Configuration
|
| 73 |
|
| 74 |
+
- **Use case name**: demo
|
| 75 |
+
- **Language**: English (en)
|
| 76 |
+
- **Target entities**: DISORDER_FINDING
|
| 77 |
+
- **Text processing max length**: N/A
|
| 78 |
+
- **Entity labeling scheme**: N/A
|
| 79 |
|
| 80 |
+
## Usage
|
| 81 |
|
| 82 |
+
### Using Transformers Pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
```python
|
| 85 |
+
from transformers import pipeline
|
| 86 |
|
| 87 |
+
# Load the model
|
| 88 |
+
ner_pipeline = pipeline(
|
| 89 |
+
"ner",
|
| 90 |
+
model="DedalusHealthCare/tinybert-ner-demo-en",
|
| 91 |
+
tokenizer="DedalusHealthCare/tinybert-ner-demo-en",
|
| 92 |
+
aggregation_strategy="max"
|
| 93 |
+
)
|
| 94 |
|
| 95 |
+
# Example text
|
| 96 |
+
text = "Der Patient hat Diabetes und Bluthochdruck."
|
| 97 |
|
| 98 |
+
# Get predictions
|
| 99 |
+
entities = ner_pipeline(text)
|
| 100 |
+
print(entities)
|
| 101 |
+
```
|
| 102 |
|
| 103 |
+
### Using AutoModel and AutoTokenizer
|
| 104 |
|
| 105 |
+
```python
|
| 106 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 107 |
+
import torch
|
| 108 |
|
| 109 |
+
# Load model and tokenizer
|
| 110 |
+
model_name = "DedalusHealthCare/tinybert-ner-demo-en"
|
| 111 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 112 |
+
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 113 |
|
| 114 |
+
# Tokenize text
|
| 115 |
+
text = "Der Patient hat Diabetes und Bluthochdruck."
|
| 116 |
+
tokens = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
| 117 |
|
| 118 |
+
# Get predictions
|
| 119 |
+
with torch.no_grad():
|
| 120 |
+
outputs = model(**tokens)
|
| 121 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 122 |
|
| 123 |
+
# Get labels
|
| 124 |
+
predicted_token_class_ids = predictions.argmax(-1)
|
| 125 |
+
labels = [model.config.id2label[id.item()] for id in predicted_token_class_ids[0]]
|
| 126 |
+
```
|
| 127 |
|
| 128 |
+
## Model Architecture
|
| 129 |
|
| 130 |
+
This model is based on the TinyBERT architecture with a token classification head for Named Entity Recognition.
|
| 131 |
|
| 132 |
+
## Intended Use
|
| 133 |
|
| 134 |
+
This model is intended for:
|
| 135 |
+
- Named Entity Recognition in English medical texts
|
| 136 |
+
- Identification of DISORDER_FINDING entities
|
| 137 |
+
- Medical text processing and analysis
|
| 138 |
+
- Research and development in medical NLP
|
| 139 |
|
| 140 |
+
## Limitations
|
| 141 |
|
| 142 |
+
- Trained specifically for English medical texts
|
| 143 |
+
- Performance may vary on texts from different medical domains
|
| 144 |
+
- May not generalize well to non-medical texts
|
| 145 |
+
- Requires careful evaluation on new datasets
|
| 146 |
+
|
| 147 |
+
## Ethical Considerations
|
| 148 |
|
| 149 |
+
- This model is trained on medical data and should be used responsibly
|
| 150 |
+
- Outputs should be validated by medical professionals
|
| 151 |
+
- Patient privacy and data protection regulations must be followed
|
| 152 |
+
- The model may have biases present in the training data
|
| 153 |
|
| 154 |
+
## Citation
|
| 155 |
|
| 156 |
+
If you use this model, please cite:
|
| 157 |
|
| 158 |
+
```bibtex
|
| 159 |
+
@model{demo_en_ner_model,
|
| 160 |
+
title = {TinyBERT for Demo NER (English)},
|
| 161 |
+
author = {DH Healthcare GmbH},
|
| 162 |
+
year = {2025},
|
| 163 |
+
publisher = {Hugging Face},
|
| 164 |
+
url = {https://huggingface.co/DedalusHealthCare/tinybert-ner-demo-en}
|
| 165 |
+
}
|
| 166 |
+
```
|
| 167 |
|
| 168 |
+
## License
|
| 169 |
|
| 170 |
+
This model is proprietary and owned by DH Healthcare GmbH. All rights reserved.
|
| 171 |
|
| 172 |
+
## Contact
|
| 173 |
|
| 174 |
+
For questions or support, please contact DH Healthcare GmbH.
|