Instructions to use s0close/medgemma-dsa-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use s0close/medgemma-dsa-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="s0close/medgemma-dsa-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 AutoModel model = AutoModel.from_pretrained("s0close/medgemma-dsa-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use s0close/medgemma-dsa-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "s0close/medgemma-dsa-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": "s0close/medgemma-dsa-lora", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/s0close/medgemma-dsa-lora
- SGLang
How to use s0close/medgemma-dsa-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 "s0close/medgemma-dsa-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": "s0close/medgemma-dsa-lora", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "s0close/medgemma-dsa-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": "s0close/medgemma-dsa-lora", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use s0close/medgemma-dsa-lora with Docker Model Runner:
docker model run hf.co/s0close/medgemma-dsa-lora
Model Card: MedGemma DSA LoRA Adapter (ds-lora)
Model Details
Model Description
This repository contains a LoRA adapter fine-tuned for Digital Subtraction Angiography (DSA) vessel patency triage.
The adapter is intended to improve sensitivity for blocked/occluded vessel patterns compared with naive base-model prompting on heavily imbalanced data.
- Developed by: DataRabbit hackathon team
- Base model:
google/medgemma-1.5-4b-it - Model type: Vision-language LoRA adapter (PEFT)
- Primary task: Binary DSA support classification (
patentvsblocked) - Language: English (prompts/output)
- License: Follows base model terms and license restrictions
- Finetuned from model:
google/medgemma-1.5-4b-it
Model Sources
- Project repository: local project (
proj-medgemma-challenge-2026) - Base model: https://huggingface.co/google/medgemma-1.5-4b-it
- Competition context: https://www.kaggle.com/competitions/med-gemma-impact-challenge/overview
Intended Uses
Direct Use
- Rapid DSA image triage support in a controlled evaluation pipeline.
- Experimental decision-support where output is always reviewed by a clinician.
Downstream Use
- Can be routed only for DSA/XA series in a multi-stage pipeline (e.g., PACS worker).
- Can be merged into a standalone model for simpler deployment.
Out-of-Scope Use
- Not for autonomous diagnosis.
- Not for emergency triage without human oversight.
- Not validated for non-DSA modalities (CT, MR, US, X-ray).
- Not intended for pediatric/special populations without dedicated validation.
Bias, Risks, and Limitations
- Performance can degrade under domain shift (scanner/protocol/institution changes).
- Small and previously imbalanced blocked-vessel class is a key risk.
- Model outputs can be verbose or overconfident; structured post-processing is recommended.
- False negatives remain clinically high-risk.
Clinical Safety Recommendations
- Use as decision support only, never as final diagnosis.
- Always combine with human radiology review.
- Route uncertain/low-confidence outputs to manual review.
- Monitor sensitivity/specificity continuously on newly ingested data.
How to Use
Load base model + LoRA adapter
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
from peft import PeftModel
base_model_id = "google/medgemma-1.5-4b-it"
adapter_id = "s0close/medgemma-dsa-lora"
processor = AutoProcessor.from_pretrained(base_model_id)
base_model = AutoModelForImageTextToText.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
Optional: merge adapter for standalone inference
Use:
tools/publish_dsa_merged_model.py
Training Details
Training Data
- Internal DSA dataset prepared for vessel patency classification.
- Conversational VLM format (
messageswith image + text supervision). - De-identified data expected; no PHI should be stored in the model artifacts.
Training Procedure
- QLoRA fine-tuning on Hugging Face Jobs.
- Quantization: 4-bit NF4 with double quantization.
- Compute dtype: bfloat16.
Hyperparameters (default project config)
- LoRA rank (
r): 8 - LoRA alpha: 16
- LoRA dropout: 0.1
- Target modules:
all-linear - Learning rate:
2e-5(script default) - Batch size: 1
- Gradient accumulation: 8
- Epochs: 2 (script default)
Evaluation
Evaluation Setup
- Primary metrics: accuracy, sensitivity (blocked recall), specificity.
- Internal prior baseline showed a strong class-imbalance failure mode:
- very high accuracy with near-zero blocked sensitivity when predicting majority class.
Current Results
- Run-specific results should be reported from the latest
training_run.jsonand evaluation outputs in your HF run artifacts. - Do not claim clinical-grade performance without external multi-site validation.
Technical Specifications
Architecture
- Base: MedGemma 1.5 4B instruction-tuned vision-language model.
- Adaptation: PEFT LoRA heads trained for DSA classification prompts.
Infrastructure
- Typical training flavor: Hugging Face Jobs on L4.
- Inference: CUDA/CPU depending on deployment constraints.
Ethical and Regulatory Notice
This model is a research artifact for hackathon/prototyping workflows. It is not a medical device and has not undergone regulatory approval. Any clinical use requires formal validation, governance, and compliance review.
Contact
For project-level questions, use your team repository issue tracker or designated team contact.