Instructions to use P1n3/sdg-detector-grpo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use P1n3/sdg-detector-grpo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="P1n3/sdg-detector-grpo") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("P1n3/sdg-detector-grpo") model = AutoModelForMultimodalLM.from_pretrained("P1n3/sdg-detector-grpo") 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 Settings
- vLLM
How to use P1n3/sdg-detector-grpo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "P1n3/sdg-detector-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": "P1n3/sdg-detector-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/P1n3/sdg-detector-grpo
- SGLang
How to use P1n3/sdg-detector-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 "P1n3/sdg-detector-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": "P1n3/sdg-detector-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 "P1n3/sdg-detector-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": "P1n3/sdg-detector-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 P1n3/sdg-detector-grpo with Docker Model Runner:
docker model run hf.co/P1n3/sdg-detector-grpo
SDG Detector — GRPO Stage (Merged Checkpoint)
This repository provides the merged full checkpoint of the SDG detector
after Stage-2 GRPO. It is already merged with the Stage-1 SFT checkpoint
(P1n3/sdg-detector-sft) and can be loaded directly with transformers.
Important: this is not a PEFT/LoRA adapter. Do not load it with
PeftModel.from_pretrained, and do not merge it intoQwen/Qwen3-VL-4B-InstructorP1n3/sdg-detector-sft.
Training Summary
| field | value |
|---|---|
| initialization | P1n3/sdg-detector-sft |
| training stage | GRPO |
| reward | composite: 0.6×DIoU + 0.25×DescCos + 0.15×ImpAcc |
| epochs | 2 |
| learning rate | 5.0e-6 |
| rollouts/prompt | 8 |
| precision | bf16 |
| hardware | 16 × A100-80G (2 nodes × 8) |
Quick Start
from transformers import AutoProcessor, AutoModelForImageTextToText
import torch
ckpt = "P1n3/sdg-detector-grpo" # merged full checkpoint
processor = AutoProcessor.from_pretrained(ckpt)
model = AutoModelForImageTextToText.from_pretrained(
ckpt,
dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
For SGLang/OpenAI-compatible serving in BoxFlow-GRPO:
python -m sglang.launch_server \
--model-path P1n3/sdg-detector-grpo \
--served-model-name sdg-detector \
--port 17142 --tp 4 --api-key flowgrpo --trust-remote-code
Output Format
The detector predicts structured defect sets:
<think>
... reasoning about image quality and caption alignment ...
</think>
<answer>
[
{
"box_2d": [x0, y0, x1, y1],
"label": "artifact" or "misalignment",
"description": "...",
"importance": 1-100
}
]
</answer>
License
cc-by-nc-4.0. This checkpoint is derived from P1n3/sdg-detector-sft
(itself a derivative of Qwen/Qwen3-VL-4B-Instruct, Apache-2.0). Research and
non-commercial use only.
Citation
@article{zhang2026and,
title={Where, What, Why, and Importance: Structured Defect Grounding for Text-to-Image Feedback},
author={Zhang, Huaisong and Yu, Hao and Zhang, Yuxuan and Wang, Jiahe and Chen, Xinrui and Cao, Haoxiang and Lu, Feng and Zhang, Wendong and Yu, Changqian and Yuan, Chun},
journal={arXiv preprint arXiv:2606.06113},
year={2026}
}
- Downloads last month
- -