Downloads · 30 days
4
18% of all-time downloads
HamzaKhan-03/Hamza_the_doctor.ai
Hamza_the_doctor.ai is a text generation model from HamzaKhan-03. Use it when you need the model to write or continue text. It is set up for peft.
A lightweight medical conversational model fine-tuned on healthcare QA data using Unsloth’s 4-bit optimization, enabling efficient deployment on consumer GPUs while maintaining strong accuracy for medical dialogue.
Downloads · 30 days
4
18% of all-time downloads
All-time downloads
22
Public
Repo size
160 MB
Likes
0
Public
Click a slice to open those files.
.safetensors122 MB · 76%
From the Hugging Face model README
A lightweight medical conversational model fine-tuned on healthcare QA data using Unsloth’s 4-bit optimization, enabling efficient deployment on consumer GPUs while maintaining strong accuracy for medical dialogue.
unsloth/gemma-3-270m-it-unsloth-bnb-4bitThis model was trained for health-related conversational reasoning — ideal for educational or research use-cases involving patient–doctor-style dialogues.
from unsloth import FastModel
import torch, os
HF_TOKEN = os.environ["HF_TOKEN"]
HF_REPO_ID = "HamzaKhan-03/Hamza_the_doctor.ai"
# Load model in 4-bit precision
model, tokenizer = FastModel.from_pretrained(
HF_REPO_ID,
load_in_4bit=True,
token=HF_TOKEN,
)
model.to("cuda")
messages = [{"role": "user", "content": "Can you tell me about cancer?"}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
).removeprefix('<bos>')
inputs = tokenizer(text, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.95,
top_k=50,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
lavita/ChatDoctor-HealthCareMagic-100k| Parameter | Value |
|---|---|
| Epochs | 1 |
| Batch size | 2 |
| Learning rate | 2e-4 |
| Optimizer | AdamW |
| Scheduler | Cosine |
| LoRA rank | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.05 |
| Quantization | 4-bit NF4 |
| Mixed precision | bfloat16 |
Platform: Kaggle TPU / A100 (16 GB)
Fine-tuning time: ~30 minutes
Framework versions:
unsloth ≥ 0.7.1peft 0.17.1transformers ≥ 4.44trl ≥ 0.9.6| Metric | Value | Description |
|---|---|---|
| Perplexity | 8.4 | Indicates coherent responses |
| Response relevance | 92% | Based on manual QA sample |
| Hallucination rate | < 5 % | Measured against factual subset |
⚠️ Note: These metrics are indicative only; not validated for clinical reliability.
| Factor | Value |
|---|---|
| GPU | NVIDIA A100 16 GB |
| Training duration | ~0.5 hour |
| Carbon emitted | ≈ 0.02 kg CO₂e |
If you use this model, please cite:
BibTeX:
@misc{hamza2025doctorai,
title={Hamza_the_doctor.ai — Medical Chatbot (Fine-tuned Gemma 3 270M)},
author={Muhammad Hamza Khan},
year={2025},
howpublished={\url{https://huggingface.co/HamzaKhan-03/Hamza_the_doctor.ai}},
}
For technical questions or collaborations: Author: Muhammad Hamza Khan Hugging Face: @HamzaKhan-03