Instructions to use kayrab/doktor-llama-3-cosmos-8b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kayrab/doktor-llama-3-cosmos-8b-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("question-answering", model="kayrab/doktor-llama-3-cosmos-8b-lora")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("kayrab/doktor-llama-3-cosmos-8b-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
File size: 8,117 Bytes
93acb6c 48fe345 93acb6c 48fe345 9882c7a 48fe345 9882c7a 93acb6c 48fe345 93acb6c 48fe345 93acb6c 48fe345 93acb6c 48fe345 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 | ---
base_model: ytu-ce-cosmos/Turkish-Llama-8b-v0.1
language:
- tr
license: mit
tags:
- transformers
- unsloth
- llama
- trl
- sft
- turkish
datasets:
- kayrab/patient-doctor-qa-tr-321179
metrics:
- bleu
- bertscore
- rouge
- cer
- wer
- meteor
pipeline_tag: question-answering
---
# Doktor Cosmos Llama 3 Lora Modeli
## Genel Bakış
**Doktor Cosmos Llama 3 Lora 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.
Bu model, [Muhammed Kayra Bulut](https://github.com/kaayra2000) tarafından hazırlanan yüksek lisans tezi kapsamında geliştirilmiştir.
## Özellikler
- **Dil**: Türkçe
- **Model Boyutu**: 8 milyar parametre
- **Taban Model**: Turkish-Llama-8b-v0.1
- **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.
- **Amaç**: Türkçe sağlık danışmanlığı alanında etkili ve güvenilir bir dil modeli oluşturmak.
## Eğitim Süreci
Modelin eğitimi ve ince ayarı şu adımlarla gerçekleştirilmiştir:
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.
2. **İnce Ayar (Fine-Tuning)**: Turkish-Llama-8b-v0.1 tabanlı model, Türkçe sağlık verileriyle ince ayar yapılarak eğitilmiştir.
3. **Değerlendirme**: Modelin performansı ROUGE, BLEU, BERT Score gibi metriklerle ve uzman değerlendirmeleriyle ölçülmüştür.
## Performans ve Sonuçlar
Yapılan değerlendirmeler sonucunda, Doktor Cosmos Llama 3 Lora modelinin Türkçe sağlık danışmanlığı alanında aşağıdaki başarılara ulaştığı tespit edilmiştir:
- **Yüksek Doğruluk**: Model, hasta sorularına doğru ve bağlama uygun yanıtlar verebilmektedir.
- **Etkili İletişim**: Doktor-hasta iletişiminde anlaşılırlığı artırarak, tıbbi bilgileri hastaların anlayabileceği bir dilde sunabilmektedir.
- **Uzman Onayı**: Uzman doktorlar tarafından yapılan değerlendirmelerde olumlu geri bildirimler alınmıştır.
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.
## Kullanım Alanları
- **Sağlık Danışmanlığı**: Hasta sorularına hızlı ve doğru yanıtlar sunarak sağlık hizmetlerini destekler.
- **Eğitim ve Araştırma**: Tıp öğrencileri ve araştırmacılar için yardımcı bir araç olarak kullanılabilir.
- **Hasta Bilgilendirme**: Tıbbi terimleri anlaşılır bir dilde açıklayarak hasta eğitimine katkıda bulunur.
## Kurulum ve Kullanım
1. **Gereksinimler**:
- Python 3.8+
- PyTorch
- Transformers kütüphanesi
2. **Kurulum**:
```bash
git clone https://github.com/kayrab/doktor-llama-3-cosmos-8b.git
cd doktor-llama-3-cosmos-8b
```
3. **Modelin Yüklenmesi ve Kullanımı:**
```python
from huggingface_hub import login
login("hesaba_ait_token")
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("kayrab/doktor-llama-3-cosmos-8b")
model = AutoModelForCausalLM.from_pretrained("kayrab/doktor-llama-3-cosmos-8b")
# Prompt'u input_text ile doldurmak için format kullanıyoruz
input_text = "Merhaba doktor, baş ağrım ve ateşim var. Ne yapmalıyım?"
prompt = """Sen bir doktorsun. Soruları buna göre cevapla.
### <|reserved_special_token_0|>:
{}
### <|reserved_special_token_1|>:
{}""".format(input_text, "") # input_text'i yerleştiriyoruz, cevap kısmı boş bırakılıyor
# Tokenizer ile prompt'u işliyoruz
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs)
# Modelin çıktısını decode ediyoruz
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(answer)
```
## Referanslar
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)
# Doctor Cosmos Llama 3 Lora Model
## Overview
**Doctor Cosmos Llama 3 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.
This model was developed as part of a master's thesis prepared by [Muhammed Kayra Bulut](https://github.com/kaayra2000).
## Features
- **Language**: Turkish
- **Model Size**: 8 billion parameters
- **Base Model**: Turkish-Llama-8b-v0.1
- **Training Data**: A special dataset consisting of 321,179 Turkish patient-doctor question-answer pairs was used.
- **Purpose**: To create an effective and reliable language model in the field of Turkish health consultancy.
## Training Process
The training and fine-tuning of the model were carried out in the following steps:
1. **Data Collection and Processing**: A large dataset consisting of written doctor-patient communications was collected, cleaned, and prepared for the model.
2. **Fine-Tuning**: The base model Turkish-Llama-8b-v0.1 was fine-tuned using Turkish health data.
3. **Evaluation**: The model's performance was measured using metrics such as ROUGE, BLEU, BERT Score, and expert evaluations.
## Performance and Results
As a result of the evaluations, it was determined that the Doctor Cosmos Llama 3 Lora model achieved the following successes in the field of Turkish health consultancy:
- **High Accuracy**: The model can provide accurate and context-appropriate responses to patient questions.
- **Effective Communication**: It enhances clarity in doctor-patient communication by presenting medical information in a language that patients can understand.
- **Expert Approval**: Positive feedback was received from evaluations conducted by expert doctors.
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).
## Use Cases
- **Health Consultancy**: Supports health services by providing quick and accurate responses to patient questions.
- **Education and Research**: Can be used as an assistant tool for medical students and researchers.
- **Patient Education**: Contributes to patient education by explaining medical terms in understandable language.
## Installation and Usage
1. **Requirements**:
- Python 3.8+
- PyTorch
- Transformers library
2. **Installation**:
```bash
git clone https://github.com/kayrab/doktor-llama-3-cosmos-8b.git
cd doktor-llama-3-cosmos-8b
```
3. **Loading and Using the Model:**
```python
from huggingface_hub import login
login("your_token")
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("kayrab/doktor-llama-3-cosmos-8b")
model = AutoModelForCausalLM.from_pretrained("kayrab/doktor-llama-3-cosmos-8b")
# Fill in the prompt with input_text
input_text = "Merhaba doktor, baş ağrım ve ateşim var. Ne yapmalıyım?"
prompt = """Sen bir doktorsun. Soruları buna göre cevapla.
### <|reserved_special_token_0|>:
{}
### <|reserved_special_token_1|>:
{}""".format(input_text, "") # We place input_text and leave the answer section empty
# Process the prompt with the tokenizer
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs)
# Decode the model's output
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(answer)
```
## References
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) |