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
Replace weights with absolute-only-ce-v1 checkpoint-1365 and document loading
Browse files- README.md +20 -4
- model-00001-of-00008.safetensors +1 -1
- model-00002-of-00008.safetensors +1 -1
- model-00003-of-00008.safetensors +1 -1
- model-00004-of-00008.safetensors +1 -1
- model-00005-of-00008.safetensors +1 -1
- model-00006-of-00008.safetensors +1 -1
- model-00007-of-00008.safetensors +1 -1
- model-00008-of-00008.safetensors +1 -1
README.md
CHANGED
|
@@ -14,6 +14,12 @@ tags:
|
|
| 14 |
This is a Qwen3-VL-8B-Instruct checkpoint fine-tuned as a yes/no image-text
|
| 15 |
alignment verifier.
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
## Load from Hugging Face
|
| 18 |
|
| 19 |
```python
|
|
@@ -22,12 +28,15 @@ from transformers import AutoProcessor, Qwen3VLForConditionalGeneration
|
|
| 22 |
|
| 23 |
model_id = "JanHutter/verifierreward"
|
| 24 |
|
| 25 |
-
processor = AutoProcessor.from_pretrained(
|
|
|
|
|
|
|
| 26 |
model = Qwen3VLForConditionalGeneration.from_pretrained(
|
| 27 |
model_id,
|
| 28 |
dtype=torch.bfloat16,
|
| 29 |
device_map="auto",
|
| 30 |
-
|
|
|
|
| 31 |
```
|
| 32 |
|
| 33 |
|
|
@@ -38,6 +47,9 @@ evaluation is the full-vocabulary probability of the next token being `yes`.
|
|
| 38 |
|
| 39 |
```python
|
| 40 |
import torch
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
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.
|
| 43 |
The given prompt is:{prompt}. Please consider the prompt and the image to make a decision and response directly with 'yes' or 'no'."""
|
|
@@ -45,7 +57,7 @@ The given prompt is:{prompt}. Please consider the prompt and the image to make a
|
|
| 45 |
messages = [{
|
| 46 |
"role": "user",
|
| 47 |
"content": [
|
| 48 |
-
{"type": "image", "image":
|
| 49 |
{"type": "text", "text": instruction.format(prompt="a red car in snow")},
|
| 50 |
],
|
| 51 |
}]
|
|
@@ -61,7 +73,11 @@ inputs = processor.apply_chat_template(
|
|
| 61 |
with torch.inference_mode():
|
| 62 |
logits = model(**inputs, use_cache=False).logits[:, -1, :].float()
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
reward = torch.softmax(logits, dim=-1)[:, yes_id]
|
| 66 |
print(reward.item())
|
| 67 |
```
|
|
|
|
|
|
|
|
|
| 14 |
This is a Qwen3-VL-8B-Instruct checkpoint fine-tuned as a yes/no image-text
|
| 15 |
alignment verifier.
|
| 16 |
|
| 17 |
+
|
| 18 |
+
Published checkpoint: `verifierreward-qwen3vl-8b-absolute-only-ce-v1/checkpoint-1365` (training step 1365). The repository root contains the complete model, tokenizer, and image/video processor files.
|
| 19 |
+
|
| 20 |
+
Install loading dependencies: `pip install "transformers>=4.57.6,<5" accelerate torch pillow torchvision`.
|
| 21 |
+
The stored weights are float32; load with `dtype=torch.bfloat16` as below to use approximately 17.5 GB for weights, plus inference memory.
|
| 22 |
+
|
| 23 |
## Load from Hugging Face
|
| 24 |
|
| 25 |
```python
|
|
|
|
| 28 |
|
| 29 |
model_id = "JanHutter/verifierreward"
|
| 30 |
|
| 31 |
+
processor = AutoProcessor.from_pretrained(
|
| 32 |
+
model_id, max_pixels=512 * 512, fix_mistral_regex=False,
|
| 33 |
+
)
|
| 34 |
model = Qwen3VLForConditionalGeneration.from_pretrained(
|
| 35 |
model_id,
|
| 36 |
dtype=torch.bfloat16,
|
| 37 |
device_map="auto",
|
| 38 |
+
attn_implementation="sdpa",
|
| 39 |
+
).eval()
|
| 40 |
```
|
| 41 |
|
| 42 |
|
|
|
|
| 47 |
|
| 48 |
```python
|
| 49 |
import torch
|
| 50 |
+
from PIL import Image
|
| 51 |
+
|
| 52 |
+
image = Image.open("image.jpg").convert("RGB")
|
| 53 |
|
| 54 |
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.
|
| 55 |
The given prompt is:{prompt}. Please consider the prompt and the image to make a decision and response directly with 'yes' or 'no'."""
|
|
|
|
| 57 |
messages = [{
|
| 58 |
"role": "user",
|
| 59 |
"content": [
|
| 60 |
+
{"type": "image", "image": image},
|
| 61 |
{"type": "text", "text": instruction.format(prompt="a red car in snow")},
|
| 62 |
],
|
| 63 |
}]
|
|
|
|
| 73 |
with torch.inference_mode():
|
| 74 |
logits = model(**inputs, use_cache=False).logits[:, -1, :].float()
|
| 75 |
|
| 76 |
+
yes_ids = processor.tokenizer.encode("yes", add_special_tokens=False)
|
| 77 |
+
assert len(yes_ids) == 1
|
| 78 |
+
yes_id = yes_ids[0]
|
| 79 |
reward = torch.softmax(logits, dim=-1)[:, yes_id]
|
| 80 |
print(reward.item())
|
| 81 |
```
|
| 82 |
+
|
| 83 |
+
For reproducible loading, pass the same commit SHA as `revision` to both `from_pretrained` calls.
|
model-00001-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4962686568
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b40a5d5167abfad6c82fadb3ecdc579074072f5f423965ed50c063ffe764ca1
|
| 3 |
size 4962686568
|
model-00002-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4832049608
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75c0e35574e78e2d97745621696d8745d0c93eb2bdd8a56a45b6fc729de91335
|
| 3 |
size 4832049608
|
model-00003-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4832049624
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c495730077bdbdd2655184e289e34e26021c5a6a0b5dcbfe75e6ecd6df336fde
|
| 3 |
size 4832049624
|
model-00004-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4999856656
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a08c064e8652cc2221a3a2c2aa4e00f7fce0213492777313814bd7c32a3cd4a
|
| 3 |
size 4999856656
|
model-00005-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4832049680
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a768df8a91f95edd6c01c4fc775e0ff21bb0c0051e084c18bab405febec284e7
|
| 3 |
size 4832049680
|
model-00006-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4832049672
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8afbfb608841cf265f317ba915832464e7be8e65100ab1986c73e3909d8ebf6
|
| 3 |
size 4832049672
|
model-00007-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 3288524864
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:961f01722d9a757d5ef2f5e9cff2e9bc3c39161dd07713839abb1ffeac535857
|
| 3 |
size 3288524864
|
model-00008-of-00008.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2489319552
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d307ec175c2b5f06044b639489e63542a71931f00cb1c95b1ad025b39a415ad
|
| 3 |
size 2489319552
|