Update README.md
Browse files
README.md
CHANGED
@@ -1,22 +1,199 @@
|
|
1 |
---
|
2 |
base_model: sambanovasystems/SambaLingo-Turkish-Chat
|
3 |
language:
|
4 |
-
-
|
5 |
-
license:
|
6 |
tags:
|
7 |
-
- text-generation-inference
|
8 |
- transformers
|
9 |
- unsloth
|
10 |
- llama
|
11 |
- trl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
-
#
|
15 |
|
16 |
-
|
17 |
-
- **License:** apache-2.0
|
18 |
-
- **Finetuned from model :** sambanovasystems/SambaLingo-Turkish-Chat
|
19 |
|
20 |
-
|
21 |
|
22 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
base_model: sambanovasystems/SambaLingo-Turkish-Chat
|
3 |
language:
|
4 |
+
- tr
|
5 |
+
license: mit
|
6 |
tags:
|
|
|
7 |
- transformers
|
8 |
- unsloth
|
9 |
- llama
|
10 |
- trl
|
11 |
+
- sft
|
12 |
+
- turkish
|
13 |
+
datasets:
|
14 |
+
- kayrab/patient-doctor-qa-tr-321179
|
15 |
+
metrics:
|
16 |
+
- bleu
|
17 |
+
- bertscore
|
18 |
+
- rouge
|
19 |
+
- cer
|
20 |
+
- wer
|
21 |
+
- meteor
|
22 |
+
pipeline_tag: question-answering
|
23 |
---
|
24 |
|
25 |
+
# Doktor Sambalingo Llama 2 Lora Modeli
|
26 |
|
27 |
+
## Genel Bakış
|
|
|
|
|
28 |
|
29 |
+
**Doktor Sambalingo Llama 2 Lora**, Türkçe sağlık danışmanlığı alanında kullanılmak üzere geliştirilmiş bir büyük dil modelidir. Bu model, doktor-hasta yazılı iletişimindeki performansı iyileştirmek ve hastalara daha doğru ve bağlama uygun yanıtlar sunmak amacıyla oluşturulmuştur.
|
30 |
|
31 |
+
Bu model, [Muhammed Kayra Bulut](https://github.com/kaayra2000) tarafından hazırlanan yüksek lisans tezi kapsamında geliştirilmiştir.
|
32 |
+
|
33 |
+
## Özellikler
|
34 |
+
|
35 |
+
- **Dil**: Türkçe
|
36 |
+
- **Model Boyutu**: 7 milyar parametre
|
37 |
+
- **Taban Model**: SambaLingo-Turkish-Chat
|
38 |
+
- **Eğitim Verisi**: 321.179 adet Türkçe hasta-doktor soru-cevap çiftinden oluşan özel bir veri kümesi kullanılmıştır.
|
39 |
+
- **Amaç**: Türkçe sağlık danışmanlığı alanında etkili ve güvenilir bir dil modeli oluşturmak.
|
40 |
+
|
41 |
+
## Eğitim Süreci
|
42 |
+
|
43 |
+
Modelin eğitimi ve ince ayarı şu adımlarla gerçekleştirilmiştir:
|
44 |
+
|
45 |
+
1. **Veri Toplama ve İşleme**: Doktor-hasta yazılı iletişimlerinden oluşan geniş bir veri kümesi toplanmış, temizlenmiş ve modele uygun hale getirilmiştir.
|
46 |
+
2. **İnce Ayar (Fine-Tuning)**: SambaLingo-Turkish-Chat tabanlı model, Türkçe sağlık verileriyle ince ayar yapılarak eğitilmiştir.
|
47 |
+
3. **Değerlendirme**: Modelin performansı ROUGE, BLEU, BERT Score gibi metriklerle ve uzman değerlendirmeleriyle ölçülmüştür.
|
48 |
+
|
49 |
+
## Performans ve Sonuçlar
|
50 |
+
|
51 |
+
Yapılan değerlendirmeler sonucunda, Doktor Sambalingo Llama 2 Lora modelinin Türkçe sağlık danışmanlığı alanında aşağıdaki başarılara ulaştığı tespit edilmiştir:
|
52 |
+
|
53 |
+
- **Yüksek Doğruluk**: Model, hasta sorularına doğru ve bağlama uygun yanıtlar verebilmektedir.
|
54 |
+
- **Etkili İletişim**: Doktor-hasta iletişiminde anlaşılırlığı artırarak, tıbbi bilgileri hastaların anlayabileceği bir dilde sunabilmektedir.
|
55 |
+
- **Uzman Onayı**: Uzman doktorlar tarafından yapılan değerlendirmelerde olumlu geri bildirimler alınmıştır.
|
56 |
+
|
57 |
+
Daha detaylı bilgi için [yüksek lisans tezine](https://tez.yok.gov.tr/UlusalTezMerkezi/TezGoster?key=E_eEUHQic_C-LvhxNQn1W9jmOJLuQUDfAO_NPVlpSUbRZEUJN9xUZ4i3VXSzTN_H) başvurabilirsiniz.
|
58 |
+
|
59 |
+
## Kullanım Alanları
|
60 |
+
|
61 |
+
- **Sağlık Danışmanlığı**: Hasta sorularına hızlı ve doğru yanıtlar sunarak sağlık hizmetlerini destekler.
|
62 |
+
- **Eğitim ve Araştırma**: Tıp öğrencileri ve araştırmacılar için yardımcı bir araç olarak kullanılabilir.
|
63 |
+
- **Hasta Bilgilendirme**: Tıbbi terimleri anlaşılır bir dilde açıklayarak hasta eğitimine katkıda bulunur.
|
64 |
+
|
65 |
+
## Kurulum ve Kullanım
|
66 |
+
|
67 |
+
1. **Gereksinimler**:
|
68 |
+
|
69 |
+
- Python 3.8+
|
70 |
+
- PyTorch
|
71 |
+
- Transformers kütüphanesi
|
72 |
+
|
73 |
+
2. **Kurulum**:
|
74 |
+
|
75 |
+
```bash
|
76 |
+
git clone https://github.com/kayrab/doktor-LLama2-sambanovasystems-7b.git
|
77 |
+
cd doktor-LLama2-sambanovasystems-7b
|
78 |
+
```
|
79 |
+
3. **Modelin Yüklenmesi ve Kullanımı:**
|
80 |
+
|
81 |
+
```python
|
82 |
+
from huggingface_hub import login
|
83 |
+
login("hesaba_ait_token")
|
84 |
+
|
85 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
86 |
+
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained("kayrab/doktor-LLama2-sambanovasystems-7b")
|
88 |
+
model = AutoModelForCausalLM.from_pretrained("kayrab/doktor-LLama2-sambanovasystems-7b")
|
89 |
+
|
90 |
+
# Prompt'u input_text ile doldurmak için format kullanıyoruz
|
91 |
+
input_text = "Merhaba doktor, baş ağrım ve ateşim var. Ne yapmalıyım?"
|
92 |
+
prompt = """Sen bir doktorsun. Soruları buna göre cevapla.
|
93 |
+
### Soru:
|
94 |
+
{}
|
95 |
+
|
96 |
+
### Cevap:
|
97 |
+
{}""".format(input_text, "") # input_text'i yerleştiriyoruz, cevap kısmı boş bırakılıyor
|
98 |
+
|
99 |
+
# Tokenizer ile prompt'u işliyoruz
|
100 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
101 |
+
outputs = model.generate(**inputs)
|
102 |
+
|
103 |
+
# Modelin çıktısını decode ediyoruz
|
104 |
+
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
105 |
+
|
106 |
+
print(answer)
|
107 |
+
```
|
108 |
+
|
109 |
+
## Referanslar
|
110 |
+
Yüksek Lisans Tezi: [Sağlık Verileri Üzerinde Büyük Dil Modellerinin İnce Ayar Performansı - Muhammed Kayra Bulut, Yıldız Teknik Üniversitesi, 2024.](https://tez.yok.gov.tr/UlusalTezMerkezi/TezGoster?key=E_eEUHQic_C-LvhxNQn1W9jmOJLuQUDfAO_NPVlpSUbRZEUJN9xUZ4i3VXSzTN_H)
|
111 |
+
|
112 |
+
# Doctor Sambalingo Llama 2 Lora Model
|
113 |
+
|
114 |
+
## Overview
|
115 |
+
|
116 |
+
**Doctor Sambalingo Llama 2 Lora** is a large language model developed for use in Turkish health consultancy. This model aims to improve the performance of written communication between doctors and patients and provide patients with more accurate and context-appropriate responses.
|
117 |
+
|
118 |
+
This model was developed as part of a master's thesis prepared by [Muhammed Kayra Bulut](https://github.com/kaayra2000).
|
119 |
+
|
120 |
+
## Features
|
121 |
+
|
122 |
+
- **Language**: Turkish
|
123 |
+
- **Model Size**: 7 billion parameters
|
124 |
+
- **Base Model**: SambaLingo-Turkish-Chat
|
125 |
+
- **Training Data**: A special dataset consisting of 321,179 Turkish patient-doctor question-answer pairs was used.
|
126 |
+
- **Purpose**: To create an effective and reliable language model in the field of Turkish health consultancy.
|
127 |
+
|
128 |
+
## Training Process
|
129 |
+
|
130 |
+
The training and fine-tuning of the model were carried out in the following steps:
|
131 |
+
|
132 |
+
1. **Data Collection and Processing**: A large dataset consisting of written doctor-patient communications was collected, cleaned, and prepared for the model.
|
133 |
+
2. **Fine-Tuning**: The base model Meta-Llama-3-8B was fine-tuned using Turkish health data.
|
134 |
+
3. **Evaluation**: The model's performance was measured using metrics such as ROUGE, BLEU, BERT Score, and expert evaluations.
|
135 |
+
|
136 |
+
## Performance and Results
|
137 |
+
|
138 |
+
As a result of the evaluations, it was determined that the Doctor Sambalingo Llama 2 Lora model achieved the following successes in the field of Turkish health consultancy:
|
139 |
+
|
140 |
+
- **High Accuracy**: The model can provide accurate and context-appropriate responses to patient questions.
|
141 |
+
- **Effective Communication**: It enhances clarity in doctor-patient communication by presenting medical information in a language that patients can understand.
|
142 |
+
- **Expert Approval**: Positive feedback was received from evaluations conducted by expert doctors.
|
143 |
+
|
144 |
+
For more detailed information, you can refer to the [master's thesis](https://tez.yok.gov.tr/UlusalTezMerkezi/TezGoster?key=E_eEUHQic_C-LvhxNQn1W9jmOJLuQUDfAO_NPVlpSUbRZEUJN9xUZ4i3VXSzTN_H).
|
145 |
+
|
146 |
+
## Use Cases
|
147 |
+
|
148 |
+
- **Health Consultancy**: Supports health services by providing quick and accurate responses to patient questions.
|
149 |
+
- **Education and Research**: Can be used as an assistant tool for medical students and researchers.
|
150 |
+
- **Patient Education**: Contributes to patient education by explaining medical terms in understandable language.
|
151 |
+
|
152 |
+
## Installation and Usage
|
153 |
+
|
154 |
+
1. **Requirements**:
|
155 |
+
|
156 |
+
- Python 3.8+
|
157 |
+
- PyTorch
|
158 |
+
- Transformers library
|
159 |
+
|
160 |
+
2. **Installation**:
|
161 |
+
|
162 |
+
```bash
|
163 |
+
git clone https://github.com/kayrab/doktor-LLama2-sambanovasystems-7b.git
|
164 |
+
cd doktor-LLama2-sambanovasystems-7b
|
165 |
+
```
|
166 |
+
|
167 |
+
3. **Loading and Using the Model:**
|
168 |
+
|
169 |
+
```python
|
170 |
+
from huggingface_hub import login
|
171 |
+
login("your_token")
|
172 |
+
|
173 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
174 |
+
|
175 |
+
tokenizer = AutoTokenizer.from_pretrained("kayrab/doktor-LLama2-sambanovasystems-7b")
|
176 |
+
model = AutoModelForCausalLM.from_pretrained("kayrab/doktor-LLama2-sambanovasystems-7b")
|
177 |
+
|
178 |
+
# Fill in the prompt with input_text
|
179 |
+
input_text = "Merhaba doktor, baş ağrım ve ateşim var. Ne yapmalıyım?"
|
180 |
+
prompt = """Sen bir doktorsun. Soruları buna göre cevapla.
|
181 |
+
### Soru:
|
182 |
+
{}
|
183 |
+
|
184 |
+
### Cevap:
|
185 |
+
{}""".format(input_text, "") # We place input_text and leave the answer section empty
|
186 |
+
|
187 |
+
# Process the prompt with the tokenizer
|
188 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
189 |
+
outputs = model.generate(**inputs)
|
190 |
+
|
191 |
+
# Decode the model's output
|
192 |
+
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
193 |
+
|
194 |
+
print(answer)
|
195 |
+
```
|
196 |
+
|
197 |
+
## References
|
198 |
+
|
199 |
+
Master's Thesis: [Fine-Tuning Performance of Large Language Models on Health Data - Muhammed Kayra Bulut, Yıldız Technical University, 2024.](https://tez.yok.gov.tr/UlusalTezMerkezi/TezGoster?key=E_eEUHQic_C-LvhxNQn1W9jmOJLuQUDfAO_NPVlpSUbRZEUJN9xUZ4i3VXSzTN_H)
|