Views
No views yet
| Layer | Sources | Rationale |
|---|---|---|
| 1️⃣ Medical guidelines & protocols | ~100 recent (≤ 3 y) U.S. endocrine society documents | Guarantees latest treatment algorithms |
| 2️⃣ Scientific studies & reviews | ~200 peer-review papers / meta-analyses on semaglutide & peers | High-evidence risk/benefit data |
| 3️⃣ General medical knowledge | Textbooks + open datasets (e.g. MedMCQA) | Terminology & pathophysiology grounding |
| 4️⃣ Real-world consultations (anonymised; consented) | Transcripts of doctor–patient visits | Teaches natural, empathetic tone (↑ satisfaction ×1.5–2; Johri 2023) |
| 5️⃣ Safety / awareness corpora | Adversarial & sensitive-topic prompts | Model defers to clinicians when unsure |
| Phase | Method | Goal |
|---|---|---|
| Base | google/medgemma-4b-it FP16 | Vision-language backbone |
| SFT-LoRA | Supervised fine-tuning on GLP-1 QA | Teach domain facts |
| DPO-LoRA | Direct Preference Optimisation (Dubey 2024) on paired outputs | Align tone & user preference (concise + empathetic) |
| Merge | merge_and_unload() → 3-shard .safetensors | Single checkpoint for inference |
1from transformers import AutoModelForImageTextToText, AutoProcessor
2import torch
3
4model_id = "YmaHealth/medgemma4b_yma_health_merged"
5
6model = AutoModelForImageTextToText.from_pretrained(
7 model_id,
8 torch_dtype=torch.bfloat16, # use float16 on GPUs without bfloat16
9 device_map="auto",
10)
11processor = AutoProcessor.from_pretrained(model_id)
12
13messages = [
14 {
15 "role": "system",
16 "content": [{"type": "text", "text": "You are an endocrinologist specialised in GLP-1 therapy."}]
17 },
18 {
19 "role": "user",
20 "content": [{"type": "text", "text": "How should I titrate semaglutide if nausea persists?"}]
21 }
22]
23
24inputs = processor(messages, return_tensors="pt").to(model.device)
25outputs = model.generate(**inputs, max_new_tokens=256)
26print(processor.decode(outputs[0], skip_special_tokens=True))