Instructions to use turkerberkdonmez/TUSGPT-TR-Medical-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="turkerberkdonmez/TUSGPT-TR-Medical-9B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("turkerberkdonmez/TUSGPT-TR-Medical-9B") model = AutoModelForCausalLM.from_pretrained("turkerberkdonmez/TUSGPT-TR-Medical-9B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("turkerberkdonmez/TUSGPT-TR-Medical-9B") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - llama-cpp-python
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="turkerberkdonmez/TUSGPT-TR-Medical-9B", filename="TUSGPT-TR-Medical-9B-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M # Run inference directly in the terminal: llama-cli -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M # Run inference directly in the terminal: llama-cli -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
Use Docker
docker model run hf.co/turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "turkerberkdonmez/TUSGPT-TR-Medical-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "turkerberkdonmez/TUSGPT-TR-Medical-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
- SGLang
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "turkerberkdonmez/TUSGPT-TR-Medical-9B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "turkerberkdonmez/TUSGPT-TR-Medical-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "turkerberkdonmez/TUSGPT-TR-Medical-9B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "turkerberkdonmez/TUSGPT-TR-Medical-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with Ollama:
ollama run hf.co/turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
- Unsloth Studio
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for turkerberkdonmez/TUSGPT-TR-Medical-9B to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for turkerberkdonmez/TUSGPT-TR-Medical-9B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for turkerberkdonmez/TUSGPT-TR-Medical-9B to start chatting
- MLX LM
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "turkerberkdonmez/TUSGPT-TR-Medical-9B"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "turkerberkdonmez/TUSGPT-TR-Medical-9B" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "turkerberkdonmez/TUSGPT-TR-Medical-9B", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with Docker Model Runner:
docker model run hf.co/turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
- Lemonade
How to use turkerberkdonmez/TUSGPT-TR-Medical-9B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull turkerberkdonmez/TUSGPT-TR-Medical-9B:Q4_K_M
Run and chat with the model
lemonade run user.TUSGPT-TR-Medical-9B-Q4_K_M
List all available models
lemonade list
⚕️ TUSGPT-TR-Medical-9B
Türkiye'nin İlk Açık Kaynak Türkçe Medikal Dil Modeli Turkey's First Open-Source Turkish Medical Language Model
🇹🇷 Türkçe Açıklama | 🇬🇧 English Description | 💻 Kullanım/Usage
🇹🇷 Model Hakkında
TUSGPT-TR-Medical-9B, Türkiye'nin medikal alandaki yapay zeka gelişimine katkı sağlamak amacıyla geliştirilmiş, Gemma-2 mimarisine dayalı 9 milyar parametreli bir dil modelidir.
Model, ytu-ce-cosmos/Turkish-Gemma-9b-T1 temel modeli üzerine, 55.000'den fazla yüksek kaliteli Türkçe tıbbi soru-cevap çifti ile 2 aşamalı DoRA (Weight-Decomposed Low-Rank Adaptation) yöntemi kullanılarak fine-tune edilmiştir.
📚 Veri Seti Kapsamı (Dataset Coverage)
Model, aşağıdaki branşları ve daha fazlasını kapsayan 55,465 Türkçe soru-cevap çifti ile eğitilmiştir:
- Temel Bilimler: Farmakoloji, Patoloji, Anatomi, Fizyoloji
- Klinik Bilimler: Dahiliye, Cerrahi, Pediatri, Kadın Doğum
- Diğer: Acil Tıp, Nöroloji, Onkoloji, Radyoloji
🇬🇧 Model Description
TUSGPT-TR-Medical-9B is a specialized 9-billion parameter language model based on the Gemma-2 architecture, designed to advance medical AI research in Turkey.
It is fine-tuned on the ytu-ce-cosmos/Turkish-Gemma-9b-T1 base model using 55,000+ high-quality Turkish medical Q&A pairs, with a 2-Stage DoRA methodology trained on Apple Silicon hardware.
📚 Dataset Scope
The model covers a wide range of medical disciplines with 55,465 Q&A pairs, including:
- Basic Sciences: Pharmacology, Pathology, Anatomy, Physiology
- Clinical Sciences: Internal Medicine, Surgery, Pediatrics, Obstetrics & Gynecology
- Others: Emergency Medicine, Neurology, Oncology, Radiology
📊 Teknik Detaylar / Technical Details
| Özellik / Feature | Detay / Detail |
|---|---|
| Base Model | ytu-ce-cosmos/Turkish-Gemma-9b-T1 |
| Architecture | Gemma 2 (9.24B Parameters) |
| Dataset | turkerberkdonmez/TUSGPT-TR-Medical-Dataset-v1 |
| Dataset Size | 55,465 samples (Q&A) |
| Training Method | 2-Stage DoRA (Weight-Decomposed LoRA) |
| Precision | bfloat16 |
| Hardware | Apple Mac Studio (M-Series, 128GB Unified Memory) |
🔬 Eğitim Parametrelerini Görüntüle / View Training Hyperparameters
Stage 1 — Aggressive Knowledge Injection
- DoRA: rank=64, alpha=128, target_modules=all linear layers
- Optimizer: NEFTune (alpha=3) enabled
- Learning Rate: 2e-5 → 2e-6 (cosine decay)
- Steps: 1600 iterations (~1 epoch)
Stage 2 — Stabilization
- Config: Resumed from Stage 1 best checkpoint
- Optimizer: NEFTune disabled
- Learning Rate: 5e-6 → 1e-7
- Steps: 1000 iterations
- Final Val Loss: 1.126
💻 Kullanım / Usage
🐍 Python (Transformers)
Generation önerisi: Temperature=0.6, TopP=0.95, TopK=20, MinP=0 (generation_config.json varsayılanı).
Greedy decoding kullanmayın; performans düşüşüne ve sonsuz tekrarlara yol açabilir.
Complex tasks:max_new_tokensdeğerini artırın. Gerekirserepetition_penaltyvepresence_penalty(0–2) ayarlanabilir.
Not: Daha yüksek değerler bazen dil karışmasına ve hafif performans düşüşüne neden olabilir.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "turkerberkdonmez/TUSGPT-TR-Medical-9B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "Sen tıp alanında uzmanlaşmış, Türkçe yanıt veren bir yapay zeka asistanısın. Soruları doğru, kapsamlı ve anlaşılır biçimde yanıtla."},
{"role": "user", "content": "Akut miyokard enfarktüsünün erken belirtileri nelerdir?"},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512, # complex tasks için artırılabilir
temperature=0.6,
top_p=0.95,
top_k=20,
# min_p Transformers'ta her zaman desteklenmeyebilir; model config'ine bağlıdır.
# Aşağıdakiler opsiyonel: tekrarları azaltmak için
# repetition_penalty=1.15,
# presence_penalty=0.3,
do_sample=True, # greedy decoding kapalı
)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
🦙 GGUF (Ollama & LM Studio)
Bu modelin sıkıştırılmış (quantized) versiyonları yerel cihazlarda çalıştırılabilir.
| Dosya Adı (Filename) | Quant | Boyut (Size) | Önerilen Donanım (Recommended HW) |
|---|---|---|---|
TUSGPT-TR-Medical-9B-Q8_0.gguf |
Q8_0 | ~9.8 GB | 12GB+ VRAM / 16GB+ RAM |
TUSGPT-TR-Medical-9B-Q4_K_M.gguf |
Q4_K_M | ~5.8 GB | 8GB+ VRAM / 12GB+ RAM |
Ollama Setup
Önerilen üretim ayarları: Temperature=0.6, TopP=0.95, TopK=20, MinP=0
Greedy decoding kullanmayın; performans düşüşü ve sonsuz tekrar riski yaratabilir.
Complex tasks:num_predict(max_new_tokens) artırılabilir.
Tekrarlar olursarepeat_penaltyvepresence_penalty(0–2) ayarlanabilir (yüksek değerler bazen dil karışmasına ve hafif performans düşüşüne yol açabilir).
- Modelfile Oluşturun / Create Modelfile:
FROM ./TUSGPT-TR-Medical-9B-Q4_K_M.gguf
SYSTEM "Sen tıp alanında uzmanlaşmış, Türkçe yanıt veren bir yapay zeka asistanısın. Soruları doğru, kapsamlı ve anlaşılır biçimde yanıtla."
# Recommended generation (DO NOT use greedy decoding)
PARAMETER temperature 0.6
PARAMETER top_p 0.95
PARAMETER top_k 20
PARAMETER min_p 0
# Complex tasks: increase num_predict
# PARAMETER num_predict 1024
# To reduce endless repetitions (optional; tune gradually)
# PARAMETER repeat_penalty 1.15
# PARAMETER presence_penalty 0.3
- Modeli Çalıştırın / Run Model:
ollama create tusgpt-medical -f Modelfile
ollama run tusgpt-medical
⚠️ Yasal Uyarı / Disclaimer
🇹🇷 Türkçe
Bu model eğitim ve araştırma amaçlıdır. Klinik karar verme süreçlerinde tek başına kullanılmamalıdır. Tıbbi kararlar için her zaman uzman hekime danışın.
🇬🇧 English
This model is for educational and research purposes only. It should not be used as a sole source for clinical decision-making. Always consult a qualified physician for medical decisions.
🤝 Acknowledgments
- Base Model: YTU CE COSMOS Lab — Turkish-Gemma-9b-T1
- Training Framework: MLX by Apple
📝 Citation
@misc{tusgpt-tr-medical-9b,
title = {TUSGPT-TR-Medical-9B: Turkish Medical Language Model},
author = {Türker Berk Dönmez},
year = {2026},
url = {https://huggingface.co/turkerberkdonmez/TUSGPT-TR-Medical-9B}
}
- Downloads last month
- 662
Quantized
Model tree for turkerberkdonmez/TUSGPT-TR-Medical-9B
Base model
ytu-ce-cosmos/Turkish-Gemma-9b-T1