Instructions to use bunny127/SophiaVL-R1-Thinking-Reward-Model-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bunny127/SophiaVL-R1-Thinking-Reward-Model-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="bunny127/SophiaVL-R1-Thinking-Reward-Model-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)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("bunny127/SophiaVL-R1-Thinking-Reward-Model-3B") model = AutoModelForImageTextToText.from_pretrained("bunny127/SophiaVL-R1-Thinking-Reward-Model-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?"} ] }, ] 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
- vLLM
How to use bunny127/SophiaVL-R1-Thinking-Reward-Model-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bunny127/SophiaVL-R1-Thinking-Reward-Model-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": "bunny127/SophiaVL-R1-Thinking-Reward-Model-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/bunny127/SophiaVL-R1-Thinking-Reward-Model-3B
- SGLang
How to use bunny127/SophiaVL-R1-Thinking-Reward-Model-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 "bunny127/SophiaVL-R1-Thinking-Reward-Model-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": "bunny127/SophiaVL-R1-Thinking-Reward-Model-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 "bunny127/SophiaVL-R1-Thinking-Reward-Model-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": "bunny127/SophiaVL-R1-Thinking-Reward-Model-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 bunny127/SophiaVL-R1-Thinking-Reward-Model-3B with Docker Model Runner:
docker model run hf.co/bunny127/SophiaVL-R1-Thinking-Reward-Model-3B
Add pipeline tag, library name and link to Github repo
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
-
This is the Thinking Reward Model of SophiaVL-R1 (https://arxiv.org/abs/2505.17018).
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
This model is finetuned with the [SophiaVL-R1-Thinking-156k Dataset](https://huggingface.co/datasets/bunny127/SophiaVL-R1-Thinking-156k). The base model is Qwen2.5-VL-3B.
|
| 7 |
|
| 8 |
The input of Thinking Reward Model is a question with model response. Thinking Reward Model will output a score between 0 and 1 indicating the thinking quality of model response.
|
|
@@ -36,7 +40,17 @@ def get_process_reward(prompt_str, reasoning_str, image_path=None):
|
|
| 36 |
if "<image>" not in prompt_str:
|
| 37 |
prompt_str = f"<image> {prompt_str}"
|
| 38 |
|
| 39 |
-
prompt = f"""You are an expert reasoning evaluator. I will give you a multimodal question and an answer. Your goal is to judge a reward process and give a score between 0 and 1. You should focus on whether the reasoning process is good rather than whether the final answer is correct.### Evaluation Criteria:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
Question: {prompt_str}
|
| 41 |
Reasoning process: {reasoning_str}
|
| 42 |
"""
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
library_name: transformers
|
| 5 |
---
|
|
|
|
| 6 |
|
| 7 |
+
This is the Thinking Reward Model of SophiaVL-R1 (https://arxiv.org/abs/2505.17018).
|
| 8 |
+
|
| 9 |
+
The code for SophiaVL-R1 can be found at https://github.com/kxfan2002/SophiaVL-R1.
|
| 10 |
This model is finetuned with the [SophiaVL-R1-Thinking-156k Dataset](https://huggingface.co/datasets/bunny127/SophiaVL-R1-Thinking-156k). The base model is Qwen2.5-VL-3B.
|
| 11 |
|
| 12 |
The input of Thinking Reward Model is a question with model response. Thinking Reward Model will output a score between 0 and 1 indicating the thinking quality of model response.
|
|
|
|
| 40 |
if "<image>" not in prompt_str:
|
| 41 |
prompt_str = f"<image> {prompt_str}"
|
| 42 |
|
| 43 |
+
prompt = f"""You are an expert reasoning evaluator. I will give you a multimodal question and an answer. Your goal is to judge a reward process and give a score between 0 and 1. You should focus on whether the reasoning process is good rather than whether the final answer is correct.### Evaluation Criteria:
|
| 44 |
+
- **Logical Soundness**: Does each step follow logically from the previous one?
|
| 45 |
+
- **Correct Reasoning**: Are the methods and steps used appropriate and valid? Are the facts and lemmas correctly stated and applied?
|
| 46 |
+
- **Error Identification**: Are there any logical fallacies, unsupported assumptions, or incorrect steps?
|
| 47 |
+
- **Language Consistency**: Is the reasoning process conducted in a single, consistent language without mixing different languages?
|
| 48 |
+
- **Redundancy**: Is the reasoning concise, without unnecessary repetition or extraneous steps?
|
| 49 |
+
Provide a single score from **{{0, 0.1, 0.2, ..., 1.0}}** based on the reasoning quality, where:
|
| 50 |
+
- **0**: Completely flawed reasoning
|
| 51 |
+
- **1**: Perfectly sound reasoning
|
| 52 |
+
- Intermediate values (e.g., 0.3, 0.7) should reflect partial correctness or minor errors.
|
| 53 |
+
Be strict, reward the good process and punish the bad one. You should only output the score without any explanation.
|
| 54 |
Question: {prompt_str}
|
| 55 |
Reasoning process: {reasoning_str}
|
| 56 |
"""
|