JanHutter commited on
Commit
d3cd155
·
verified ·
1 Parent(s): a411566

Add model card and loading example

Browse files
Files changed (1) hide show
  1. README.md +74 -1
README.md CHANGED
@@ -1,3 +1,76 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
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.