Image-Text-to-Text
Transformers
Safetensors
qwen3_vl
qwen3-vl
vision-language
reward-model
image-ranking
conversational
Instructions to use JanHutter/verifierreward with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JanHutter/verifierreward with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="JanHutter/verifierreward") 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("JanHutter/verifierreward") model = AutoModelForMultimodalLM.from_pretrained("JanHutter/verifierreward", 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 JanHutter/verifierreward with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JanHutter/verifierreward" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JanHutter/verifierreward", "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/JanHutter/verifierreward
- SGLang
How to use JanHutter/verifierreward 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 "JanHutter/verifierreward" \ --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": "JanHutter/verifierreward", "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 "JanHutter/verifierreward" \ --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": "JanHutter/verifierreward", "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 JanHutter/verifierreward with Docker Model Runner:
docker model run hf.co/JanHutter/verifierreward
Add model card and loading example
Browse files
README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
base_model: Qwen/Qwen3-VL-8B-Instruct
|
| 5 |
+
tags:
|
| 6 |
+
- qwen3-vl
|
| 7 |
+
- vision-language
|
| 8 |
+
- reward-model
|
| 9 |
+
- image-ranking
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
# VerifierReward Qwen3-VL 8B
|
| 13 |
+
|
| 14 |
+
This is a Qwen3-VL-8B-Instruct checkpoint fine-tuned as a yes/no image-text
|
| 15 |
+
alignment verifier. It was trained with mixed pairwise preference data and can
|
| 16 |
+
be loaded directly with Hugging Face Transformers.
|
| 17 |
+
|
| 18 |
+
## Load from Hugging Face
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
import torch
|
| 22 |
+
from transformers import AutoProcessor, Qwen3VLForConditionalGeneration
|
| 23 |
+
|
| 24 |
+
model_id = "JanHutter/verifierreward"
|
| 25 |
+
|
| 26 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 27 |
+
model = Qwen3VLForConditionalGeneration.from_pretrained(
|
| 28 |
+
model_id,
|
| 29 |
+
dtype=torch.bfloat16,
|
| 30 |
+
device_map="auto",
|
| 31 |
+
)
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
The repository ID is the Hugging Face-native identifier corresponding to
|
| 35 |
+
<https://huggingface.co/JanHutter/verifierreward>.
|
| 36 |
+
|
| 37 |
+
## Score image-prompt alignment
|
| 38 |
+
|
| 39 |
+
The model was trained to answer `yes` or `no`. The scalar reward used during
|
| 40 |
+
evaluation is the full-vocabulary probability of the next token being `yes`.
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
import torch
|
| 44 |
+
|
| 45 |
+
instruction = """You are an AI assistant specializing in image analysis and ranking. Your task is to analyze and compare image based on how well they match the given prompt.
|
| 46 |
+
The given prompt is:{prompt}. Please consider the prompt and the image to make a decision and response directly with 'yes' or 'no'."""
|
| 47 |
+
|
| 48 |
+
messages = [{
|
| 49 |
+
"role": "user",
|
| 50 |
+
"content": [
|
| 51 |
+
{"type": "image", "image": "https://example.com/image.jpg"},
|
| 52 |
+
{"type": "text", "text": instruction.format(prompt="a red car in snow")},
|
| 53 |
+
],
|
| 54 |
+
}]
|
| 55 |
+
|
| 56 |
+
inputs = processor.apply_chat_template(
|
| 57 |
+
[messages],
|
| 58 |
+
tokenize=True,
|
| 59 |
+
add_generation_prompt=True,
|
| 60 |
+
return_dict=True,
|
| 61 |
+
return_tensors="pt",
|
| 62 |
+
).to(model.device)
|
| 63 |
+
|
| 64 |
+
with torch.inference_mode():
|
| 65 |
+
logits = model(**inputs, use_cache=False).logits[:, -1, :].float()
|
| 66 |
+
|
| 67 |
+
yes_id = processor.tokenizer.encode("yes", add_special_tokens=False)[0]
|
| 68 |
+
reward = torch.softmax(logits, dim=-1)[:, yes_id]
|
| 69 |
+
print(reward.item())
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Checkpoint
|
| 73 |
+
|
| 74 |
+
This repository contains the final checkpoint from training step 8,796. Only
|
| 75 |
+
inference artifacts are published; optimizer, scheduler, RNG, trainer, and FSDP
|
| 76 |
+
resume-state files are intentionally excluded.
|