How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="Programmerlb/medgemma1.5-4b-pneumonia-lora")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
pipe(text=messages)
# Load model directly
from transformers import AutoProcessor, AutoModelForImageTextToText

processor = AutoProcessor.from_pretrained("Programmerlb/medgemma1.5-4b-pneumonia-lora")
model = AutoModelForImageTextToText.from_pretrained("Programmerlb/medgemma1.5-4b-pneumonia-lora")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
inputs = processor.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

MedGemma 1.5 4B โ€“ Pneumonia (Merged)

This repository contains a merged fine-tuned MedGemma model focused on pneumonia-related clinical guidance.

โš ๏ธ Disclaimer
Educational and research use only. Not for real medical diagnosis or treatment.

Base model

  • google/medgemma-1.5-4b-it

Quickstart (Transformers)

!pip install -U transformers accelerate sentencepiece safetensors

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

repo_id = "Programmerlb/medgemma1.5-4b-pneumonia-lora"

tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
    repo_id,
    device_map="auto",
    dtype=torch.float16,
)

prompt = "I have fever and productive cough for 5 days with shortness of breath. What should I do?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Downloads last month
23
Safetensors
Model size
4B params
Tensor type
F16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ 1 Ask for provider support

Model tree for Programmerlb/medgemma1.5-4b-pneumonia-lora

Finetuned
(68)
this model