CoolFace
Modelpublic

agnihotri-anxh/HealthMate-gemma-medical-lora

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
2likes10downloads
Model Card

🩺 HealthMate – Gemma 2B Medical LoRA Model

HealthMate is a fine-tuned LoRA adapter built on Google Gemma-2B-IT, trained on medically-oriented text extracted from the Gale Encyclopedia of Medicine. The model specializes in encyclopedia-style medical Q&A, sticking strictly to source content and avoiding medical advice.


πŸ’‘ Model Summary

  • β€”Base Model: google/gemma-2b-it
  • β€”Type: LoRA Adapter (PEFT)
  • β€”Parameters Trained: ~20M (LoRA layers only)
  • β€”Task: Medical question answering, explanation, terminology, definitions
  • β€”Language: English
  • β€”Format: Instruction β†’ Input β†’ Output
  • β€”Strength: Produces concise, reference-style medical answers
  • β€”Avoids: Personal medical advice, diagnosis, or clinical recommendations

🧠 Model Description

HealthMate was fine-tuned to mimic the structured, factual tone of medical encyclopedias. It is NOT a medical decision support tool. It is designed purely for educational, informational, and academic use.

✨ Output Characteristics

  • β€”Always begins with β€œAccording to the Gale Encyclopedia of Medicine:”
  • β€”Uses a neutral, encyclopedic writing style
  • β€”Does not hallucinate clinical advice
  • β€”Structured and consistent formatting
  • β€”Follows your training template exactly

πŸ“˜ Training Dataset

The model was trained on a custom dataset derived from:

  • β€”Gale Encyclopedia of Medicine (text extracted using OCR + manual cleanup)
  • β€”~20,000 instruction-style samples
  • β€”Each sample contains:
  • β€”instruction (task description)
  • β€”input (question)
  • β€”output (encyclopedia-derived answer)

πŸš€ How to Use

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base = AutoModelForCausalLM.from_pretrained(
    "google/gemma-2b-it",
    load_in_4bit=True,
    device_map="auto"
)

model = PeftModel.from_pretrained(base, "agnihotri-anxh/HealthMate-gemma-medical-lora")
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")

prompt = """Instruction: Answer the question based ONLY on the book content. Do NOT give medical advice.
Input: Explain ultrasound in simple terms.
Output:"""

inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0]))