Phiphi216/oncology
Viewer • Updated • 2k • 5
How to use Phiphi216/medgemma-oncology-lora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="Phiphi216/medgemma-oncology-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("Phiphi216/medgemma-oncology-lora", device_map="auto")How to use Phiphi216/medgemma-oncology-lora with PEFT:
Task type is invalid.
How to use Phiphi216/medgemma-oncology-lora with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Phiphi216/medgemma-oncology-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": "Phiphi216/medgemma-oncology-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 run hf.co/Phiphi216/medgemma-oncology-lora
How to use Phiphi216/medgemma-oncology-lora with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Phiphi216/medgemma-oncology-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": "Phiphi216/medgemma-oncology-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 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 "Phiphi216/medgemma-oncology-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": "Phiphi216/medgemma-oncology-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"
}
}
]
}
]
}'How to use Phiphi216/medgemma-oncology-lora with Docker Model Runner:
docker model run hf.co/Phiphi216/medgemma-oncology-lora
This repository contains a LoRA fine-tuned oncology agent built on top of MedGemma 1.5 4B IT.
The model is trained to analyze chest CT scan slices together with structured clinical records and predict six-year lung cancer risk.
The model was fine-tuned using Unsloth and PEFT LoRA on a custom oncology dataset.
| Item | Value |
|---|---|
| Base Model | unsloth/medgemma-1.5-4b-it |
| Domain | Oncology |
| Task | Lung Cancer Risk Prediction |
| Finetuning Method | LoRA |
| Developer | Phiphi216 |
| License | Apache 2.0 |
Dataset:
Number of samples:
Each sample contains:
Response format:
{
"lung_cancer_risk": "Cancer within follow-up"
}
unsloth/medgemma-1.5-4b-it
r: 16
lora_alpha: 16
lora_dropout: 0.0
finetune_vision_layers: false
finetune_language_layers: true
finetune_attention_modules: true
finetune_mlp_modules: true
optimizer: adamw_torch_fused
learning_rate: 2e-4
weight_decay: 1e-3
lr_scheduler_type: cosine
max_grad_norm: 0.3
per_device_train_batch_size: 2
gradient_accumulation_steps: 2
effective_batch_size: 4
max_seq_length: 25808
max_steps: 125
warmup_ratio: 0