DesonDai commited on
Commit
bed4da7
·
verified ·
1 Parent(s): ce80556

Add files using upload-large-folder tool

Browse files
models/qwen3_vl_compat.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Helpers for Qwen3-VL (transformers): vision lives on model.model.visual,
3
+ and ViT+merger returns BaseModelOutputWithDeepstackFeatures.pooler_output.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import torch
9
+
10
+
11
+ def get_visual_module(model: torch.nn.Module):
12
+ inner = getattr(model, "model", None)
13
+ if inner is not None and hasattr(inner, "visual"):
14
+ return inner.visual
15
+ return model.visual
16
+
17
+
18
+ def set_visual_module(model: torch.nn.Module, value) -> None:
19
+ inner = getattr(model, "model", None)
20
+ if inner is not None and hasattr(inner, "visual"):
21
+ inner.visual = value
22
+ return
23
+ model.visual = value
24
+
25
+
26
+ def merged_spatial_grid(image_grid_thw: torch.Tensor, spatial_merge_size: int) -> torch.Tensor:
27
+ """Processor grid (T,H,W) -> LLM-side grid after spatial merge on H,W."""
28
+ g = image_grid_thw.clone()
29
+ g[:, 1] = g[:, 1] // spatial_merge_size
30
+ g[:, 2] = g[:, 2] // spatial_merge_size
31
+ return g
32
+
33
+
34
+ def pack_image_features(model, pixel_values: torch.Tensor, image_grid_thw: torch.Tensor):
35
+ """
36
+ Returns flat merger embeddings [total_tokens, D] and LLM grid [num_imgs, 3]
37
+ consistent with OpticalCompressor token counts.
38
+ """
39
+ inner = model.model if hasattr(model, "model") else model
40
+ out = inner.get_image_features(pixel_values, image_grid_thw)
41
+ parts = out.pooler_output
42
+ if isinstance(parts, (list, tuple)):
43
+ packed = torch.cat(parts, dim=0)
44
+ else:
45
+ packed = parts
46
+ vis = get_visual_module(model)
47
+ grid_llm = merged_spatial_grid(image_grid_thw, vis.spatial_merge_size)
48
+ return packed, grid_llm
49
+
results/benchmark/all_clip_scores.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "efficientui_prune60": {
3
+ "n": 50,
4
+ "avg_clip": 0.7523,
5
+ "min_clip": 0.4951,
6
+ "max_clip": 0.9579
7
+ },
8
+ "efficientui_prune80": {
9
+ "n": 50,
10
+ "avg_clip": 0.738,
11
+ "min_clip": 0.4485,
12
+ "max_clip": 0.9265
13
+ },
14
+ "qwen3_full": {
15
+ "n": 50,
16
+ "avg_clip": 0.7563,
17
+ "min_clip": 0.0,
18
+ "max_clip": 0.9357
19
+ },
20
+ "qwen3_res_1003520": {
21
+ "n": 50,
22
+ "avg_clip": 0.775,
23
+ "min_clip": 0.4805,
24
+ "max_clip": 0.9281
25
+ },
26
+ "qwen3_res_230400": {
27
+ "n": 50,
28
+ "avg_clip": 0.7768,
29
+ "min_clip": 0.4308,
30
+ "max_clip": 0.9515
31
+ },
32
+ "uipress_256": {
33
+ "n": 50,
34
+ "avg_clip": 0.7232,
35
+ "min_clip": 0.4485,
36
+ "max_clip": 0.8768
37
+ },
38
+ "visionzip_128": {
39
+ "n": 50,
40
+ "avg_clip": 0.7245,
41
+ "min_clip": 0.4485,
42
+ "max_clip": 0.8763
43
+ },
44
+ "visionzip_256": {
45
+ "n": 50,
46
+ "avg_clip": 0.7333,
47
+ "min_clip": 0.4485,
48
+ "max_clip": 0.881
49
+ },
50
+ "visionzip_64": {
51
+ "n": 50,
52
+ "avg_clip": 0.7197,
53
+ "min_clip": 0.4485,
54
+ "max_clip": 0.8768
55
+ }
56
+ }
results/benchmark/bootstrap_ci.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "efficientui_prune60": {
3
+ "mean": 0.752298,
4
+ "ci_lower": 0.7238,
5
+ "ci_upper": 0.7804,
6
+ "ci_width": 0.0567,
7
+ "std": 0.1015,
8
+ "n": 50
9
+ },
10
+ "efficientui_prune80": {
11
+ "mean": 0.737994,
12
+ "ci_lower": 0.7076,
13
+ "ci_upper": 0.7678,
14
+ "ci_width": 0.0602,
15
+ "std": 0.1097,
16
+ "n": 50
17
+ },
18
+ "qwen3_full": {
19
+ "mean": 0.75634,
20
+ "ci_lower": 0.7099,
21
+ "ci_upper": 0.7941,
22
+ "ci_width": 0.0842,
23
+ "std": 0.1522,
24
+ "n": 50
25
+ },
26
+ "qwen3_res_1003520": {
27
+ "mean": 0.775018,
28
+ "ci_lower": 0.7453,
29
+ "ci_upper": 0.8028,
30
+ "ci_width": 0.0575,
31
+ "std": 0.1029,
32
+ "n": 50
33
+ },
34
+ "qwen3_res_230400": {
35
+ "mean": 0.7767660000000001,
36
+ "ci_lower": 0.7486,
37
+ "ci_upper": 0.8036,
38
+ "ci_width": 0.055,
39
+ "std": 0.1006,
40
+ "n": 50
41
+ },
42
+ "uipress_256": {
43
+ "mean": 0.7232,
44
+ "ci_lower": 0.695,
45
+ "ci_upper": 0.7511,
46
+ "ci_width": 0.0561,
47
+ "std": 0.1022,
48
+ "n": 50
49
+ },
50
+ "visionzip_128": {
51
+ "mean": 0.724536,
52
+ "ci_lower": 0.6958,
53
+ "ci_upper": 0.7524,
54
+ "ci_width": 0.0567,
55
+ "std": 0.1033,
56
+ "n": 50
57
+ },
58
+ "visionzip_256": {
59
+ "mean": 0.733302,
60
+ "ci_lower": 0.705,
61
+ "ci_upper": 0.7612,
62
+ "ci_width": 0.0562,
63
+ "std": 0.103,
64
+ "n": 50
65
+ },
66
+ "visionzip_64": {
67
+ "mean": 0.7196839999999999,
68
+ "ci_lower": 0.6927,
69
+ "ci_upper": 0.7457,
70
+ "ci_width": 0.053,
71
+ "std": 0.0976,
72
+ "n": 50
73
+ }
74
+ }