Text Generation
Transformers
Safetensors
English
gemma3
image-text-to-text
medgemma
gemma
medical
healthcare
pneumonia
conversational
text-generation-inference
Instructions to use Programmerlb/medgemma1.5-4b-pneumonia-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Programmerlb/medgemma1.5-4b-pneumonia-lora with Transformers:
# 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Programmerlb/medgemma1.5-4b-pneumonia-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Programmerlb/medgemma1.5-4b-pneumonia-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Programmerlb/medgemma1.5-4b-pneumonia-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Programmerlb/medgemma1.5-4b-pneumonia-lora
- SGLang
How to use Programmerlb/medgemma1.5-4b-pneumonia-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Programmerlb/medgemma1.5-4b-pneumonia-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Programmerlb/medgemma1.5-4b-pneumonia-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Programmerlb/medgemma1.5-4b-pneumonia-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Programmerlb/medgemma1.5-4b-pneumonia-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Programmerlb/medgemma1.5-4b-pneumonia-lora with Docker Model Runner:
docker model run hf.co/Programmerlb/medgemma1.5-4b-pneumonia-lora
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
Model tree for Programmerlb/medgemma1.5-4b-pneumonia-lora
Base model
google/medgemma-1.5-4b-it