Image-Text-to-Text
Transformers
Safetensors
qwen3_5
decision-model
system-one
flide
ocr
pdf
document-understanding
hf_jobs
conversational
davanstrien HF Staff commited on
Commit
c71182a
·
verified ·
1 Parent(s): daef1ad

Stage Gate 2 2-seed souped 0.8B Apache-2.0 document decision model (private)

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: OmniJev/OneJev1.6-0.8B
4
+ pipeline_tag: image-text-to-text
5
+ tags:
6
+ - decision-model
7
+ - system-one
8
+ - flide
9
+ - document-understanding
10
+ - ocr
11
+ - qwen3_5
12
+ language:
13
+ - en
14
+ - de
15
+ - fr
16
+ - es
17
+ - it
18
+ - nl
19
+ - pt
20
+ - la
21
+ - uk
22
+ - ru
23
+ - zh
24
+ - ja
25
+ - ar
26
+ datasets:
27
+ - allenai/olmOCR-mix-1025
28
+ - docling-project/DocLayNet-v1.2
29
+ - JustQuiteMadMax/ukrainian-handwritten-text-full-pages
30
+ ---
31
+
32
+ # doc-decision-0.8b
33
+
34
+ `doc-decision-0.8b` is a 0.8B Apache-2.0 multimodal [decision model](https://huggingface.co/blog/decision) fine-tuned from [OmniJev/OneJev1.6-0.8B](https://huggingface.co/OmniJev/OneJev1.6-0.8B) (`Qwen3_5ForConditionalGeneration`) for full-page document triage and OCR / PDF text-layer verification.
35
+
36
+ It evaluates structured yes/no (`noul`) and multiple-choice (`choice`) questions over a full page image, a `(page image, ocr_transcription)` pair, or text alone. It produces zero generated tokens: a single forward pass reads the standard `lm_head` logits over the active uppercase option letters (`A`, `B`, ...) and returns calibrated probabilities. There are no custom classification heads, so the merged weights load in `flide`, `transformers`, `vLLM`, and `llama.cpp`.
37
+
38
+ ## What it is for
39
+
40
+ - **Pre-OCR triage & routing** (`{"page": "<image:1>"}`): detect blank pages, tables, figures, handwriting, blackletter/Fraktur, script, colour mode, orientation, and document or page role before running OCR.
41
+ - **Full-page OCR verification** (`{"page": "<image:1>", "ocr_transcription": "..."}`): check an existing transcription against the page image for hallucinated or wrong-page text (`extra`), missing text blocks (`omission`), and repetition loops (`loop`).
42
+ - **PDF text-layer auditing**: check whether a PDF's free embedded text layer (e.g. from `pypdfium2`) is usable or missing/partial before paying for GPU OCR.
43
+ - **Text-only loop detection** (`{"ocr_transcription": "..."}`): flag repetitive degenerate OCR outputs without loading an image.
44
+
45
+ > [!NOTE]
46
+ > **Omission detection is the weakest of the four OCR checks** (0.823 AUROC on 19th-century books, 0.828 AUROC on modern PDFs — 0.998 on missing text layers, 0.658 on partial omissions where most of the page is still present). It is reliable for catching blank/missing text layers and dropped sections; for subtle 1–2 line drops on dense pages, tune the threshold on a small validation sample rather than assuming `0.50` is optimal.
47
+
48
+ ## Evaluation
49
+
50
+ All benchmarks below are strictly out-of-distribution (zero source or volume overlap with training). Base `OneJev1.6-0.8B` and `doc-decision-0.8b` were evaluated identically through `flide serve` at `max_side=1024`.
51
+
52
+ ### 1. Pre-OCR page facts (held-out historical & modern collections, 1,088 pages)
53
+
54
+ | Metric | `OneJev1.6-0.8B` (base) | `doc-decision-0.8b` | Delta (95% page bootstrap CI) |
55
+ |---|---:|---:|---:|
56
+ | Binary page facts (`noul`, all 1,047 pages) BalAcc / Med AUC | 0.740 / 0.839 | **0.781 / 0.933** | `+0.042 [+0.024, +0.058]` |
57
+ | Binary page facts (`noul`, real 946 pages) BalAcc / Med AUC | 0.741 / 0.831 | **0.822 / 0.999** | `+0.080 [+0.062, +0.097]` |
58
+ | Multiple-choice (`choice`, 1,040 sets) Top-1 | 0.649 | **0.793** | `+0.144 [+0.114, +0.171]` |
59
+ | — `gold != other` / `gold == other` | 0.652 / 0.642 | **0.817 / 0.745** | `+0.165 / +0.103` |
60
+ | — `colour_mode` / `orientation` / `script` | 0.549 / 0.834 / 0.547 | **0.969 / 0.902 / 0.771** | `+0.420 / +0.068 / +0.224` |
61
+ | — `hand` / `document_type` | 0.666 / 0.645 | **0.642 / 0.717** | `-0.024 / +0.072` |
62
+ | Held-out unseen visual questions (`music`, `stamp_seal`, `catchword`, 203 items) | 0.852 | **0.858** | `+0.006` (no forgetting) |
63
+
64
+ ### 2. Full-page OCR verification on real 19th-century books (533 items, held-out BHL volumes)
65
+
66
+ Evaluated against real multi-engine OCR failures (not synthetic corruptions) on 6 held-out Biodiversity Heritage Library volumes:
67
+
68
+ | Criterion | `OneJev1.6-0.8B` (base) | `doc-decision-0.8b` | Delta (95% bootstrap CI) | Acc @ 0.50 |
69
+ |---|---:|---:|---:|---:|
70
+ | `blank` (is there printed text?) | 0.967 | **1.000** (0.9998) | `+0.033 [+0.000, +0.074]` | 0.987 |
71
+ | `extra` (hallucinated / wrong-page text) | 0.564 | **0.985** | `+0.421 [+0.321, +0.522]` | 0.892 |
72
+ | `loop` (stuck repetition loop) | 0.921 | **0.998** | `+0.077 [+0.035, +0.122]` | 0.984 |
73
+ | `omission` (missing printed text block) | 0.409 | **0.823** | `+0.414 [+0.291, +0.533]` | 0.585 (best 0.708) |
74
+
75
+ ### 3. Modern 2026 PDF text-layer verification (300 items, Common Crawl 2026 PDFs)
76
+
77
+ Evaluated on real embedded `pypdfium2` text layers compared against VLM OCR ground truth (`missing`: `<20` embedded chars on a real text page; `partial`: `<45%` of page text present in the embedded layer):
78
+
79
+ | Criterion | `OneJev1.6-0.8B` (base) | `doc-decision-0.8b` | Acc @ 0.50 |
80
+ |---|---:|---:|---:|
81
+ | `extra` (wrong-page or injected text vs. clean text layer) | 0.376 | **1.000** | 1.000 |
82
+ | `omission` (overall: missing + partial vs. clean) | 0.576 | **0.828** | 0.733 |
83
+ | — `missing` text layer vs. clean | 0.679 | **0.998** | — |
84
+ | — `partial` text layer vs. clean | 0.472 | **0.658** | — |
85
+
86
+ ### 4. Throughput
87
+
88
+ Measured on a single NVIDIA RTX PRO 6000 via `flide serve` (which shares the image + `<state>` prefix across all questions on a page via `ForkAttention`):
89
+
90
+ - **Pre-OCR triage** (~9 questions/page, 1,088 pages): **14.8 pages/sec**
91
+ - **31-question curation batch** (851 pages × 31 questions = 26,381 decisions): **5.4 pages/sec** (169 decisions/sec)
92
+ - **Full-page OCR verification** (1 question + full page image + transcription): **7.4–30 pages/sec** depending on transcription length
93
+
94
+ ## Usage
95
+
96
+ ### Recommended: `flide serve` (`/v1/systemone`)
97
+
98
+ `flide` automatically loads `decision_config.json` (`onejev-slot-v2`) and `calibration.json` (`noul` temperature `T = 2.5`, `choice` `T = 1.0`) and forks the cached page prefix across all questions in a request.
99
+
100
+ ```bash
101
+ pip install flide
102
+ flide serve davanstrien/doc-decision-0.8b --port 8000
103
+ ```
104
+
105
+ ```python
106
+ import base64, httpx
107
+
108
+ with open("page.jpg", "rb") as f:
109
+ data_url = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()
110
+
111
+ # Example: verify an existing OCR transcription and classify document type in one pass
112
+ resp = httpx.post(
113
+ "http://127.0.0.1:8000/v1/systemone",
114
+ json={
115
+ "state": {
116
+ "page": "<image:1>",
117
+ "ocr_transcription": "Existing OCR or PDF text layer goes here...",
118
+ },
119
+ "media": [{"type": "image", "data": data_url}],
120
+ "questions": {
121
+ "has_text": {
122
+ "type": "noul",
123
+ "instructions": "Is there printed text on this page?",
124
+ },
125
+ "has_extra": {
126
+ "type": "noul",
127
+ "instructions": "Does this transcription contain text that is not printed on the page?",
128
+ },
129
+ "has_omission": {
130
+ "type": "noul",
131
+ "instructions": "Is a block of printed text on this page missing from the transcription?",
132
+ },
133
+ "has_loop": {
134
+ "type": "noul",
135
+ "instructions": "Is this transcription stuck in a loop, repeating a pattern again and again instead of reading new text?",
136
+ },
137
+ },
138
+ },
139
+ timeout=60.0,
140
+ )
141
+ print(resp.json()["answers"])
142
+ ```
143
+
144
+ ### Direct `transformers` (single-question slot readout)
145
+
146
+ ```python
147
+ import torch
148
+ from PIL import Image
149
+ from transformers import AutoModelForImageTextToText, AutoProcessor
150
+
151
+ model_id = "davanstrien/doc-decision-0.8b"
152
+ processor = AutoProcessor.from_pretrained(model_id)
153
+ model = AutoModelForImageTextToText.from_pretrained(
154
+ model_id, dtype=torch.bfloat16, device_map="auto"
155
+ ).eval()
156
+
157
+ image = Image.open("page.jpg").convert("RGB")
158
+ messages = [
159
+ {
160
+ "role": "system",
161
+ "content": (
162
+ "Apply the question to the state. Choose exactly one of the listed options. "
163
+ "Respond with only its uppercase letter, with no explanation or reasoning."
164
+ ),
165
+ },
166
+ {
167
+ "role": "user",
168
+ "content": [
169
+ {"type": "text", "text": '<state>\n{\n "page": "'},
170
+ {"type": "image"},
171
+ {
172
+ "type": "text",
173
+ "text": (
174
+ '"\n}\n</state>\n\n'
175
+ "Question: Is there printed text on this page?\n\n"
176
+ "Options:\n"
177
+ "A. yes: the statement is true / the answer is yes\n"
178
+ "B. no: the statement is false / the answer is no\n\n"
179
+ "Answer with one letter: A, B."
180
+ ),
181
+ },
182
+ ],
183
+ },
184
+ ]
185
+
186
+ prompt = processor.apply_chat_template(
187
+ messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
188
+ )
189
+ inputs = processor(text=[prompt], images=[image], return_tensors="pt").to(model.device)
190
+ slot_ids = [processor.tokenizer.encode(c, add_special_tokens=False)[0] for c in ("A", "B")]
191
+
192
+ with torch.inference_mode():
193
+ logits = model(**inputs).logits[0, -1, slot_ids].float()
194
+ probs = torch.softmax(logits / 2.5, dim=-1).tolist() # T=2.5 matches calibration.json
195
+
196
+ print({"yes": round(probs[0], 4), "no": round(probs[1], 4)})
197
+ ```
198
+
199
+ ## Training & provenance
200
+
201
+ - **Base model:** [OmniJev/OneJev1.6-0.8B](https://huggingface.co/OmniJev/OneJev1.6-0.8B) (Apache-2.0, `Qwen3_5ForConditionalGeneration`).
202
+ - **Training data:** 97,392 decisions across 18,454 unique pages, built strictly from commercially permissive sources (all non-commercial / restricted sources excluded):
203
+ - Full-page document & OCR verification pairs from [allenai/olmOCR-mix-1025](https://huggingface.co/datasets/allenai/olmOCR-mix-1025) (ODC-BY: modern PDFs, scanned books, Library of Congress transcripts, National Archives records, with non-English pages oversampled), [docling-project/DocLayNet-v1.2](https://huggingface.co/datasets/docling-project/DocLayNet-v1.2) (CDLA-Permissive: surgical single-layout-box omissions via `pdf_cells`), and [JustQuiteMadMax/ukrainian-handwritten-text-full-pages](https://huggingface.co/datasets/JustQuiteMadMax/ukrainian-handwritten-text-full-pages) (CC-BY-4.0: full-page handwritten Cyrillic manuscripts).
204
+ - Pre-OCR page-attribute `noul` and `choice` annotations (real pages only, no synthetic blur/crop distortions) plus lossless 90°/180°/270° page rotations and text-NLI replay (6,361 pairs).
205
+ - **Method:** Two independent LoRA runs (`seed=42`, `seed=137`; `r=32, alpha=64` across all LM full-attention, Gated DeltaNet, MLP, and vision encoder/projector linear layers; `max_side=1024`; `lr=8e-5`; valid-slot label smoothing `0.05`; 1 epoch each), merged as a 2-seed WiSE-FT model soup at `0.60×` delta scale with base `OneJev1.6-0.8B`, plus `noul` temperature `T=2.5` in `calibration.json`.
206
+ - **Compute:** ~7.1 GPU-hours total on NVIDIA RTX PRO 6000 (~$20 for the two final training runs).
207
+
208
+ ## Limitations
209
+
210
+ - **Single-page scope:** evaluates one page image (plus optional transcription) at a time; it does not compare across pages or generate transcriptions/bounding boxes.
211
+ - **Partial omissions on dense or non-Latin pages:** detects missing text layers (`0.998`) and large dropped blocks reliably, but subtle 5–15% partial omissions remain harder (`0.658` on modern PDF partial text layers, `0.823` overall on 19th-century books).
212
+ - **Handwriting & script balance:** historical manuscript training data is weighted toward 19th-century Latin-script archival letters and Ukrainian Cyrillic; `hand` top-1 accuracy on held-out archives is `0.642`, and Greek/Hebrew/Devanagari coverage is thin.
213
+ - **Calibration for downstream linear heads:** `calibration.json` sets `noul` temperature `T=2.5` so probabilities remain well-spread rather than saturating near 0/1; if you load the weights outside `flide`, apply `T=2.5` to `noul` slot logits when using probabilities as continuous features.
214
+
215
+ ## Credits & licence
216
+
217
+ Weights are released under the **Apache-2.0** licence, building on [OmniJev/OneJev1.6-0.8B](https://huggingface.co/OmniJev/OneJev1.6-0.8B) and [Qwen3.5](https://huggingface.co/Qwen) and trained on permissive datasets from Ai2 (`olmOCR-mix-1025`), Docling (`DocLayNet-v1.2`), and open archival collections. Fine-tuned and evaluated by [Daniel van Strien](https://huggingface.co/davanstrien).
calibration.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "temperatures": {
3
+ "noul": 2.5,
4
+ "choice": 1.0
5
+ },
6
+ "source": "gate2_soup_temp_cal_T2.5"
7
+ }
chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is true %}
150
+ {{- '<think>\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n\n</think>\n\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_token_id": 248056,
7
+ "model_type": "qwen3_5",
8
+ "text_config": {
9
+ "attention_bias": false,
10
+ "attention_dropout": 0.0,
11
+ "attn_output_gate": true,
12
+ "bos_token_id": null,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 248044,
15
+ "full_attention_interval": 4,
16
+ "head_dim": 256,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 1024,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 3584,
21
+ "layer_types": [
22
+ "linear_attention",
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "full_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "linear_attention",
29
+ "full_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "linear_attention",
33
+ "full_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "linear_attention",
37
+ "full_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "linear_attention",
41
+ "full_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "linear_attention",
45
+ "full_attention"
46
+ ],
47
+ "linear_conv_kernel_dim": 4,
48
+ "linear_key_head_dim": 128,
49
+ "linear_num_key_heads": 16,
50
+ "linear_num_value_heads": 16,
51
+ "linear_value_head_dim": 128,
52
+ "mamba_ssm_dtype": "float32",
53
+ "max_position_embeddings": 262144,
54
+ "mlp_only_layers": [],
55
+ "model_type": "qwen3_5_text",
56
+ "mtp_num_hidden_layers": 1,
57
+ "mtp_use_dedicated_embeddings": false,
58
+ "num_attention_heads": 8,
59
+ "num_hidden_layers": 24,
60
+ "num_key_value_heads": 2,
61
+ "pad_token_id": null,
62
+ "rms_norm_eps": 1e-06,
63
+ "rope_parameters": {
64
+ "mrope_interleaved": true,
65
+ "mrope_section": [
66
+ 11,
67
+ 11,
68
+ 10
69
+ ],
70
+ "partial_rotary_factor": 0.25,
71
+ "rope_theta": 10000000,
72
+ "rope_type": "default"
73
+ },
74
+ "tie_word_embeddings": true,
75
+ "use_cache": true,
76
+ "vocab_size": 248320
77
+ },
78
+ "tie_word_embeddings": true,
79
+ "transformers_version": "5.24.1",
80
+ "video_token_id": 248057,
81
+ "vision_config": {
82
+ "deepstack_visual_indexes": [],
83
+ "depth": 12,
84
+ "dtype": "bfloat16",
85
+ "hidden_act": "gelu_pytorch_tanh",
86
+ "hidden_size": 768,
87
+ "in_channels": 3,
88
+ "initializer_range": 0.02,
89
+ "intermediate_size": 3072,
90
+ "model_type": "qwen3_5_vision",
91
+ "num_heads": 12,
92
+ "num_position_embeddings": 2304,
93
+ "out_hidden_size": 1024,
94
+ "patch_size": 16,
95
+ "rope_parameters": {
96
+ "rope_theta": 10000.0,
97
+ "rope_type": "axial"
98
+ },
99
+ "spatial_merge_size": 2,
100
+ "temporal_patch_size": 2
101
+ },
102
+ "vision_end_token_id": 248054,
103
+ "vision_start_token_id": 248053
104
+ }
decision_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"format_id": "onejev-slot-v2", "package": "flide"}
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": 248044,
4
+ "transformers_version": "5.17.0",
5
+ "use_cache": true
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f6029a74dd12dcd987c48ea7c7e1f541aeb003e394cda6b0f96699807b5bd3f
3
+ size 1706030528
processor_config.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.5,
9
+ 0.5,
10
+ 0.5
11
+ ],
12
+ "image_processor_type": "Qwen2VLImageProcessor",
13
+ "image_std": [
14
+ 0.5,
15
+ 0.5,
16
+ 0.5
17
+ ],
18
+ "merge_size": 2,
19
+ "patch_size": 16,
20
+ "resample": 3,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "size": {
23
+ "longest_edge": 16777216,
24
+ "shortest_edge": 65536
25
+ },
26
+ "temporal_patch_size": 2
27
+ },
28
+ "processor_class": "Qwen3VLProcessor",
29
+ "video_processor": {
30
+ "do_convert_rgb": true,
31
+ "do_normalize": true,
32
+ "do_rescale": true,
33
+ "do_resize": true,
34
+ "do_sample_frames": true,
35
+ "fps": 2,
36
+ "image_mean": [
37
+ 0.5,
38
+ 0.5,
39
+ 0.5
40
+ ],
41
+ "image_std": [
42
+ 0.5,
43
+ 0.5,
44
+ 0.5
45
+ ],
46
+ "max_frames": 768,
47
+ "max_video_tokens": 768,
48
+ "merge_size": 2,
49
+ "min_frames": 4,
50
+ "patch_size": 16,
51
+ "resample": 3,
52
+ "rescale_factor": 0.00392156862745098,
53
+ "return_metadata": false,
54
+ "size": {
55
+ "longest_edge": 25165824,
56
+ "shortest_edge": 4096
57
+ },
58
+ "temporal_patch_size": 2,
59
+ "video_processor_type": "Qwen3VLVideoProcessor"
60
+ }
61
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a41e6e9d92018a0d3b5dcdfc626e6563d993cef9c506928add7929b54a47e73
3
+ size 19989507
tokenizer_config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": false,
13
+ "local_files_only": false,
14
+ "max_length": null,
15
+ "merges_file": null,
16
+ "model_max_length": 262144,
17
+ "model_specific_special_tokens": {
18
+ "audio_bos_token": "<|audio_start|>",
19
+ "audio_eos_token": "<|audio_end|>",
20
+ "audio_token": "<|audio_pad|>",
21
+ "image_token": "<|image_pad|>",
22
+ "video_token": "<|video_pad|>",
23
+ "vision_bos_token": "<|vision_start|>",
24
+ "vision_eos_token": "<|vision_end|>"
25
+ },
26
+ "pad_to_multiple_of": null,
27
+ "pad_token": "<|endoftext|>",
28
+ "pad_token_type_id": 0,
29
+ "padding_side": "right",
30
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
31
+ "processor_class": "Qwen3VLProcessor",
32
+ "split_special_tokens": false,
33
+ "tokenizer_class": "Qwen3_5Tokenizer",
34
+ "unk_token": null,
35
+ "video_token": "<|video_pad|>",
36
+ "vision_bos_token": "<|vision_start|>",
37
+ "vision_eos_token": "<|vision_end|>"
38
+ }