Update README.md
Browse files
README.md
CHANGED
@@ -16,7 +16,10 @@ should probably proofread and complete it, then remove this comment. -->
|
|
16 |
|
17 |
# turkish-medical-question-answering
|
18 |
|
19 |
-
This model is a fine-tuned version of [dbmdz/bert-base-turkish-cased](https://huggingface.co/dbmdz/bert-base-turkish-cased)
|
|
|
|
|
|
|
20 |
It achieves the following results on the evaluation set:
|
21 |
- Loss: 1.2814
|
22 |
- Exact Match: 52.7881
|
@@ -32,7 +35,64 @@ Test Metrics
|
|
32 |
'eval_exact_match': 52.78810408921933,
|
33 |
'eval_f1': 76.14367323441282}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
## Model description
|
38 |
|
@@ -40,14 +100,73 @@ More information needed
|
|
40 |
|
41 |
## Intended uses & limitations
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
## Training and evaluation data
|
46 |
|
47 |
-
|
|
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
## Training procedure
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
### Training hyperparameters
|
52 |
|
53 |
The following hyperparameters were used during training:
|
@@ -60,6 +179,8 @@ The following hyperparameters were used during training:
|
|
60 |
- lr_scheduler_warmup_steps: 1000
|
61 |
- num_epochs: 10
|
62 |
|
|
|
|
|
63 |
### Training results
|
64 |
|
65 |
| Training Loss | Epoch | Step | Validation Loss | Exact Match | F1 |
|
@@ -157,3 +278,19 @@ The following hyperparameters were used during training:
|
|
157 |
- Pytorch 2.4.1+cu121
|
158 |
- Datasets 3.1.0
|
159 |
- Tokenizers 0.21.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# turkish-medical-question-answering
|
18 |
|
19 |
+
This model is a fine-tuned version of [dbmdz/bert-base-turkish-cased](https://huggingface.co/dbmdz/bert-base-turkish-cased) optimized for medical domain question answering in Turkish using incidelen/MedTurkQuAD dataset.
|
20 |
+
It uses a BERT-based architecture with additional dropout regularization to prevent overfitting and is specifically trained to extract answers from medical text contexts.
|
21 |
+
|
22 |
+
|
23 |
It achieves the following results on the evaluation set:
|
24 |
- Loss: 1.2814
|
25 |
- Exact Match: 52.7881
|
|
|
35 |
'eval_exact_match': 52.78810408921933,
|
36 |
'eval_f1': 76.14367323441282}
|
37 |
|
38 |
+
## Usage
|
39 |
+
```python
|
40 |
+
# Use a pipeline as a high-level helper
|
41 |
+
from transformers import pipeline
|
42 |
+
|
43 |
+
pipe = pipeline("question-answering", model="kaixkhazaki/turkish-question-answering")
|
44 |
+
|
45 |
+
|
46 |
+
#Enter your text and question
|
47 |
+
|
48 |
+
# Example
|
49 |
+
# Define the context
|
50 |
+
|
51 |
+
context = """
|
52 |
+
Kalça kırığından şüphe duyulan hastalarda öncelikle standart grafiler çekilmelidir. Bunlar ön arka pelvis grafisi ve etkilenen kalçanın ön arka ve yan grafileridir.
|
53 |
+
Özellikle deplase olmayan kırıklarda sağlam taraf ile patolojik tarafın mukayese edilmesi önemlidir. Kırık kalçanın filmi, alt ekstremite hafif traksiyonda iken nötral pozisyonda,
|
54 |
+
patella ışın düzlemine dikey halde çekilir. Trokanter majörün en az 10 cm distaline kadar görülmesi faydalı olacaktır. Ayrıca sağlam tarafın görülmesi ile osteoporoz ve hastanın
|
55 |
+
normal boyun-cisim açısının tayininde önemlidir. Lateral radyografi posteriorda kırığın stabilitesini ve deplasman miktarını belirlemek için gereklidir. Lateral grafi çekimi acil
|
56 |
+
olmamakla birlikte kırığın daha doğru değerlendirilmesi açısından önemlidir. Eğer hasta grafi masasında iken çekilemiyor ise, traksiyon masasına alındığında görülebilir.
|
57 |
+
Nadiren de olsa tanı için tomografi çekilmesi gerekli olabilir. Bunun yanında kalça kırığı şüphesi yüksek olan, ancak direk grafide kırık tanısı konulamayan hastalara MR çekilerek
|
58 |
+
tanı rahatlıkla konulabilir. Yine röntgende görünmeyen ancak kırık şüphesi yüksek olan hastalara 48-72 saat içerisinde yapılan sintigrafilerde duyarlılık % 100'dür.
|
59 |
+
"""
|
60 |
+
|
61 |
+
# Define the question
|
62 |
+
question = "Lateral radyografi hangi durumlar için gereklidir?"
|
63 |
+
|
64 |
+
pipe(question=question, context=context)
|
65 |
+
>>
|
66 |
+
{'score': 0.7423108220100403,
|
67 |
+
'start': 595,
|
68 |
+
'end': 662,
|
69 |
+
'answer': 'posteriorda kırığın stabilitesini ve deplasman miktarını belirlemek'}
|
70 |
|
71 |
+
#Example
|
72 |
+
|
73 |
+
# Define the context
|
74 |
+
context = """
|
75 |
+
Kalça kırığından şüphe duyulan hastalarda öncelikle standart grafiler çekilmelidir. Bunlar ön arka pelvis grafisi ve etkilenen kalçanın ön arka ve yan grafileridir.
|
76 |
+
Özellikle deplase olmayan kırıklarda sağlam taraf ile patolojik tarafın mukayese edilmesi önemlidir. Kırık kalçanın filmi, alt ekstremite hafif traksiyonda iken nötral pozisyonda,
|
77 |
+
patella ışın düzlemine dikey halde çekilir. Trokanter majörün en az 10 cm distaline kadar görülmesi faydalı olacaktır. Ayrıca sağlam tarafın görülmesi ile osteoporoz ve hastanın
|
78 |
+
normal boyun-cisim açısının tayininde önemlidir. Lateral radyografi posteriorda kırığın stabilitesini ve deplasman miktarını belirlemek için gereklidir. Lateral grafi çekimi acil
|
79 |
+
olmamakla birlikte kırığın daha doğru değerlendirilmesi açısından önemlidir. Eğer hasta grafi masasında iken çekilemiyor ise, traksiyon masasına alındığında görülebilir.
|
80 |
+
Nadiren de olsa tanı için tomografi çekilmesi gerekli olabilir. Bunun yanında kalça kırığı şüphesi yüksek olan, ancak direk grafide kırık tanısı konulamayan hastalara MR çekilerek
|
81 |
+
tanı rahatlıkla konulabilir. Yine röntgende görünmeyen ancak kırık şüphesi yüksek olan hastalara 48-72 saat içerisinde yapılan sintigrafilerde duyarlılık % 100'dür.
|
82 |
+
"""
|
83 |
+
|
84 |
+
# Define the question
|
85 |
+
question = "Trokanter majörün kaç cm distaline kadar görülmesi faydalıdır?"
|
86 |
+
|
87 |
+
pipe(question=question, context=context)
|
88 |
+
|
89 |
+
>>
|
90 |
+
{'score': 0.8581815361976624,
|
91 |
+
'start': 416,
|
92 |
+
'end': 418,
|
93 |
+
'answer': '10'}
|
94 |
+
|
95 |
+
```
|
96 |
|
97 |
## Model description
|
98 |
|
|
|
100 |
|
101 |
## Intended uses & limitations
|
102 |
|
103 |
+
**Intended Uses**
|
104 |
+
* Medical question answering in Turkish
|
105 |
+
* Information extraction from Turkish medical texts
|
106 |
+
* Supporting medical professionals and researchers in finding specific information in medical documents
|
107 |
+
|
108 |
+
**Limitations**
|
109 |
+
* The model is specifically trained for the medical domain and may not perform well on general domain questions
|
110 |
+
* Performance may vary on highly technical medical terminology not present in the training data
|
111 |
+
* The model is limited to extractive QA (finding answers that are directly present in the text)
|
112 |
+
|
113 |
+
## Bias, Risks, and Limitations
|
114 |
+
|
115 |
+
* This model should not be used as a substitute for professional medical advice
|
116 |
+
* The model may reflect biases present in the medical training data
|
117 |
+
* Performance may vary across different medical specialties and terminology
|
118 |
+
* The model is not suitable for answering complex medical questions requiring reasoning or synthesis of information
|
119 |
+
|
120 |
+
## Training Details
|
121 |
+
|
122 |
+
|
123 |
+
**Training Hyperparameters**
|
124 |
+
* Base Model: dbmdz/bert-base-turkish-cased
|
125 |
+
* Batch Size: 16
|
126 |
+
* Learning Rate: 1e-5
|
127 |
+
* Number of Epochs: 10
|
128 |
+
* Weight Decay: 0.02
|
129 |
+
* Warmup Steps: 1000
|
130 |
+
* Learning Rate Scheduler: Cosine
|
131 |
+
* Gradient Clipping: 1.0
|
132 |
+
* Training Precision: BF16
|
133 |
+
* Optimizer: AdamW
|
134 |
+
|
135 |
+
**Model Architecture Modifications**
|
136 |
+
* Hidden Dropout Probability: 0.2
|
137 |
+
* Attention Probability Dropout: 0.2
|
138 |
+
|
139 |
|
140 |
## Training and evaluation data
|
141 |
|
142 |
+
The model was trained on the Turkish Medical Question Answering dataset.
|
143 |
+
https://huggingface.co/datasets/incidelen/MedTurkQuAD
|
144 |
|
145 |
+
@INPROCEEDINGS{10711128,
|
146 |
+
author={İncidelen, Mert and Aydoğan, Murat},
|
147 |
+
booktitle={2024 8th International Artificial Intelligence and Data Processing Symposium (IDAP)},
|
148 |
+
title={Developing Question-Answering Models in Low-Resource Languages: A Case Study on Turkish Medical Texts Using Transformer-Based Approaches},
|
149 |
+
year={2024},
|
150 |
+
volume={},
|
151 |
+
number={},
|
152 |
+
pages={1-4},
|
153 |
+
keywords={Training;Adaptation models;Natural languages;Focusing;Encyclopedias;Transformers;Data models;Internet;Online services;Text processing;Natural Language Processing;Medical Domain;BERTurk;Question-Answering},
|
154 |
+
doi={10.1109/IDAP64064.2024.10711128}}
|
155 |
+
|
156 |
## Training procedure
|
157 |
|
158 |
+
**Preprocessing**
|
159 |
+
* Maximum Sequence Length: 384
|
160 |
+
* Stride: 128
|
161 |
+
* Question and context pairs are tokenized using BertTokenizerFast
|
162 |
+
|
163 |
+
**Evaluation Strategy**
|
164 |
+
* Evaluation performed every 50 steps
|
165 |
+
* Best model saved based on F1 score
|
166 |
+
* Metrics as Exact Match and F1 Score
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
### Training hyperparameters
|
171 |
|
172 |
The following hyperparameters were used during training:
|
|
|
179 |
- lr_scheduler_warmup_steps: 1000
|
180 |
- num_epochs: 10
|
181 |
|
182 |
+
|
183 |
+
|
184 |
### Training results
|
185 |
|
186 |
| Training Loss | Epoch | Step | Validation Loss | Exact Match | F1 |
|
|
|
278 |
- Pytorch 2.4.1+cu121
|
279 |
- Datasets 3.1.0
|
280 |
- Tokenizers 0.21.0
|
281 |
+
|
282 |
+
|
283 |
+
|
284 |
+
## Citation
|
285 |
+
|
286 |
+
```bibtex
|
287 |
+
@misc{turkish-medical-question-answering,
|
288 |
+
author = {Fatih Demirci},
|
289 |
+
title = {Turkish Medical Question Answering Model},
|
290 |
+
year = {2024},
|
291 |
+
publisher = {HuggingFace},
|
292 |
+
journal = {HuggingFace Model Hub}
|
293 |
+
howpublished = {\url{https://huggingface.co/kaixkhazaki/turkish-medical-question-answering}}
|
294 |
+
}
|
295 |
+
|
296 |
+
```
|