Image-Text-to-Text
Transformers
Safetensors
qwen3_vl
qwen3-vl
vision-language
defect-detection
structured-grounding
conversational
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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("P1n3/sdg-detector-grpo") model = AutoModelForMultimodalLM.from_pretrained("P1n3/sdg-detector-grpo", device_map="auto") 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=256) 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
Prepare anonymous review snapshot
#1
by P1n3 - opened
README.md
CHANGED
|
@@ -1,100 +1,15 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-4.0
|
| 3 |
-
base_model: P1n3/sdg-detector-sft
|
| 4 |
library_name: transformers
|
| 5 |
-
tags:
|
| 6 |
-
- qwen3-vl
|
| 7 |
-
- vision-language
|
| 8 |
-
- image-text-to-text
|
| 9 |
-
- defect-detection
|
| 10 |
-
- structured-grounding
|
| 11 |
pipeline_tag: image-text-to-text
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# SDG Detector
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
after Stage-2 GRPO. It is already merged with the Stage-1 SFT checkpoint
|
| 20 |
-
(`P1n3/sdg-detector-sft`) and can be loaded directly with `transformers`.
|
| 21 |
-
|
| 22 |
-
> Important: this is **not** a PEFT/LoRA adapter. Do **not** load it with
|
| 23 |
-
> `PeftModel.from_pretrained`, and do **not** merge it into
|
| 24 |
-
> `Qwen/Qwen3-VL-4B-Instruct` or `P1n3/sdg-detector-sft`.
|
| 25 |
-
|
| 26 |
-
## Training Summary
|
| 27 |
-
|
| 28 |
-
| field | value |
|
| 29 |
-
|------------------|-------------------------------------------------------|
|
| 30 |
-
| initialization | `P1n3/sdg-detector-sft` |
|
| 31 |
-
| training stage | GRPO |
|
| 32 |
-
| reward | composite: 0.6×DIoU + 0.25×DescCos + 0.15×ImpAcc |
|
| 33 |
-
| epochs | 2 |
|
| 34 |
-
| learning rate | 5.0e-6 |
|
| 35 |
-
| rollouts/prompt | 8 |
|
| 36 |
-
| precision | bf16 |
|
| 37 |
-
| hardware | 16 × A100-80G (2 nodes × 8) |
|
| 38 |
-
|
| 39 |
-
## Quick Start
|
| 40 |
-
|
| 41 |
-
```python
|
| 42 |
-
from transformers import AutoProcessor, AutoModelForImageTextToText
|
| 43 |
-
import torch
|
| 44 |
-
|
| 45 |
-
ckpt = "P1n3/sdg-detector-grpo" # merged full checkpoint
|
| 46 |
-
|
| 47 |
-
processor = AutoProcessor.from_pretrained(ckpt)
|
| 48 |
-
model = AutoModelForImageTextToText.from_pretrained(
|
| 49 |
-
ckpt,
|
| 50 |
-
dtype=torch.bfloat16,
|
| 51 |
-
device_map="auto",
|
| 52 |
-
)
|
| 53 |
-
model.eval()
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
For SGLang/OpenAI-compatible serving in BoxFlow-GRPO:
|
| 57 |
-
|
| 58 |
-
```bash
|
| 59 |
-
python -m sglang.launch_server \
|
| 60 |
-
--model-path P1n3/sdg-detector-grpo \
|
| 61 |
-
--served-model-name sdg-detector \
|
| 62 |
-
--port 17142 --tp 4 --api-key flowgrpo --trust-remote-code
|
| 63 |
-
```
|
| 64 |
-
|
| 65 |
-
## Output Format
|
| 66 |
-
|
| 67 |
-
The detector predicts structured defect sets:
|
| 68 |
-
|
| 69 |
-
```text
|
| 70 |
-
<think>
|
| 71 |
-
... reasoning about image quality and caption alignment ...
|
| 72 |
-
</think>
|
| 73 |
-
<answer>
|
| 74 |
-
[
|
| 75 |
-
{
|
| 76 |
-
"box_2d": [x0, y0, x1, y1],
|
| 77 |
-
"label": "artifact" or "misalignment",
|
| 78 |
-
"description": "...",
|
| 79 |
-
"importance": 1-100
|
| 80 |
-
}
|
| 81 |
-
]
|
| 82 |
-
</answer>
|
| 83 |
-
```
|
| 84 |
|
| 85 |
## License
|
| 86 |
|
| 87 |
-
|
| 88 |
-
(itself a derivative of `Qwen/Qwen3-VL-4B-Instruct`, Apache-2.0). Research and
|
| 89 |
-
non-commercial use only.
|
| 90 |
-
|
| 91 |
-
## Citation
|
| 92 |
-
|
| 93 |
-
```bibtex
|
| 94 |
-
@article{zhang2026and,
|
| 95 |
-
title={Where, What, Why, and Importance: Structured Defect Grounding for Text-to-Image Feedback},
|
| 96 |
-
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},
|
| 97 |
-
journal={arXiv preprint arXiv:2606.06113},
|
| 98 |
-
year={2026}
|
| 99 |
-
}
|
| 100 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-4.0
|
|
|
|
| 3 |
library_name: transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
pipeline_tag: image-text-to-text
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# SDG Detector: GRPO
|
| 8 |
|
| 9 |
+
This is the merged full SDG detector after GRPO, initialized from the SFT detector based on Qwen3-VL-4B-Instruct. It is not a PEFT adapter. Download the model.safetensors file and accompanying configuration, tokenizer and processor files through the anonymous resource link.
|
| 10 |
|
| 11 |
+
Load the local directory using AutoProcessor.from_pretrained and AutoModelForImageTextToText.from_pretrained with Qwen3-VL support. Do not attach this checkpoint as a LoRA adapter. See the supplementary guide for reproduction details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
## License
|
| 14 |
|
| 15 |
+
CC BY-NC 4.0. The underlying Qwen3-VL-4B-Instruct model uses Apache-2.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|