Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- medgemma
|
| 8 |
+
- gemma
|
| 9 |
+
- medical
|
| 10 |
+
- healthcare
|
| 11 |
+
- pneumonia
|
| 12 |
+
base_model: google/medgemma-1.5-4b-it
|
| 13 |
+
widget:
|
| 14 |
+
- text: "I have fever and cough for 3 days. What should I do?"
|
| 15 |
+
- text: "65-year-old with shortness of breath and chest pain. Is this urgent?"
|
| 16 |
+
- text: "What are red flags that should make me seek emergency care?"
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# MedGemma 1.5 4B – Pneumonia (Merged)
|
| 20 |
+
|
| 21 |
+
This repository contains a **merged fine-tuned MedGemma model** focused on pneumonia-related clinical guidance.
|
| 22 |
+
|
| 23 |
+
> ⚠️ **Disclaimer**
|
| 24 |
+
> Educational and research use only. Not for real medical diagnosis or treatment.
|
| 25 |
+
|
| 26 |
+
## Base model
|
| 27 |
+
- google/medgemma-1.5-4b-it
|
| 28 |
+
|
| 29 |
+
## Quickstart (Transformers)
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
!pip install -U transformers accelerate sentencepiece safetensors
|
| 33 |
+
|
| 34 |
+
import torch
|
| 35 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 36 |
+
|
| 37 |
+
repo_id = "Programmerlb/medgemma1.5-4b-pneumonia-lora"
|
| 38 |
+
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=True)
|
| 40 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 41 |
+
repo_id,
|
| 42 |
+
device_map="auto",
|
| 43 |
+
dtype=torch.float16,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
prompt = "I have fever and productive cough for 5 days with shortness of breath. What should I do?"
|
| 47 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 48 |
+
output = model.generate(**inputs, max_new_tokens=200)
|
| 49 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|