--- 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 Modeli ## Genel Bakış **Doktor Cosmos Llama 3**, 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 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 Model ## Overview **Doctor Cosmos Llama 3** 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 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)