lionel-mp commited on
Commit
c76e32f
·
verified ·
1 Parent(s): f24835c

Upload karpo-decision-31B

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
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ base_model: google/gemma-4-31B-it
5
+ base_model_relation: finetune
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - decision-model
9
+ - decision-index
10
+ - gemma4
11
+ model-index:
12
+ - name: karpo-decision-31B
13
+ results:
14
+ - task:
15
+ type: text-classification
16
+ name: typed decision (choice / noul / score)
17
+ dataset:
18
+ type: mixed
19
+ name: Decision Index 0.3 public suite (140,178 requests; the index averages 37 benchmarks)
20
+ metrics:
21
+ - type: decision_index
22
+ value: 75.07
23
+ name: Decision Index 0.3, public index (chance-corrected, self-reported)
24
+ ---
25
+
26
+ # karpo-decision-31B
27
+
28
+ karpo-decision-31B is a decision model. Given a state (a web page, a document, a conversation: any text or JSON) and
29
+ one or more typed questions about it, it returns a probability for every option of every question, read out of a
30
+ single forward pass instead of generated text. It is fine-tuned from
31
+ [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it) and adds a linear readout over the options.
32
+
33
+ - **Base model:** [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it)
34
+ - **Parameters:** 31.3B in bf16, plus a 255 × 5,376 readout in fp32
35
+ - **Questions:** `choice` (pick one of up to 255 options), `noul` (true or false) and `score` (a level on a scale)
36
+ - **Context:** 32,768 tokens per sequence; a longer request is split into parts of its questions, each with the full
37
+ state
38
+ - **Licence:** Apache-2.0
39
+
40
+ ## Lineage
41
+
42
+ [google/gemma-4-31B](https://huggingface.co/google/gemma-4-31B) → [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it)
43
+ → **karpo-decision-31B** (fine-tuned)
44
+
45
+ ## Use
46
+
47
+ The inference code is [github.com/machinepulse-ai/karpo-decision](https://github.com/machinepulse-ai/karpo-decision)
48
+ (Apache-2.0, Python 3.12+). It runs on one GPU: the weights take 62.5 GB, and long requests need more on top.
49
+
50
+ ```bash
51
+ pip install "karpo-decision @ git+https://github.com/machinepulse-ai/karpo-decision"
52
+ ```
53
+
54
+ ```python
55
+ from huggingface_hub import snapshot_download
56
+ from karpo_decision.decider import Decider
57
+
58
+ path = snapshot_download("MachinePulseAI/karpo-decision-31B")
59
+ decider = Decider.from_pretrained(path, device="cuda")
60
+ response = decider.decide({
61
+ "state": "Order 1182: the customer asks to return a blender bought 45 days ago. Policy: returns within 30 days.",
62
+ "questions": {
63
+ "eligible": {"type": "noul", "instructions": "Is the return eligible under the policy?"},
64
+ "action": {"type": "choice", "instructions": "What should the agent do?",
65
+ "criteria": {"refund": "Issue a full refund", "decline": "Politely decline the return",
66
+ "escalate": "Escalate to a supervisor"}},
67
+ },
68
+ })
69
+ print(response["answers"])
70
+ # {"eligible": {"type": "noul", "noul": P(true)},
71
+ # "action": {"type": "choice", "choice": <key>, "probabilities": {<key>: p, ...}, "confidence": c}}
72
+ ```
73
+
74
+ As an HTTP server (`POST /v1/systemone`, `GET /healthz`):
75
+
76
+ ```bash
77
+ torchrun --standalone --nproc_per_node 1 -m karpo_decision.serve.server --checkpoint "$path" --port 18440
78
+ ```
79
+
80
+ On the [Decision Index](https://github.com/apolinario/decision-index) kit (installed separately):
81
+
82
+ ```bash
83
+ python -m decision_index run --engine karpo_decision.serve.engine:DecisionIndexEngine \
84
+ --option checkpoint="$path" --out runs/karpo-decision-31B
85
+ ```
86
+
87
+ ## Results
88
+
89
+ Decision Index 0.3, public suite, run by us on the kit's suite and scored with the kit: 140,178 requests, 140,167
90
+ answered and 11 unsupported (a question that did not fit in 32,768 tokens with its state), default reading
91
+ (`view=joint`), torch 2.14.1, transformers 5.21.0.
92
+
93
+ | | score |
94
+ |---|---|
95
+ | **Public index** (chance-corrected) | **75.07** |
96
+ | Raw index | 80.91 |
97
+ | Breadth | 74.72 |
98
+ | Knowledge & Reasoning | 65.61 |
99
+ | Language Understanding | 76.85 |
100
+ | Retrieval & Classification | 76.35 |
101
+ | Tools & Automation | 88.32 |
102
+ | Arts & Human Taste | 68.10 |
103
+
104
+ The leaderboard ranks models by the Full score, which its maintainers compute on private tests; we will add it here
105
+ once it is published.
106
+
107
+ ## Limitations
108
+
109
+ - The released inference code reads text only. The vision weights are in the checkpoint but unused.
110
+ - It is not a chat or text-generation model: it was trained to answer through the readout, and generation was not
111
+ evaluated.
112
+ - Probabilities use temperature 1.0 (`decision_config.json`); they are not calibrated after training.
113
+ - A question that does not fit in 32,768 tokens together with the state is refused (`Unsupported`), never truncated.
114
+ - It always picks among the given options; it abstains only when an option says so.
115
+
116
+ ## Licence
117
+
118
+ The weights are released under the Apache License 2.0 ([`LICENSE`](LICENSE)), as is the inference code. They are a
119
+ modified version of [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it), which Google releases under
120
+ the [Apache License 2.0](https://ai.google.dev/gemma/docs/gemma_4_license): its decoder weights were fine-tuned and a
121
+ readout was added.
chat_template.jinja ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#
2
+ Template: Google Gemma 4 Canonical Chat Template
3
+ Author: Google Gemma Engineering Team
4
+ Published: 2026-07-09
5
+ Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.
6
+ #}
7
+ {%- macro format_parameters(properties, required, filter_keys=false) -%}
8
+ {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
9
+ {%- set ns = namespace(found_first=false) -%}
10
+ {%- for key, value in properties | dictsort -%}
11
+ {%- set add_comma = false -%}
12
+ {%- if not filter_keys or key not in standard_keys -%}
13
+ {%- if ns.found_first %},{% endif -%}
14
+ {%- set ns.found_first = true -%}
15
+ {{ key }}:{
16
+ {%- if value['description'] -%}
17
+ description:<|"|>{{ value['description'] }}<|"|>
18
+ {%- set add_comma = true -%}
19
+ {%- endif -%}
20
+ {%- if value['type'] | upper == 'STRING' -%}
21
+ {%- if value['enum'] -%}
22
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
23
+ enum:{{ format_argument(value['enum']) }}
24
+ {%- endif -%}
25
+ {%- elif value['type'] | upper == 'ARRAY' -%}
26
+ {%- if value['items'] is mapping and value['items'] -%}
27
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
28
+ items:{
29
+ {%- set ns_items = namespace(found_first=false) -%}
30
+ {%- for item_key, item_value in value['items'] | dictsort -%}
31
+ {%- if item_value is not none -%}
32
+ {%- if ns_items.found_first %},{% endif -%}
33
+ {%- set ns_items.found_first = true -%}
34
+ {%- if item_key == 'properties' -%}
35
+ properties:{
36
+ {%- if item_value is mapping -%}
37
+ {{- format_parameters(item_value, value['items']['required'] | default([])) -}}
38
+ {%- endif -%}
39
+ }
40
+ {%- elif item_key == 'required' -%}
41
+ required:[
42
+ {%- for req_item in item_value -%}
43
+ <|"|>{{- req_item -}}<|"|>
44
+ {%- if not loop.last %},{% endif -%}
45
+ {%- endfor -%}
46
+ ]
47
+ {%- elif item_key == 'type' -%}
48
+ {%- if item_value is string -%}
49
+ type:{{ format_argument(item_value | upper) }}
50
+ {%- else -%}
51
+ type:{{ format_argument(item_value | map('upper') | list) }}
52
+ {%- endif -%}
53
+ {%- else -%}
54
+ {{ item_key }}:{{ format_argument(item_value) }}
55
+ {%- endif -%}
56
+ {%- endif -%}
57
+ {%- endfor -%}
58
+ }
59
+ {%- endif -%}
60
+ {%- endif -%}
61
+ {%- if value['nullable'] %}
62
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
63
+ nullable:true
64
+ {%- endif -%}
65
+ {%- if value['type'] | upper == 'OBJECT' -%}
66
+ {%- if value['properties'] is defined and value['properties'] is mapping -%}
67
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
68
+ properties:{
69
+ {{- format_parameters(value['properties'], value['required'] | default([])) -}}
70
+ }
71
+ {%- elif value is mapping -%}
72
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
73
+ properties:{
74
+ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
75
+ }
76
+ {%- endif -%}
77
+ {%- if value['required'] -%}
78
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
79
+ required:[
80
+ {%- for item in value['required'] | default([]) -%}
81
+ <|"|>{{- item -}}<|"|>
82
+ {%- if not loop.last %},{% endif -%}
83
+ {%- endfor -%}
84
+ ]
85
+ {%- endif -%}
86
+ {%- endif -%}
87
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
88
+ type:<|"|>{{ value['type'] | upper }}<|"|>}
89
+ {%- endif -%}
90
+ {%- endfor -%}
91
+ {%- endmacro -%}
92
+ {%- macro format_function_declaration(tool_data) -%}
93
+ declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
94
+ {%- set params = tool_data['function']['parameters'] -%}
95
+ {%- if params -%}
96
+ ,parameters:{
97
+ {%- if params['properties'] -%}
98
+ properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
99
+ {%- endif -%}
100
+ {%- if params['required'] -%}
101
+ required:[
102
+ {%- for item in params['required'] -%}
103
+ <|"|>{{- item -}}<|"|>
104
+ {{- ',' if not loop.last -}}
105
+ {%- endfor -%}
106
+ ],
107
+ {%- endif -%}
108
+ {%- if params['type'] -%}
109
+ type:<|"|>{{- params['type'] | upper -}}<|"|>}
110
+ {%- endif -%}
111
+ {%- endif -%}
112
+ {%- if 'response' in tool_data['function'] -%}
113
+ {%- set response_declaration = tool_data['function']['response'] -%}
114
+ ,response:{
115
+ {%- if response_declaration['description'] -%}
116
+ description:<|"|>{{- response_declaration['description'] -}}<|"|>,
117
+ {%- endif -%}
118
+ {%- if response_declaration['type'] | upper == 'OBJECT' -%}
119
+ type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
120
+ {%- endif -%}
121
+ {%- endif -%}
122
+ }
123
+ {%- endmacro -%}
124
+ {%- macro format_argument(argument, escape_keys=True) -%}
125
+ {%- if argument is none -%}
126
+ {{- 'null' -}}
127
+ {%- elif argument is string -%}
128
+ {{- '<|"|>' + argument + '<|"|>' -}}
129
+ {%- elif argument is boolean -%}
130
+ {{- 'true' if argument else 'false' -}}
131
+ {%- elif argument is mapping -%}
132
+ {{- '{' -}}
133
+ {%- set ns = namespace(found_first=false) -%}
134
+ {%- for key, value in argument | dictsort -%}
135
+ {%- if ns.found_first %},{% endif -%}
136
+ {%- set ns.found_first = true -%}
137
+ {%- if escape_keys -%}
138
+ {{- '<|"|>' + key + '<|"|>' -}}
139
+ {%- else -%}
140
+ {{- key -}}
141
+ {%- endif -%}
142
+ :{{- format_argument(value, escape_keys=escape_keys) -}}
143
+ {%- endfor -%}
144
+ {{- '}' -}}
145
+ {%- elif argument is sequence -%}
146
+ {{- '[' -}}
147
+ {%- for item in argument -%}
148
+ {{- format_argument(item, escape_keys=escape_keys) -}}
149
+ {%- if not loop.last %},{% endif -%}
150
+ {%- endfor -%}
151
+ {{- ']' -}}
152
+ {%- else -%}
153
+ {{- argument -}}
154
+ {%- endif -%}
155
+ {%- endmacro -%}
156
+ {%- macro strip_thinking(text) -%}
157
+ {%- set ns = namespace(result='') -%}
158
+ {%- for part in text.split('<channel|>') -%}
159
+ {%- if '<|channel>' in part -%}
160
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
161
+ {%- else -%}
162
+ {%- set ns.result = ns.result + part -%}
163
+ {%- endif -%}
164
+ {%- endfor -%}
165
+ {{- ns.result | trim -}}
166
+ {%- endmacro -%}
167
+
168
+ {%- macro format_tool_response_block(tool_name, response) -%}
169
+ {{- '<|tool_response>' -}}
170
+ {%- if response is mapping -%}
171
+ {{- 'response:' + tool_name + '{' -}}
172
+ {%- for key, value in response | dictsort -%}
173
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
174
+ {%- if not loop.last %},{% endif -%}
175
+ {%- endfor -%}
176
+ {{- '}' -}}
177
+ {%- else -%}
178
+ {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
179
+ {%- endif -%}
180
+ {{- '<tool_response|>' -}}
181
+ {%- endmacro -%}
182
+
183
+ {#- ===== SETUP ===== -#}
184
+ {%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
185
+ {%- set loop_messages = messages -%}
186
+ {%- set enable_thinking = enable_thinking | default(false) -%}
187
+ {%- set preserve_thinking = preserve_thinking | default(false) -%}
188
+ {{- bos_token -}}
189
+ {#- Handle System/Tool Definitions Block -#}
190
+ {%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
191
+ {{- '<|turn>system\n' -}}
192
+ {#- Inject Thinking token at the very top of the FIRST system turn -#}
193
+ {%- if enable_thinking -%}
194
+ {{- '<|think|>\n' -}}
195
+ {%- set ns.prev_message_type = 'think' -%}
196
+ {%- endif -%}
197
+ {%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
198
+ {%- if messages[0]['content'] is string -%}
199
+ {{- messages[0]['content'] | trim -}}
200
+ {%- elif messages[0]['content'] is sequence -%}
201
+ {%- for item in messages[0]['content'] -%}
202
+ {{- item['text'] | trim + ' '-}}
203
+ {%- endfor -%}
204
+ {%- endif -%}
205
+ {%- set loop_messages = messages[1:] -%}
206
+ {%- endif -%}
207
+ {%- if tools -%}
208
+ {%- for tool in tools %}
209
+ {{- '<|tool>' -}}
210
+ {{- format_function_declaration(tool) | trim -}}
211
+ {{- '<tool|>' -}}
212
+ {%- endfor %}
213
+ {%- set ns.prev_message_type = 'tool' -%}
214
+ {%- endif -%}
215
+ {{- '<turn|>\n' -}}
216
+ {%- endif %}
217
+
218
+ {#- Pre-scan: find last user message index for reasoning guard -#}
219
+ {%- set ns_turn = namespace(last_user_idx=-1) -%}
220
+ {%- for i in range(loop_messages | length) -%}
221
+ {%- if loop_messages[i]['role'] == 'user' -%}
222
+ {%- set ns_turn.last_user_idx = i -%}
223
+ {%- endif -%}
224
+ {%- endfor -%}
225
+
226
+ {#- Loop through messages -#}
227
+ {%- for message in loop_messages -%}
228
+ {%- if message['role'] != 'tool' -%}
229
+ {%- set ns.prev_message_type = None -%}
230
+ {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
231
+ {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
232
+ {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
233
+ {%- if not continue_same_model_turn -%}
234
+ {{- '<|turn>' + role + '\n' }}
235
+
236
+ {%- endif -%}
237
+
238
+ {#- Render reasoning/reasoning_content as thinking channel -#}
239
+ {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
240
+ {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
241
+ {%- if thinking_text and thinking_gate -%}
242
+ {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
243
+ {%- endif -%}
244
+
245
+ {%- if message.get('tool_calls') -%}
246
+ {%- for tool_call in message.get('tool_calls') -%}
247
+ {%- set function = tool_call['function'] -%}
248
+ {{- '<|tool_call>call:' + function['name'] + '{' -}}
249
+ {%- if function['arguments'] is mapping -%}
250
+ {%- set ns_args = namespace(found_first=false) -%}
251
+ {%- for key, value in function['arguments'] | dictsort -%}
252
+ {%- if ns_args.found_first %},{% endif -%}
253
+ {%- set ns_args.found_first = true -%}
254
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
255
+ {%- endfor -%}
256
+ {%- elif function['arguments'] is none -%}
257
+ {%- else -%}
258
+ {{- raise_exception(
259
+ "chat_template: tool_calls[].function.arguments must be a "
260
+ "JSON object (mapping), not a string. Deserialize arguments "
261
+ "before passing to the template."
262
+ ) -}}
263
+ {%- endif -%}
264
+ {{- '}<tool_call|>' -}}
265
+ {%- endfor -%}
266
+ {%- set ns.prev_message_type = 'tool_call' -%}
267
+ {%- endif -%}
268
+
269
+ {%- set ns_tr_out = namespace(flag=false) -%}
270
+ {%- if message.get('tool_responses') -%}
271
+ {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
272
+ {%- for tool_response in message.get('tool_responses') -%}
273
+ {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
274
+ {%- set ns_tr_out.flag = true -%}
275
+ {%- set ns.prev_message_type = 'tool_response' -%}
276
+ {%- endfor -%}
277
+ {%- elif message.get('tool_calls') -%}
278
+ {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
279
+ {%- set ns_tool_scan = namespace(stopped=false) -%}
280
+ {%- for k in range(loop.index0 + 1, loop_messages | length) -%}
281
+ {%- if ns_tool_scan.stopped -%}
282
+ {%- elif loop_messages[k]['role'] != 'tool' -%}
283
+ {%- set ns_tool_scan.stopped = true -%}
284
+ {%- else -%}
285
+ {%- set follow = loop_messages[k] -%}
286
+ {#- Resolve tool_call_id to function name -#}
287
+ {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
288
+ {%- for tc in message.get('tool_calls') -%}
289
+ {%- if tc.get('id') == follow.get('tool_call_id') -%}
290
+ {%- set ns_tname.name = tc['function']['name'] -%}
291
+ {%- endif -%}
292
+ {%- endfor -%}
293
+ {#- Handle content as string or content-parts array -#}
294
+ {%- set tool_body = follow.get('content') -%}
295
+ {%- if tool_body is string -%}
296
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
297
+ {%- elif tool_body is sequence and tool_body is not string -%}
298
+ {%- set ns_txt = namespace(s='') -%}
299
+ {%- for part in tool_body -%}
300
+ {%- if part.get('type') == 'text' -%}
301
+ {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
302
+ {%- endif -%}
303
+ {%- endfor -%}
304
+ {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
305
+ {%- for part in tool_body -%}
306
+ {%- if part.get('type') in ['image', 'image_url'] -%}
307
+ {{- '<|image|>' -}}
308
+ {%- elif part.get('type') in ['audio', 'input_audio'] -%}
309
+ {{- '<|audio|>' -}}
310
+ {%- elif part.get('type') == 'video' -%}
311
+ {{- '<|video|>' -}}
312
+ {%- endif -%}
313
+ {%- endfor -%}
314
+ {%- else -%}
315
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
316
+ {%- endif -%}
317
+ {%- set ns_tr_out.flag = true -%}
318
+ {%- set ns.prev_message_type = 'tool_response' -%}
319
+ {%- endif -%}
320
+ {%- endfor -%}
321
+ {%- endif -%}
322
+
323
+ {%- set captured_content -%}
324
+ {%- if message.get('content') is string -%}
325
+ {%- if role == 'model' -%}
326
+ {{- strip_thinking(message['content']) -}}
327
+ {%- else -%}
328
+ {{- message['content'] | trim -}}
329
+ {%- endif -%}
330
+ {%- elif message.get('content') is sequence -%}
331
+ {%- for item in message['content'] -%}
332
+ {%- if item.get('type') == 'text' -%}
333
+ {%- if role == 'model' -%}
334
+ {{- strip_thinking(item['text']) -}}
335
+ {%- else -%}
336
+ {{- item['text'] | trim -}}
337
+ {%- endif -%}
338
+ {%- elif item.get('type') in ['image', 'image_url'] -%}
339
+ {{- '<|image|>' -}}
340
+ {%- elif item.get('type') in ['audio', 'input_audio'] -%}
341
+ {{- '<|audio|>' -}}
342
+ {%- elif item.get('type') == 'video' -%}
343
+ {{- '<|video|>' -}}
344
+ {%- endif -%}
345
+ {%- endfor -%}
346
+ {%- endif -%}
347
+ {%- endset -%}
348
+
349
+ {{- captured_content -}}
350
+ {%- set has_content = captured_content | trim | length > 0 -%}
351
+
352
+ {#- Forward-scan: find next non-tool message role for continuation detection -#}
353
+ {%- set next_nt = namespace(role=None, found=false) -%}
354
+ {%- for j in range(loop.index0 + 1, loop_messages | length) -%}
355
+ {%- if not next_nt.found -%}
356
+ {%- if loop_messages[j]['role'] != 'tool' -%}
357
+ {%- set next_nt.role = loop_messages[j]['role'] -%}
358
+ {%- set next_nt.found = true -%}
359
+ {%- endif -%}
360
+ {%- endif -%}
361
+ {%- endfor -%}
362
+
363
+ {%- set continues_into_next = (
364
+ role == 'model'
365
+ and next_nt.role == 'assistant'
366
+ and (not message.get('tool_calls') or ns_tr_out.flag)
367
+ ) -%}
368
+
369
+ {%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
370
+ {{- '<|tool_response>' -}}
371
+ {%- elif continues_into_next -%}
372
+ {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
373
+ {{- '<turn|>\n' -}}
374
+ {%- endif -%}
375
+
376
+ {#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
377
+ {%- set ns.prev_non_tool_role = message['role'] -%}
378
+ {%- endif -%}
379
+ {%- endfor -%}
380
+
381
+ {%- if add_generation_prompt -%}
382
+ {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
383
+ {{- '<|turn>model\n' -}}
384
+ {%- if not enable_thinking -%}
385
+ {{- '<|channel>thought\n<channel|>' -}}
386
+ {%- endif -%}
387
+ {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
388
+ {{- '<|channel>thought\n' -}}
389
+ {%- endif -%}
390
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma4ForConditionalGeneration"
4
+ ],
5
+ "audio_config": null,
6
+ "audio_token_id": 258881,
7
+ "boa_token_id": 256000,
8
+ "boi_token_id": 255999,
9
+ "dtype": "bfloat16",
10
+ "eoa_token_id": 258883,
11
+ "eoa_token_index": 258883,
12
+ "eoi_token_id": 258882,
13
+ "eos_token_id": [
14
+ 1,
15
+ 106
16
+ ],
17
+ "image_token_id": 258880,
18
+ "initializer_range": 0.02,
19
+ "model_type": "gemma4",
20
+ "text_config": {
21
+ "attention_bias": false,
22
+ "attention_dropout": 0.0,
23
+ "attention_k_eq_v": true,
24
+ "bos_token_id": 2,
25
+ "dtype": "bfloat16",
26
+ "enable_moe_block": false,
27
+ "eos_token_id": 1,
28
+ "expert_intermediate_size": null,
29
+ "final_logit_softcapping": 30.0,
30
+ "head_dim": 256,
31
+ "hidden_activation": "gelu_pytorch_tanh",
32
+ "hidden_size": 5376,
33
+ "hidden_size_per_layer_input": 0,
34
+ "initializer_range": 0.02,
35
+ "intermediate_size": 21504,
36
+ "layer_types": [
37
+ "sliding_attention",
38
+ "sliding_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "full_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "sliding_attention",
46
+ "sliding_attention",
47
+ "sliding_attention",
48
+ "full_attention",
49
+ "sliding_attention",
50
+ "sliding_attention",
51
+ "sliding_attention",
52
+ "sliding_attention",
53
+ "sliding_attention",
54
+ "full_attention",
55
+ "sliding_attention",
56
+ "sliding_attention",
57
+ "sliding_attention",
58
+ "sliding_attention",
59
+ "sliding_attention",
60
+ "full_attention",
61
+ "sliding_attention",
62
+ "sliding_attention",
63
+ "sliding_attention",
64
+ "sliding_attention",
65
+ "sliding_attention",
66
+ "full_attention",
67
+ "sliding_attention",
68
+ "sliding_attention",
69
+ "sliding_attention",
70
+ "sliding_attention",
71
+ "sliding_attention",
72
+ "full_attention",
73
+ "sliding_attention",
74
+ "sliding_attention",
75
+ "sliding_attention",
76
+ "sliding_attention",
77
+ "sliding_attention",
78
+ "full_attention",
79
+ "sliding_attention",
80
+ "sliding_attention",
81
+ "sliding_attention",
82
+ "sliding_attention",
83
+ "sliding_attention",
84
+ "full_attention",
85
+ "sliding_attention",
86
+ "sliding_attention",
87
+ "sliding_attention",
88
+ "sliding_attention",
89
+ "sliding_attention",
90
+ "full_attention",
91
+ "sliding_attention",
92
+ "sliding_attention",
93
+ "sliding_attention",
94
+ "sliding_attention",
95
+ "sliding_attention",
96
+ "full_attention"
97
+ ],
98
+ "max_position_embeddings": 262144,
99
+ "model_type": "gemma4_text",
100
+ "moe_intermediate_size": null,
101
+ "num_attention_heads": 32,
102
+ "num_experts": null,
103
+ "num_hidden_layers": 60,
104
+ "num_key_value_heads": 16,
105
+ "num_kv_shared_layers": 0,
106
+ "pad_token_id": 0,
107
+ "per_layer_config": {
108
+ "05": {
109
+ "head_dim": 512,
110
+ "num_key_value_heads": 4
111
+ },
112
+ "11": {
113
+ "head_dim": 512,
114
+ "num_key_value_heads": 4
115
+ },
116
+ "17": {
117
+ "head_dim": 512,
118
+ "num_key_value_heads": 4
119
+ },
120
+ "23": {
121
+ "head_dim": 512,
122
+ "num_key_value_heads": 4
123
+ },
124
+ "29": {
125
+ "head_dim": 512,
126
+ "num_key_value_heads": 4
127
+ },
128
+ "35": {
129
+ "head_dim": 512,
130
+ "num_key_value_heads": 4
131
+ },
132
+ "41": {
133
+ "head_dim": 512,
134
+ "num_key_value_heads": 4
135
+ },
136
+ "47": {
137
+ "head_dim": 512,
138
+ "num_key_value_heads": 4
139
+ },
140
+ "53": {
141
+ "head_dim": 512,
142
+ "num_key_value_heads": 4
143
+ },
144
+ "59": {
145
+ "head_dim": 512,
146
+ "num_key_value_heads": 4
147
+ }
148
+ },
149
+ "rms_norm_eps": 1e-06,
150
+ "rope_parameters": {
151
+ "full_attention": {
152
+ "partial_rotary_factor": 0.25,
153
+ "rope_theta": 1000000.0,
154
+ "rope_type": "proportional"
155
+ },
156
+ "sliding_attention": {
157
+ "rope_theta": 10000.0,
158
+ "rope_type": "default"
159
+ }
160
+ },
161
+ "sliding_window": 1024,
162
+ "tie_word_embeddings": true,
163
+ "top_k_experts": null,
164
+ "use_bidirectional_attention": "vision",
165
+ "use_cache": true,
166
+ "use_double_wide_mlp": false,
167
+ "vocab_size": 262144,
168
+ "vocab_size_per_layer_input": 262144
169
+ },
170
+ "tie_word_embeddings": true,
171
+ "transformers_version": "5.21.0",
172
+ "video_token_id": 258884,
173
+ "vision_config": {
174
+ "attention_bias": false,
175
+ "attention_dropout": 0.0,
176
+ "default_output_length": 280,
177
+ "dtype": "bfloat16",
178
+ "global_head_dim": 72,
179
+ "head_dim": 72,
180
+ "hidden_activation": "gelu_pytorch_tanh",
181
+ "hidden_size": 1152,
182
+ "initializer_range": 0.02,
183
+ "intermediate_size": 4304,
184
+ "max_position_embeddings": 131072,
185
+ "model_type": "gemma4_vision",
186
+ "num_attention_heads": 16,
187
+ "num_hidden_layers": 27,
188
+ "num_key_value_heads": 16,
189
+ "patch_size": 16,
190
+ "pooling_kernel_size": 3,
191
+ "position_embedding_size": 10240,
192
+ "rms_norm_eps": 1e-06,
193
+ "rope_parameters": {
194
+ "rope_theta": 100.0,
195
+ "rope_type": "axial"
196
+ },
197
+ "standardize": true,
198
+ "use_clipped_linears": false
199
+ },
200
+ "vision_soft_tokens_per_image": 280
201
+ }
decision_config.json ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "template": "karpo-blocks-v1",
3
+ "codes": [
4
+ "A",
5
+ "B",
6
+ "C",
7
+ "D",
8
+ "E",
9
+ "F",
10
+ "G",
11
+ "H",
12
+ "I",
13
+ "J",
14
+ "K",
15
+ "L",
16
+ "M",
17
+ "N",
18
+ "O",
19
+ "P",
20
+ "Q",
21
+ "R",
22
+ "S",
23
+ "T",
24
+ "U",
25
+ "V",
26
+ "W",
27
+ "X",
28
+ "Y",
29
+ "Z",
30
+ "AA",
31
+ "AB",
32
+ "AC",
33
+ "AD",
34
+ "AE",
35
+ "AF",
36
+ "AG",
37
+ "AH",
38
+ "AI",
39
+ "AJ",
40
+ "AK",
41
+ "AL",
42
+ "AM",
43
+ "AN",
44
+ "AO",
45
+ "AP",
46
+ "AQ",
47
+ "AR",
48
+ "AS",
49
+ "AT",
50
+ "AU",
51
+ "AV",
52
+ "AW",
53
+ "AX",
54
+ "AY",
55
+ "AZ",
56
+ "BA",
57
+ "BB",
58
+ "BC",
59
+ "BD",
60
+ "BE",
61
+ "BF",
62
+ "BG",
63
+ "BH",
64
+ "BI",
65
+ "BJ",
66
+ "BK",
67
+ "BL",
68
+ "BM",
69
+ "BN",
70
+ "BO",
71
+ "BP",
72
+ "BQ",
73
+ "BR",
74
+ "BS",
75
+ "BT",
76
+ "BU",
77
+ "BV",
78
+ "BW",
79
+ "BX",
80
+ "BY",
81
+ "BZ",
82
+ "CA",
83
+ "CB",
84
+ "CC",
85
+ "CD",
86
+ "CE",
87
+ "CF",
88
+ "CG",
89
+ "CH",
90
+ "CI",
91
+ "CJ",
92
+ "CK",
93
+ "CL",
94
+ "CM",
95
+ "CN",
96
+ "CO",
97
+ "CP",
98
+ "CQ",
99
+ "CR",
100
+ "CS",
101
+ "CT",
102
+ "CU",
103
+ "CV",
104
+ "CW",
105
+ "CX",
106
+ "CY",
107
+ "CZ",
108
+ "DA",
109
+ "DB",
110
+ "DC",
111
+ "DD",
112
+ "DE",
113
+ "DF",
114
+ "DG",
115
+ "DH",
116
+ "DI",
117
+ "DJ",
118
+ "DK",
119
+ "DL",
120
+ "DM",
121
+ "DN",
122
+ "DO",
123
+ "DP",
124
+ "DQ",
125
+ "DR",
126
+ "DS",
127
+ "DT",
128
+ "DU",
129
+ "DV",
130
+ "DW",
131
+ "DX",
132
+ "DY",
133
+ "DZ",
134
+ "EA",
135
+ "EB",
136
+ "EC",
137
+ "ED",
138
+ "EE",
139
+ "EF",
140
+ "EG",
141
+ "EH",
142
+ "EI",
143
+ "EJ",
144
+ "EK",
145
+ "EL",
146
+ "EM",
147
+ "EN",
148
+ "EO",
149
+ "EP",
150
+ "EQ",
151
+ "ER",
152
+ "ES",
153
+ "ET",
154
+ "EU",
155
+ "EV",
156
+ "EW",
157
+ "EX",
158
+ "EY",
159
+ "EZ",
160
+ "FA",
161
+ "FB",
162
+ "FC",
163
+ "FD",
164
+ "FE",
165
+ "FF",
166
+ "FG",
167
+ "FH",
168
+ "FI",
169
+ "FJ",
170
+ "FK",
171
+ "FL",
172
+ "FM",
173
+ "FN",
174
+ "FO",
175
+ "FP",
176
+ "FQ",
177
+ "FR",
178
+ "FS",
179
+ "FT",
180
+ "FU",
181
+ "FV",
182
+ "FW",
183
+ "FX",
184
+ "FY",
185
+ "FZ",
186
+ "GA",
187
+ "GB",
188
+ "GC",
189
+ "GD",
190
+ "GE",
191
+ "GF",
192
+ "GG",
193
+ "GH",
194
+ "GI",
195
+ "GJ",
196
+ "GK",
197
+ "GL",
198
+ "GM",
199
+ "GN",
200
+ "GO",
201
+ "GP",
202
+ "GQ",
203
+ "GR",
204
+ "GS",
205
+ "GT",
206
+ "GU",
207
+ "GV",
208
+ "GW",
209
+ "GX",
210
+ "GY",
211
+ "HA",
212
+ "HB",
213
+ "HC",
214
+ "HD",
215
+ "HE",
216
+ "HF",
217
+ "HG",
218
+ "HH",
219
+ "HI",
220
+ "HJ",
221
+ "HK",
222
+ "HL",
223
+ "HM",
224
+ "HN",
225
+ "HO",
226
+ "HP",
227
+ "HQ",
228
+ "HR",
229
+ "HS",
230
+ "HT",
231
+ "HU",
232
+ "HV",
233
+ "HW",
234
+ "HX",
235
+ "HY",
236
+ "HZ",
237
+ "IA",
238
+ "IB",
239
+ "IC",
240
+ "ID",
241
+ "IE",
242
+ "IF",
243
+ "IG",
244
+ "IH",
245
+ "II",
246
+ "IJ",
247
+ "IK",
248
+ "IL",
249
+ "IM",
250
+ "IN",
251
+ "IO",
252
+ "IP",
253
+ "IQ",
254
+ "IR",
255
+ "IS",
256
+ "IT",
257
+ "IU",
258
+ "IV"
259
+ ],
260
+ "token_ids": [
261
+ 236776,
262
+ 236799,
263
+ 236780,
264
+ 236796,
265
+ 236788,
266
+ 236811,
267
+ 236823,
268
+ 236814,
269
+ 236777,
270
+ 236863,
271
+ 236855,
272
+ 236798,
273
+ 236792,
274
+ 236797,
275
+ 236806,
276
+ 236791,
277
+ 236935,
278
+ 236794,
279
+ 236773,
280
+ 236774,
281
+ 236836,
282
+ 236847,
283
+ 236824,
284
+ 236917,
285
+ 236874,
286
+ 236953,
287
+ 8686,
288
+ 3066,
289
+ 2714,
290
+ 2466,
291
+ 14196,
292
+ 11558,
293
+ 2807,
294
+ 20211,
295
+ 12553,
296
+ 57902,
297
+ 9978,
298
+ 1565,
299
+ 1936,
300
+ 1536,
301
+ 70713,
302
+ 2663,
303
+ 80055,
304
+ 1425,
305
+ 2371,
306
+ 1375,
307
+ 22258,
308
+ 7008,
309
+ 35066,
310
+ 26428,
311
+ 5790,
312
+ 25862,
313
+ 6552,
314
+ 20804,
315
+ 5901,
316
+ 11217,
317
+ 12051,
318
+ 28671,
319
+ 54684,
320
+ 48367,
321
+ 11526,
322
+ 127017,
323
+ 74610,
324
+ 8017,
325
+ 16070,
326
+ 10589,
327
+ 8791,
328
+ 17991,
329
+ 159610,
330
+ 12357,
331
+ 5580,
332
+ 24219,
333
+ 8462,
334
+ 82085,
335
+ 75007,
336
+ 121922,
337
+ 19470,
338
+ 153766,
339
+ 5635,
340
+ 26204,
341
+ 3129,
342
+ 6329,
343
+ 4660,
344
+ 13880,
345
+ 17956,
346
+ 2293,
347
+ 9575,
348
+ 81265,
349
+ 20045,
350
+ 5094,
351
+ 10087,
352
+ 9353,
353
+ 2457,
354
+ 7618,
355
+ 85549,
356
+ 6459,
357
+ 6786,
358
+ 1692,
359
+ 33186,
360
+ 20741,
361
+ 63746,
362
+ 82279,
363
+ 40736,
364
+ 129399,
365
+ 7172,
366
+ 6270,
367
+ 12622,
368
+ 21738,
369
+ 4070,
370
+ 7332,
371
+ 65899,
372
+ 54634,
373
+ 9982,
374
+ 43793,
375
+ 12536,
376
+ 30455,
377
+ 23390,
378
+ 48774,
379
+ 10009,
380
+ 10904,
381
+ 137414,
382
+ 7560,
383
+ 8925,
384
+ 18540,
385
+ 11965,
386
+ 80850,
387
+ 42771,
388
+ 39399,
389
+ 87207,
390
+ 164367,
391
+ 37553,
392
+ 56343,
393
+ 5856,
394
+ 2413,
395
+ 10421,
396
+ 28135,
397
+ 63426,
398
+ 101722,
399
+ 73344,
400
+ 102109,
401
+ 46570,
402
+ 3387,
403
+ 3158,
404
+ 1439,
405
+ 6864,
406
+ 13237,
407
+ 38254,
408
+ 1089,
409
+ 1740,
410
+ 2406,
411
+ 30722,
412
+ 22486,
413
+ 108534,
414
+ 2201,
415
+ 6594,
416
+ 79526,
417
+ 4815,
418
+ 38131,
419
+ 11962,
420
+ 35023,
421
+ 17179,
422
+ 5495,
423
+ 40807,
424
+ 75536,
425
+ 8537,
426
+ 191318,
427
+ 49512,
428
+ 7750,
429
+ 37413,
430
+ 32479,
431
+ 12041,
432
+ 22591,
433
+ 123622,
434
+ 11869,
435
+ 16164,
436
+ 7627,
437
+ 44519,
438
+ 61688,
439
+ 27330,
440
+ 36991,
441
+ 57954,
442
+ 175992,
443
+ 10032,
444
+ 8242,
445
+ 11925,
446
+ 29138,
447
+ 8809,
448
+ 15015,
449
+ 30389,
450
+ 32701,
451
+ 17508,
452
+ 118670,
453
+ 105774,
454
+ 9179,
455
+ 24464,
456
+ 36875,
457
+ 10677,
458
+ 23172,
459
+ 202788,
460
+ 11124,
461
+ 15683,
462
+ 22618,
463
+ 26943,
464
+ 60572,
465
+ 59141,
466
+ 161184,
467
+ 34144,
468
+ 14983,
469
+ 61026,
470
+ 24084,
471
+ 14563,
472
+ 2808,
473
+ 37030,
474
+ 98100,
475
+ 40325,
476
+ 26722,
477
+ 139168,
478
+ 31581,
479
+ 17287,
480
+ 42025,
481
+ 74035,
482
+ 10858,
483
+ 18835,
484
+ 98264,
485
+ 17372,
486
+ 11767,
487
+ 4080,
488
+ 80858,
489
+ 80657,
490
+ 47281,
491
+ 186240,
492
+ 32207,
493
+ 158347,
494
+ 5299,
495
+ 7692,
496
+ 2011,
497
+ 1735,
498
+ 7742,
499
+ 6354,
500
+ 2996,
501
+ 83145,
502
+ 4490,
503
+ 107007,
504
+ 19994,
505
+ 3334,
506
+ 2783,
507
+ 1204,
508
+ 6462,
509
+ 4012,
510
+ 79463,
511
+ 3359,
512
+ 2249,
513
+ 1768,
514
+ 87317,
515
+ 3767
516
+ ],
517
+ "attention": "bidirectional",
518
+ "base_model": "google/gemma-4-31B-it",
519
+ "marker": "<mask>",
520
+ "temperatures": {
521
+ "choice": 1.0,
522
+ "noul": 1.0,
523
+ "score": 1.0
524
+ },
525
+ "max_pixels": 1638400,
526
+ "readout_dtype": "float32",
527
+ "backbone": null,
528
+ "format_version": 1
529
+ }
model-00001-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8f79b35baf066e637de91b4431c00580964edfc14895f3d0f954f853f585e0c
3
+ size 5179883988
model-00002-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:445ad9238f356a33d95805987dc1d4423d6edd28f98834c8c067144f3f1dded3
3
+ size 5362123354
model-00003-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17fc66f2ad82e3d64c6bfb15eced517b3dce0674f69d85d6425617bebbdae75a
3
+ size 5307118276
model-00004-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc143af2dfd6f8bca2c90a4b00ab0343659ba5e52bd17ddca1ca8c8000736e6c
3
+ size 5218992802
model-00005-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9a0c59605458763d36227c2b039d9889d706ef9056ea8004c876b1da9f0b567
3
+ size 5252065676
model-00006-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6523793ec9a57c228fd65398effad0be20b9a3181cd5470b9ec59e5585b51613
3
+ size 5163944082
model-00007-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36008e3a93ec1c194252b9db0196a46f48c13cf1fae16422334751b1d312f2cd
3
+ size 5362123426
model-00008-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:196142ef340cf5f64944b790cdd1bd21d650eb8d82fdcd537c3e1b4659e876cc
3
+ size 5307118332
model-00009-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:101407fc2ce5dbc7b2d465b1eb830ae16d5f9b70d0163149de793afc755fd822
3
+ size 5218992802
model-00010-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56ffdc00d38f17784cde54c8a02d34954a100cfbb536e159dd9dee0ecd445f31
3
+ size 5362167060
model-00011-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:904134bb30fcb565bee081c4517bcf5abe6d497e8f259a7a9e7199bc4c405047
3
+ size 5163944074
model-00012-of-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3dcd0968c8a2227eeba74e40c182dbdcafa30c2495b5b16e660fec623d0ecd48
3
+ size 4647855400
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
readout.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccb630d849aed395b9a61cf72cd375cf6f91ccd133998df691cc7185aa82b90a
3
+ size 5483600
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626
tokenizer_config.json ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": true,
21
+ "local_files_only": false,
22
+ "mask_token": "<mask>",
23
+ "model_max_length": 1000000000000000019884624838656,
24
+ "model_specific_special_tokens": {
25
+ "audio_token": "<|audio|>",
26
+ "boa_token": "<|audio>",
27
+ "boi_token": "<|image>",
28
+ "eoa_token": "<audio|>",
29
+ "eoc_token": "<channel|>",
30
+ "eoi_token": "<image|>",
31
+ "eot_token": "<turn|>",
32
+ "escape_token": "<|\"|>",
33
+ "etc_token": "<tool_call|>",
34
+ "etd_token": "<tool|>",
35
+ "etr_token": "<tool_response|>",
36
+ "image_token": "<|image|>",
37
+ "soc_token": "<|channel>",
38
+ "sot_token": "<|turn>",
39
+ "stc_token": "<|tool_call>",
40
+ "std_token": "<|tool>",
41
+ "str_token": "<|tool_response>",
42
+ "think_token": "<|think|>"
43
+ },
44
+ "pad_token": "<pad>",
45
+ "padding_side": "left",
46
+ "processor_class": "Gemma4Processor",
47
+ "response_schema": {
48
+ "properties": {
49
+ "content": {
50
+ "type": "string"
51
+ },
52
+ "role": {
53
+ "const": "assistant"
54
+ },
55
+ "thinking": {
56
+ "type": "string"
57
+ },
58
+ "tool_calls": {
59
+ "items": {
60
+ "properties": {
61
+ "function": {
62
+ "properties": {
63
+ "arguments": {
64
+ "additionalProperties": {},
65
+ "type": "object",
66
+ "x-parser": "gemma4-tool-call"
67
+ },
68
+ "name": {
69
+ "type": "string"
70
+ }
71
+ },
72
+ "type": "object",
73
+ "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
74
+ },
75
+ "type": {
76
+ "const": "function"
77
+ }
78
+ },
79
+ "type": "object"
80
+ },
81
+ "type": "array",
82
+ "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
83
+ }
84
+ },
85
+ "type": "object",
86
+ "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
87
+ },
88
+ "response_template": {
89
+ "defaults": {
90
+ "role": "assistant"
91
+ },
92
+ "fields": {
93
+ "content": {
94
+ "close": [
95
+ "<turn|>",
96
+ "<|tool_response>",
97
+ "<eos>"
98
+ ],
99
+ "content": "text"
100
+ },
101
+ "thinking": {
102
+ "close": "<channel|>",
103
+ "content": "text",
104
+ "open": "<|channel>thought\n"
105
+ },
106
+ "tool_calls": {
107
+ "close": "<tool_call|>",
108
+ "content": "json",
109
+ "content_args": {
110
+ "string_delims": [
111
+ [
112
+ "<|\"|>",
113
+ "<|\"|>"
114
+ ]
115
+ ],
116
+ "unquoted_keys": true
117
+ },
118
+ "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)",
119
+ "repeats": true,
120
+ "transform": {
121
+ "function": {
122
+ "arguments": "{content}",
123
+ "name": "{name}"
124
+ },
125
+ "type": "function"
126
+ }
127
+ }
128
+ },
129
+ "start_anchor": [
130
+ "<|turn>model\n",
131
+ "<tool_response|>"
132
+ ]
133
+ },
134
+ "soc_token": "<|channel>",
135
+ "sot_token": "<|turn>",
136
+ "stc_token": "<|tool_call>",
137
+ "std_token": "<|tool>",
138
+ "str_token": "<|tool_response>",
139
+ "think_token": "<|think|>",
140
+ "tokenizer_class": "GemmaTokenizer",
141
+ "unk_token": "<unk>"
142
+ }