JanHutter commited on
Commit
08cd424
·
verified ·
1 Parent(s): 076eca1

Replace weights with absolute-only-ce-v1 checkpoint-1365 and document loading

Browse files
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(model_id)
 
 
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": "https://example.com/image.jpg"},
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
- yes_id = processor.tokenizer.encode("yes", add_special_tokens=False)[0]
 
 
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:07b1ed12130603a4d5363930c67a35dbe29c1cf9e07fe6b00b80bf61d7258eb1
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:9ee2f57f3cb6c3851fda173fd31a6e042f9b7a79584cc6e901216182ab8ff0da
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:eb093497cdbaa15dbba0dfdf615c142530657acdb9e6b3dd458a2e55e3bdb1f0
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:2ad6714a7a09d3939fb6eabe263e0362ba8c27b558883289ac9df0655f4389b8
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:a5f05066d66bc50c83e82046250a8e7c47c2ca372c82a3abc03d1053b55477c1
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:e62d4b3a890845109b7bd18e462f87fa7cb578a26ed3dd8c3db025d20f400273
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:08bf618b9d5757b87f9da3f77c14507a7cb8b31bb69e71ec78ba700f6321d740
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:19c691298cfd78e8df4c01335c4b8125f4b1152bd23da8f6b0d60fbd86a9c231
3
  size 2489319552
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d307ec175c2b5f06044b639489e63542a71931f00cb1c95b1ad025b39a415ad
3
  size 2489319552