Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
conversational
text-generation-inference
Instructions to use Carol0110/UniRM-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Carol0110/UniRM-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Carol0110/UniRM-3B") 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("Carol0110/UniRM-3B") model = AutoModelForMultimodalLM.from_pretrained("Carol0110/UniRM-3B", 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 Carol0110/UniRM-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Carol0110/UniRM-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Carol0110/UniRM-3B", "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/Carol0110/UniRM-3B
- SGLang
How to use Carol0110/UniRM-3B 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 "Carol0110/UniRM-3B" \ --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": "Carol0110/UniRM-3B", "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 "Carol0110/UniRM-3B" \ --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": "Carol0110/UniRM-3B", "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 Carol0110/UniRM-3B with Docker Model Runner:
docker model run hf.co/Carol0110/UniRM-3B
Upload 2 files
Browse files- README (1).md +63 -0
- README_zh.md +29 -0
README (1).md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen2.5-VL-7B-Instruct
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
license: apache-2.0
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
library_name: transformers
|
| 10 |
+
pipeline_tag: image-text-to-text
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
<p align="center">
|
| 14 |
+
<a href="https://huggingface.co/Carol0110/UniRM/blob/main/README.md"><b>English</b></a> | <a href="https://huggingface.co/Carol0110/UniRM/blob/main/README_zh.md">中文</a>
|
| 15 |
+
</p>
|
| 16 |
+
|
| 17 |
+
# UniRM: Multi-Head Scalar Reward Model for Multimodal Moderation
|
| 18 |
+
|
| 19 |
+
**UniRM** is a **multi-head scalar reward model** that provides **interpretable, attribute-level scoring** for multimodal moderation. It was introduced in the paper [From Sparse Decisions to Dense Reasoning: A Multi-attribute Trajectory Paradigm for Multimodal Moderation](https://huggingface.co/papers/2602.02536).
|
| 20 |
+
|
| 21 |
+
- **Project Page:** [trustworthylab.github.io/UniMod/](https://trustworthylab.github.io/UniMod/)
|
| 22 |
+
- **Repository:** [github.com/Carol-gutianle/UniMod](https://github.com/Carol-gutianle/UniMod)
|
| 23 |
+
- **Paper:** [arXiv:2602.02536](https://huggingface.co/papers/2602.02536)
|
| 24 |
+
|
| 25 |
+
UniRM is designed to support policy optimization for open-ended reasoning in **UniMod**, especially for the posterior response stage where deterministic labels are absent. It decouples reward attribution into multiple dimensions so the model can distinguish **stylistic quality** from **safety boundaries** (privacy, bias, toxicity, legality), enabling transparent diagnosis and stable optimization.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Demo Video
|
| 30 |
+
|
| 31 |
+
> UniRM demo video:
|
| 32 |
+
|
| 33 |
+
<video controls preload="metadata" style="width:100%; max-width:900px; border-radius:12px;">
|
| 34 |
+
<source src="https://huggingface.co/Carol0110/UniRM/resolve/main/unirm.mp4" type="video/mp4">
|
| 35 |
+
</video>
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Quick Start (Gradio)
|
| 40 |
+
|
| 41 |
+
Below is a minimal Gradio demo that loads **UniRM** and returns **multi-head scores** for a *(prompt, response, optional image)* triple.
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
git clone https://github.com/TideDra/lmm-r1.git
|
| 45 |
+
cd lmm-r1
|
| 46 |
+
pip install -e .[vllm]
|
| 47 |
+
pip install flash_attn --no-build-isolation
|
| 48 |
+
python unirm.py --model_path {PATH_TO_UNIRM}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Citation
|
| 52 |
+
|
| 53 |
+
```bibtex
|
| 54 |
+
@misc{gu2026sparsedecisionsdensereasoning,
|
| 55 |
+
title={From Sparse Decisions to Dense Reasoning: A Multi-attribute Trajectory Paradigm for Multimodal Moderation},
|
| 56 |
+
author={Tianle Gu and Kexin Huang and Lingyu Li and Ruilin Luo and Shiyang Huang and Zongqi Wang and Yujiu Yang and Yan Teng and Yingchun Wang},
|
| 57 |
+
year={2026},
|
| 58 |
+
eprint={2602.02536},
|
| 59 |
+
archivePrefix={arXiv},
|
| 60 |
+
primaryClass={cs.LG},
|
| 61 |
+
url={https://arxiv.org/abs/2602.02536},
|
| 62 |
+
}
|
| 63 |
+
```
|
README_zh.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UniRM:用于多模态内容审核的多头标量奖励模型
|
| 2 |
+
|
| 3 |
+
**UniRM** 是一个用于多模态内容审核的**多头标量奖励模型**,能够提供**可解释的、属性级别的评分信号**。
|
| 4 |
+
该模型被设计用于支持 **UniMod** 中的开放式推理策略优化,尤其适用于**缺乏确定性标签的响应生成阶段**。
|
| 5 |
+
|
| 6 |
+
UniRM 将奖励信号解耦为多个维度,使模型能够区分**表达质量**与**安全边界**(隐私、偏见、有害性、合法性),从而实现更透明的诊断与更稳定的训练。
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## 演示视频
|
| 11 |
+
|
| 12 |
+
> UniRM 演示视频:
|
| 13 |
+
|
| 14 |
+
<video controls preload="metadata" style="width:100%; max-width:900px; border-radius:12px;">
|
| 15 |
+
<source src="static/videos/unirm.mp4" type="video/mp4">
|
| 16 |
+
</video>
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## 快速开始(Gradio)
|
| 21 |
+
|
| 22 |
+
下面给出一个最小化的 Gradio 示例,用于加载 **UniRM**,并对 *(输入指令、模型回复、可选图像)* 进行**多头奖励评分**。
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
git clone https://github.com/TideDra/lmm-r1.git
|
| 26 |
+
cd lmm-r1
|
| 27 |
+
pip install -e .[vllm]
|
| 28 |
+
pip install flash_attn --no-build-isolation
|
| 29 |
+
python unirm.py --model_path {PATH_TO_UNIRM}
|