Instructions to use ecoxial2007/CheX-Phi4MM-GRPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ecoxial2007/CheX-Phi4MM-GRPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ecoxial2007/CheX-Phi4MM-GRPO", trust_remote_code=True) 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ecoxial2007/CheX-Phi4MM-GRPO", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ecoxial2007/CheX-Phi4MM-GRPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ecoxial2007/CheX-Phi4MM-GRPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ecoxial2007/CheX-Phi4MM-GRPO", "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/ecoxial2007/CheX-Phi4MM-GRPO
- SGLang
How to use ecoxial2007/CheX-Phi4MM-GRPO 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 "ecoxial2007/CheX-Phi4MM-GRPO" \ --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": "ecoxial2007/CheX-Phi4MM-GRPO", "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 "ecoxial2007/CheX-Phi4MM-GRPO" \ --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": "ecoxial2007/CheX-Phi4MM-GRPO", "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 ecoxial2007/CheX-Phi4MM-GRPO with Docker Model Runner:
docker model run hf.co/ecoxial2007/CheX-Phi4MM-GRPO
CheXPO-v2: Preference Optimization for Chest X-ray VLMs with Knowledge Graph Consistency
Introduction
CheXPO-v2 is a state-of-the-art multimodal vision-language model specialized for chest X-ray interpretation. It is built upon the Phi-4 multimodal architecture and refined using a novel alignment framework that shifts from outcome-based rewards to process supervision.
By integrating a Knowledge Graph (KG) Consistency Reward, CheXPO-v2 ensures that the model's reasoning process is clinically sound, significantly reducing hallucinations and improving factual accuracy in radiology report generation and visual question answering.
Key Innovations
- Process Supervision via KG Consistency: Unlike traditional RLHF (e.g., GRPO) that only rewards the final answer, CheXPO-v2 uses Entity-Relation Matching to penalize incoherent logic at the atomic level (Disease, Relation, Anatomy).
- Data Efficiency: Achieves new SOTA performance on benchmarks like MIMIC-CXR-VQA using only 5k preference samples.
- Verifiable Reasoning: Produces structured and clinically verifiable reasoning chains, mitigating the "overthinking" problem where models generate verbose but flawed logic.
How to Use
This model is compatible with the transformers library (version >= 4.48.2). You can use the standard AutoModelForCausalLM and AutoProcessor to run inference.
import torch
from transformers import AutoModelForCausalLM, AutoProcessor
from PIL import Image
# Load model and processor
model_id = "ecoxial2007/CheX-Phi4MM-GRPO"
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
trust_remote_code=True,
torch_dtype=torch.bfloat16
)
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
# Prepare input
prompt = "<|user|>\n<|image_1|>\nWhat are the main findings in this chest X-ray? <|end|>\n<|assistant|>\n"
image = Image.open("path_to_your_cxr_image.jpg")
inputs = processor(text=prompt, images=[image], return_tensors="pt").to(model.device)
# Generate response
outputs = model.generate(**inputs, max_new_tokens=512)
response = processor.batch_decode(outputs, skip_special_tokens=True)
print(response[0])
Citation
If you find this work useful, please cite our paper:
@article
{liang2024chexpo2,
title={CheXPO-v2: Preference Optimization for Chest X-ray VLMs with Knowledge Graph Consistency},
author={Liang, Xiao and An, Yuxuan and Wang, Di and Hu, Jiawei and Jiao, Zhicheng and Jing, Bin and Wang, Quan},
journal={arXiv preprint arXiv:2512.17213},
year={2024}
}
Acknowledgement
This project is hosted at ecoxial2007/CheX-Phi4MM. We thank the community for their contributions to medical multimodal AI.
- Downloads last month
- 19
Model tree for ecoxial2007/CheX-Phi4MM-GRPO
Base model
microsoft/Phi-4-multimodal-instruct