jennyxue commited on
Commit
b1b534f
·
verified ·
1 Parent(s): f9ef131

fp16 build of dots.mocr

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ fp16/decoder.onnx.data filter=lfs diff=lfs merge=lfs -text
37
+ fp16/vision.onnx.data filter=lfs diff=lfs merge=lfs -text
fp16/chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{%- for m in messages %}{%- if m.role == 'system' %}{{- '<|system|>' + m.content + '<|endofsystem|>\n' }}{%- elif m.role == 'user' %}{% if m.content is string %}{{- '<|user|>' + m.content + '<|endofuser|>' }}{% else %}{{- '<|user|>' }}{% for content in m.content %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|img|><|imgpad|><|endofimg|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|img|><|video_pad|><|endofimg|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}{{- '<|endofuser|>' }}{%- endif %}{%- elif m.role == 'assistant' %}{{- '<|assistant|>' + m.content }}{%- if not loop.last %}{{- '<|endofassistant|>' }}{%- endif %}{%- endif %}{%- endfor %}{%- if messages[-1].role != 'assistant' %}{{- '<|assistant|>' }}{%- endif %}"
3
+ }
fp16/decoder.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e7cff6f1700b4bbda355864a9074a501408a4a8103d48ac8ac4e4d6d6e51bc6
3
+ size 169929
fp16/decoder.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0c5ef55a0858a0496dda7f2c86b368051715aebc0bd12a0b57238dff3ae2be9
3
+ size 3120983040
fp16/embed.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1180f1addfa2429488636d9eafbdc52b9b49312e5abaf0b81f93401e512c428
3
+ size 466747584
fp16/generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "max_length": 32768,
3
+ "eos_token_id": [
4
+ 151643,
5
+ 151672,
6
+ 151673
7
+ ]
8
+ }
fp16/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
fp16/pipeline.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """dots.mocr document recognition with ONNX Runtime: the 1.2B dots vision encoder + patch merger, the token embedding
2
+ and the 1.5B Qwen2 decoder (onnxruntime-genai's builder; KV cache) as ONNX graphs, numpy around them, following the
3
+ repository's processor (Qwen2-VL image processing, temporal patch 1) and greedy decoding: the image resized
4
+ (bicubic) to multiples of 28 within 3 136 - 11 289 600 pixels, normalised with CLIP's mean / std, cut into 3 x 14 x 14
5
+ patches in 2 x 2 merge blocks; the chat prompt "<|user|><image>{prompt}<|endofuser|><|assistant|>"; plain 1-D
6
+ positions; decoding until an end token. Needs numpy, onnxruntime (or onnxruntime-gpu), tokenizers and Pillow.
7
+
8
+ python int8/pipeline.py page.png [--prompt "Extract the text content from this image."] [--cuda]
9
+
10
+ Prompts as in dots_mocr/utils/prompts.py ("prompt_ocr" is the default here; "prompt_layout_all_en" asks for the
11
+ layout as JSON).
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import math
17
+ from pathlib import Path
18
+
19
+ import numpy as np
20
+
21
+ PATCH, MERGE, MIN_PX, MAX_PX = 14, 2, 3136, 11289600
22
+ MEAN = np.array([0.48145466, 0.4578275, 0.40821073], np.float32)[:, None, None]
23
+ STD = np.array([0.26862954, 0.26130258, 0.27577711], np.float32)[:, None, None]
24
+ IMAGE_TOKEN, EOS = 151665, (151643, 151672, 151673)
25
+ PROMPT = "Extract the text content from this image."
26
+
27
+
28
+ def smart_resize(h, w, factor=28, min_pixels=MIN_PX, max_pixels=MAX_PX):
29
+ hb, wb = max(factor, round(h / factor) * factor), max(factor, round(w / factor) * factor)
30
+ if hb * wb > max_pixels:
31
+ beta = math.sqrt(h * w / max_pixels)
32
+ hb, wb = max(factor, math.floor(h / beta / factor) * factor), max(factor, math.floor(w / beta / factor) * factor)
33
+ elif hb * wb < min_pixels:
34
+ beta = math.sqrt(min_pixels / (h * w))
35
+ hb, wb = math.ceil(h * beta / factor) * factor, math.ceil(w * beta / factor) * factor
36
+ return hb, wb
37
+
38
+
39
+ def vision_positions(gh, gw, merge=MERGE):
40
+ hp, wp = np.meshgrid(np.arange(gh), np.arange(gw), indexing="ij")
41
+ blk = (gh // merge, merge, gw // merge, merge)
42
+ return np.stack([hp.reshape(blk).transpose(0, 2, 1, 3).ravel(),
43
+ wp.reshape(blk).transpose(0, 2, 1, 3).ravel()], -1).astype(np.int64)
44
+
45
+
46
+ class DotsOCR:
47
+ def __init__(self, folder, provider="cpu"):
48
+ import onnxruntime as ort
49
+ from tokenizers import Tokenizer
50
+ folder = Path(folder)
51
+ self.tok = Tokenizer.from_file(str(folder / "tokenizer.json"))
52
+ if provider != "cpu" and hasattr(ort, "preload_dlls"):
53
+ try:
54
+ ort.preload_dlls()
55
+ except Exception:
56
+ pass
57
+ so = ort.SessionOptions()
58
+ so.log_severity_level = 3
59
+ pv = ["CPUExecutionProvider"] if provider == "cpu" else [
60
+ ("CUDAExecutionProvider", {"arena_extend_strategy": "kSameAsRequested"}), "CPUExecutionProvider"]
61
+ self.s = {n: ort.InferenceSession(str(folder / f"{n}.onnx"), so, providers=pv)
62
+ for n in ("vision", "embed", "decoder")}
63
+ self.ro = ort.RunOptions()
64
+ if provider != "cpu": # Windows: every input length differs, and the GPU arena would keep each step's buffers
65
+ self.ro.add_run_config_entry("memory.enable_memory_arena_shrinkage", "gpu:0")
66
+ d = self.s["decoder"]
67
+ ins = {i.name: i for i in d.get_inputs()}
68
+ self.past_names = [n for n in ins if n.startswith("past_key_values.")]
69
+ pk = ins[self.past_names[0]]
70
+ self.kvh, self.hd = pk.shape[1], pk.shape[3]
71
+ self.kv_dt = np.float16 if pk.type == "tensor(float16)" else np.float32
72
+ self.e_dt = np.float16 if ins["inputs_embeds"].type == "tensor(float16)" else np.float32
73
+ self.out_names = [o.name for o in d.get_outputs()]
74
+ self.emb_dt = np.float16 if self.s["embed"].get_outputs()[0].type == "tensor(float16)" else np.float32
75
+
76
+ def run(self, name, **feeds):
77
+ return self.s[name].run(None, feeds, self.ro)
78
+
79
+ def patches(self, img):
80
+ from PIL import Image
81
+ img = img.convert("RGB")
82
+ W, H = img.size
83
+ h, w = smart_resize(H, W)
84
+ x = np.asarray(img.resize((w, h), Image.BICUBIC), np.float32) / 255.0
85
+ x = (x.transpose(2, 0, 1) - MEAN) / STD
86
+ gh, gw = h // PATCH, w // PATCH
87
+ p = x.reshape(3, gh // MERGE, MERGE, PATCH, gw // MERGE, MERGE, PATCH).transpose(1, 4, 2, 5, 0, 3, 6)
88
+ return np.ascontiguousarray(p.reshape(gh * gw, 3 * PATCH * PATCH), np.float32), gh, gw
89
+
90
+ def prompt_ids(self, n_image, prompt):
91
+ ids = lambda t: self.tok.encode(t, add_special_tokens=False).ids
92
+ return ids("<|user|><|img|>") + [IMAGE_TOKEN] * n_image + ids("<|endofimg|>" + prompt + "<|endofuser|><|assistant|>")
93
+
94
+ def __call__(self, img, prompt=PROMPT, max_new_tokens=2048):
95
+ p, gh, gw = self.patches(img)
96
+ emb_img = self.run("vision", pixel_values=p, position_ids=vision_positions(gh, gw))[0]
97
+ ids = self.prompt_ids(emb_img.shape[0], prompt)
98
+ x = self.run("embed", input_ids=np.asarray([ids], np.int64))[0].astype(np.float32)
99
+ x[0, np.asarray(ids) == IMAGE_TOKEN] = emb_img
100
+ past = {n: np.zeros((1, self.kvh, 0, self.hd), self.kv_dt) for n in self.past_names}
101
+ total, out = len(ids), []
102
+ for _ in range(max_new_tokens):
103
+ res = self.s["decoder"].run(None, {"inputs_embeds": x.astype(self.e_dt), "attention_mask":
104
+ np.ones((1, total), np.int64), **past}, self.ro)
105
+ o = dict(zip(self.out_names, res))
106
+ t = int(np.argmax(o["logits"][0, -1]))
107
+ if t in EOS:
108
+ break
109
+ out.append(t)
110
+ past = {n.replace("present", "past_key_values"): o[n] for n in self.out_names if n.startswith("present")}
111
+ x = self.run("embed", input_ids=np.asarray([[t]], np.int64))[0].astype(np.float32)
112
+ total += 1
113
+ return self.tok.decode(out, skip_special_tokens=True)
114
+
115
+
116
+ if __name__ == "__main__":
117
+ import argparse
118
+ from PIL import Image
119
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
120
+ ap.add_argument("image"); ap.add_argument("--prompt", default=PROMPT)
121
+ ap.add_argument("--dir", default=str(Path(__file__).resolve().parent)); ap.add_argument("--cuda", action="store_true")
122
+ a = ap.parse_args()
123
+ print(DotsOCR(a.dir, "cuda" if a.cuda else "cpu")(Image.open(a.image), a.prompt))
fp16/preprocessor_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoProcessor": "configuration_dots.DotsVLProcessor"
4
+ },
5
+ "min_pixels": 3136,
6
+ "max_pixels": 11289600,
7
+ "patch_size": 14,
8
+ "temporal_patch_size": 1,
9
+ "merge_size": 2,
10
+ "image_mean": [
11
+ 0.48145466,
12
+ 0.4578275,
13
+ 0.40821073
14
+ ],
15
+ "image_std": [
16
+ 0.26862954,
17
+ 0.26130258,
18
+ 0.27577711
19
+ ],
20
+ "image_processor_type": "Qwen2VLImageProcessor",
21
+ "processor_class": "DotsVLProcessor"
22
+ }
fp16/special_tokens_map.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": "[PAD]"
25
+ }
fp16/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
fp16/tokenizer_config.json ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<|imgpad|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ },
189
+ "151666": {
190
+ "content": "<|img|>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": true
196
+ },
197
+ "151667": {
198
+ "content": "<|endofimg|>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": true
204
+ },
205
+ "151668": {
206
+ "content": "<|systemprompt|>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": true
212
+ },
213
+ "151669": {
214
+ "content": "<|endofsystemprompt|>",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": true
220
+ },
221
+ "151670": {
222
+ "content": "<|user|>",
223
+ "lstrip": false,
224
+ "normalized": false,
225
+ "rstrip": false,
226
+ "single_word": false,
227
+ "special": true
228
+ },
229
+ "151671": {
230
+ "content": "<|endofuser|>",
231
+ "lstrip": false,
232
+ "normalized": false,
233
+ "rstrip": false,
234
+ "single_word": false,
235
+ "special": true
236
+ },
237
+ "151672": {
238
+ "content": "<|assistant|>",
239
+ "lstrip": false,
240
+ "normalized": false,
241
+ "rstrip": false,
242
+ "single_word": false,
243
+ "special": true
244
+ },
245
+ "151673": {
246
+ "content": "<|endofassistant|>",
247
+ "lstrip": false,
248
+ "normalized": false,
249
+ "rstrip": false,
250
+ "single_word": false,
251
+ "special": true
252
+ },
253
+ "151674": {
254
+ "content": "<|ref_start|>",
255
+ "lstrip": false,
256
+ "normalized": false,
257
+ "rstrip": false,
258
+ "single_word": false,
259
+ "special": true
260
+ },
261
+ "151675": {
262
+ "content": "<|ref_end|>",
263
+ "lstrip": false,
264
+ "normalized": false,
265
+ "rstrip": false,
266
+ "single_word": false,
267
+ "special": true
268
+ },
269
+ "151676": {
270
+ "content": "[SEP]",
271
+ "lstrip": false,
272
+ "normalized": false,
273
+ "rstrip": false,
274
+ "single_word": false,
275
+ "special": true
276
+ },
277
+ "151677": {
278
+ "content": "<|pic|>",
279
+ "lstrip": false,
280
+ "normalized": false,
281
+ "rstrip": false,
282
+ "single_word": false,
283
+ "special": true
284
+ },
285
+ "151678": {
286
+ "content": "<|text|>",
287
+ "lstrip": false,
288
+ "normalized": false,
289
+ "rstrip": false,
290
+ "single_word": false,
291
+ "special": true
292
+ },
293
+ "151679": {
294
+ "content": "<|pictotext|>",
295
+ "lstrip": false,
296
+ "normalized": false,
297
+ "rstrip": false,
298
+ "single_word": false,
299
+ "special": true
300
+ },
301
+ "151680": {
302
+ "content": "[PAD]",
303
+ "lstrip": false,
304
+ "normalized": false,
305
+ "rstrip": false,
306
+ "single_word": false,
307
+ "special": true
308
+ },
309
+ "151681": {
310
+ "content": "<|slice|>",
311
+ "lstrip": false,
312
+ "normalized": false,
313
+ "rstrip": false,
314
+ "single_word": false,
315
+ "special": true
316
+ },
317
+ "151682": {
318
+ "content": "<|endofslice|>",
319
+ "lstrip": false,
320
+ "normalized": false,
321
+ "rstrip": false,
322
+ "single_word": false,
323
+ "special": true
324
+ },
325
+ "151683": {
326
+ "content": "<|imgrowend|>",
327
+ "lstrip": false,
328
+ "normalized": false,
329
+ "rstrip": false,
330
+ "single_word": false,
331
+ "special": true
332
+ },
333
+ "151684": {
334
+ "content": "<|polygon_start|>",
335
+ "lstrip": false,
336
+ "normalized": false,
337
+ "rstrip": false,
338
+ "single_word": false,
339
+ "special": true
340
+ },
341
+ "151685": {
342
+ "content": "<|polygon_end|>",
343
+ "lstrip": false,
344
+ "normalized": false,
345
+ "rstrip": false,
346
+ "single_word": false,
347
+ "special": true
348
+ },
349
+ "151686": {
350
+ "content": "<|image_gen_start|>",
351
+ "lstrip": false,
352
+ "normalized": false,
353
+ "rstrip": false,
354
+ "single_word": false,
355
+ "special": true
356
+ },
357
+ "151687": {
358
+ "content": "<|image_gen_end|>",
359
+ "lstrip": false,
360
+ "normalized": false,
361
+ "rstrip": false,
362
+ "single_word": false,
363
+ "special": true
364
+ }
365
+ },
366
+ "additional_special_tokens": [
367
+ "<|im_start|>",
368
+ "<|im_end|>",
369
+ "<|object_ref_start|>",
370
+ "<|object_ref_end|>",
371
+ "<|box_start|>",
372
+ "<|box_end|>",
373
+ "<|quad_start|>",
374
+ "<|quad_end|>",
375
+ "<|vision_start|>",
376
+ "<|vision_end|>",
377
+ "<|vision_pad|>",
378
+ "<|image_pad|>",
379
+ "<|video_pad|>"
380
+ ],
381
+ "bos_token": null,
382
+ "chat_template": "{%- for m in messages %}\n {%- if m.role == 'system' %}\n {{- '<|system|>' + m.content + '<|endofsystem|>\\n' }}\n {%- elif m.role == 'user' %}\n {{- '<|user|>' + m.content + '<|endofuser|>' }}\n {%- elif m.role == 'assistant' %}\n {{- '<|assistant|>' + m.content }}\n {%- if not loop.last %}\n {{- '<|endofassistant|>' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if messages[-1].role != 'assistant' %}\n {{- '<|assistant|>' }}\n{%- endif %}",
383
+ "clean_up_tokenization_spaces": false,
384
+ "eos_token": "<|endoftext|>",
385
+ "errors": "replace",
386
+ "model_max_length": 131072,
387
+ "pad_token": "[PAD]",
388
+ "split_special_tokens": false,
389
+ "tokenizer_class": "Qwen2Tokenizer",
390
+ "unk_token": null
391
+ }
fp16/vision.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3c8faf4d74715d43a23793b12ed7c450c5c6ea20a2d4158f18586c554d35341
3
+ size 1257501
fp16/vision.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12ea0e09143be33c0c5191faefbc4e5dcc0fa2e27649e1fb68b129d4c01e3e7b
3
+ size 2524182528
fp16/vocab.json ADDED
The diff for this file is too large to render. See raw diff