113 lines
4.3 KiB
Markdown
113 lines
4.3 KiB
Markdown
---
|
|
language:
|
|
- en
|
|
license: apache-2.0
|
|
tags:
|
|
- medical
|
|
- healthcare
|
|
- phi-2
|
|
- tiny-llama
|
|
- medical-assistant
|
|
- lora
|
|
- finetuned
|
|
- gguf
|
|
- quantised
|
|
datasets:
|
|
- chatdoctor
|
|
- medquad
|
|
- tatsu-lab/alpaca
|
|
metrics:
|
|
- perplexity
|
|
base_model: microsoft/phi-2
|
|
pipeline_tag: text-generation
|
|
library_name: transformers
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
# 🩺 Yukt-Med (Phi-2 Medical Assistant)
|
|
|
|
<img src="https://github.com/ggerganov/llama.cpp/blob/master/media/logo.png?raw=true" width="100" alt="llama.cpp Logo">
|
|
<img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" width="80" alt="Hugging Face Logo" style="vertical-align: middle;">
|
|
|
|
<br>
|
|
|
|
[-blue?style=for-the-badge&logo=huggingface)](https://huggingface.co/ayuag/yukt-med/blob/main/yukt-med-Q4_K_M.gguf)
|
|
[-green?style=for-the-badge&logo=microsoft)](https://huggingface.co/microsoft/phi-2)
|
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
[](https://huggingface.co/ayuag/yukt-med/blob/main/README.md#training-data)
|
|
|
|
<br>
|
|
|
|
<h3>Your Compact, Specialized Medical Knowledge Companion.</h3>
|
|
|
|
<p>Fine-tuned on 86,000+ curated medical interactions to provide concise, accurate, and non-diagnostic healthcare information.</p>
|
|
|
|
---
|
|
|
|
</div>
|
|
|
|
## 🌟 Overview
|
|
|
|
**Yukt-Med** is a lightweight, state-of-the-art language model designed for the medical and healthcare domain. It is fine-tuned using LoRA (Low-Rank Adaptation) on a diverse collection of healthcare datasets.
|
|
|
|
What makes Yukt-Med unique is its balance of performance and efficiency. While powerful, it has been **quantized to 4-bit GGUF**, making it runnable on commodity hardware, mobile devices, and in offline environments.
|
|
|
|
> **💡 Perfect for:** Rapid medical information retrieval, symptom analysis support, and educational purposes. **Not for diagnosis.**
|
|
|
|
---
|
|
|
|
## 🚀 Key Features
|
|
|
|
| Feature | Description |
|
|
| :--- | :--- |
|
|
| **🧠 Specialized Brain** | Trained on ChatDoctor, MedQuad, and curated drug databases. |
|
|
| **⚡ Ultra-Efficient** | GGUF version runs smoothly on **4GB RAM** (CPU/Mobile). |
|
|
| **Instruction-Following** | Responds accurately to instructions using a specific prompt template. |
|
|
| **🌐 Production-Ready** | Available in Standard Safetensors and Compact GGUF formats. |
|
|
|
|
---
|
|
|
|
## 📊 Training Data
|
|
|
|
The model's knowledge comes from over **86,800 cleaned and structured examples**:
|
|
|
|
1. **ChatDoctor Dataset:** Real-world patient-doctor dialogues for conversational medical advice.
|
|
2. **MedQuad Dataset:** Large-scale Medical Question-Answering pairs.
|
|
3. **Drugs & Side Effects:** Detailed information on pharmaceuticals.
|
|
4. **Symptom-Disease Mapping:** Patterns for common medical conditions.
|
|
|
|
*(Note: Data was filtered to ensure high-quality, safe, and factual content.)*
|
|
|
|
---
|
|
|
|
## 🧪 Evaluation Examples
|
|
|
|
Compare Yukt-Med's focused medical responses:
|
|
|
|
| Instruction (Prompt) | Yukt-Med Response (Generation) |
|
|
| :--- | :--- |
|
|
| **### Instruction:** What are the common symptoms of a common cold?<br>**### Response:** | The common symptoms of a common cold include a runny or stuffy nose, sneezing, sore throat, cough, and mild body aches or fatigue. |
|
|
| **### Instruction:** Tell me about the side effects of Aspirin.<br>**### Response:** | The most frequent side effects are bleeding and stomach upset. |
|
|
|
|
---
|
|
|
|
## 🛠️ Usage Instructions
|
|
|
|
### 1. Using Standard Transformers (Python/GPU)
|
|
|
|
```python
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
import torch
|
|
|
|
model_id = "ayuag/yukt-med"
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
|
|
|
|
def ask_medical_bot(question):
|
|
prompt = f"### Instruction: {question}\n### Response:"
|
|
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
|
outputs = model.generate(**inputs, max_new_tokens=200, do_sample=True, temperature=0.7)
|
|
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
print(ask_medical_bot("What are symptoms of Malaria?")) |