homerquan commited on
Commit
d91edfe
·
verified ·
1 Parent(s): 8ee6f24

Publish independently converted Inkling 2 Mini Q4_K_M and BF16 projector

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
+ Inkling-2-Mini-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
37
+ mmproj-Inkling-2-Mini-BF16.gguf filter=lfs diff=lfs merge=lfs -text
DMR_VALIDATION.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "passed": true,
3
+ "validated_utc": "2026-11-21T17:39:32.379012+00:00",
4
+ "model": "mirrorneuronlab/inkling-2-mini:q4_k_m",
5
+ "endpoint": "http://127.0.0.1:12438/engines/llama.cpp/v1/chat/completions",
6
+ "dmr_version": "Client:\n Version: v1.2.9\n OS/Arch: linux/arm64\n\nServer:\n Version: v1.2.9\n Engine: Docker Engine (Manual Install)",
7
+ "backend_version": "version: 1.0.0-dev (build 1, commit 29b52d3)\nbuilt with GNU 13.3.0 for Linux aarch64",
8
+ "gpu": "NVIDIA GB10, 580.178.04",
9
+ "gpu_processes": [
10
+ "1174262, /opt/llama/llama-server, 18492 MiB"
11
+ ],
12
+ "scope": "Docker CLI generation plus two deterministic chat and image smoke cases.",
13
+ "cli": {
14
+ "command": [
15
+ "docker",
16
+ "model",
17
+ "run",
18
+ "mirrorneuronlab/inkling-2-mini:q4_k_m",
19
+ "What is 17 multiplied by 23? Reply with only the number."
20
+ ],
21
+ "returncode": 0,
22
+ "stderr": "",
23
+ "final_answer": "391",
24
+ "printed_reasoning": true,
25
+ "passed": true
26
+ },
27
+ "text_api": {
28
+ "prompt": "What is 17 multiplied by 23? Reply with only the number.",
29
+ "content": "391",
30
+ "finish_reason": "stop",
31
+ "passed": true
32
+ },
33
+ "image_api": {
34
+ "prompt": "What is the dominant color in this image? Reply with one color word.",
35
+ "input": "320 by 320 pixel solid blue PNG",
36
+ "content": "blue",
37
+ "finish_reason": "stop",
38
+ "passed": true
39
+ }
40
+ }
Inkling-2-Mini-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0dd687b73295497dd2668cc1593aab910eb2d389d0b16e887f067e0e54a5f8f
3
+ size 17478094208
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.
PROVENANCE.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": {
3
+ "repo": "thinkingmachines/Inkling-2-Mini",
4
+ "revision": "ed40e7da625f594fc9c4990f5f66be24873c22d7",
5
+ "file": "model-00001-of-00001.safetensors",
6
+ "size_bytes": 19526019168,
7
+ "sha256": "65e60f51aa1284d4fb022584908c315270334d991828bb774af60584523539d1",
8
+ "license": "Apache-2.0"
9
+ },
10
+ "llama_cpp": {
11
+ "tag": "b12600",
12
+ "revision": "29b52d398b294509746ec0a3f28948a3107c0213"
13
+ },
14
+ "conversion": {
15
+ "text": "convert_hf_to_gguf.py source --outfile Inkling-2-Mini-BF16.gguf --outtype bf16 --model-name 'Inkling 2 Mini'",
16
+ "quantization": "llama-quantize Inkling-2-Mini-BF16.gguf Inkling-2-Mini-Q4_K_M.gguf Q4_K_M 12",
17
+ "vision": "convert_hf_to_gguf.py source --mmproj --outfile mmproj-Inkling-2-Mini-BF16.gguf --outtype bf16 --model-name 'Inkling 2 Mini'",
18
+ "importance_matrix": false,
19
+ "optional_mtp_draft_included": false
20
+ },
21
+ "artifacts": {
22
+ "Inkling-2-Mini-Q4_K_M.gguf": {
23
+ "size_bytes": 17478094208,
24
+ "sha256": "b0dd687b73295497dd2668cc1593aab910eb2d389d0b16e887f067e0e54a5f8f",
25
+ "architecture": "inkling2_loop",
26
+ "file_type": "MOSTLY_Q4_K_M",
27
+ "tensors": 704,
28
+ "tensor_types": {
29
+ "F32": 478,
30
+ "Q4_K": 189,
31
+ "Q5_0": 12,
32
+ "Q6_K": 13,
33
+ "Q8_0": 12
34
+ }
35
+ },
36
+ "mmproj-Inkling-2-Mini-BF16.gguf": {
37
+ "size_bytes": 641806048,
38
+ "sha256": "d46f556550a506ef8c4f3e54444d2c4780a2433672b728d5967d2516db32c59d",
39
+ "architecture": "clip",
40
+ "file_type": "MOSTLY_BF16",
41
+ "tensors": 422,
42
+ "tensor_types": {
43
+ "BF16": 140,
44
+ "F32": 282
45
+ }
46
+ }
47
+ }
48
+ }
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: thinkingmachines/Inkling-2-Mini
4
+ base_model_relation: quantized
5
+ library_name: gguf
6
+ pipeline_tag: image-text-to-text
7
+ tags:
8
+ - gguf
9
+ - llama.cpp
10
+ - docker-model-runner
11
+ - inkling2_loop
12
+ - conversational
13
+ ---
14
+
15
+ # Inkling 2 Mini Q4_K_M GGUF
16
+
17
+ MirrorNeuronLab independently converted Thinking Machines Lab's original Inkling 2 Mini checkpoint. The conversion decoded its packed NVFP4 and MXFP8 expert weights into a BF16 GGUF intermediate, then applied llama.cpp's standard Q4_K_M preset without an importance matrix. The BF16 projector provides image input. This release excludes the optional MTP draft model. [Original checkpoint](https://huggingface.co/thinkingmachines/Inkling-2-Mini/tree/ed40e7da625f594fc9c4990f5f66be24873c22d7)
18
+
19
+ | File | Format | Size |
20
+ | --- | --- | ---: |
21
+ | [Inkling-2-Mini-Q4_K_M.gguf](https://huggingface.co/MirrorNeuronLab/Inkling-2-Mini-GGUF/resolve/main/Inkling-2-Mini-Q4_K_M.gguf) | Q4_K_M text model | 17.48 GB |
22
+ | [mmproj-Inkling-2-Mini-BF16.gguf](https://huggingface.co/MirrorNeuronLab/Inkling-2-Mini-GGUF/resolve/main/mmproj-Inkling-2-Mini-BF16.gguf) | BF16 vision projector | 642 MB |
23
+
24
+ Verify the files with `sha256sum -c SHA256SUMS`. The provenance records the checkpoint revision, conversion commands, and tensor types. [SHA256SUMS](SHA256SUMS) · [Provenance](PROVENANCE.json)
25
+
26
+ ## Docker Model Runner
27
+
28
+ Use a Docker Model Runner llama.cpp backend with Inkling 2 Mini (`inkling2_loop`) support. Support first landed in build `b12600`. The backend build is independent of the `docker model` CLI version. [llama.cpp release](https://github.com/ggml-org/llama.cpp/releases/tag/b12600)
29
+
30
+ Validated on Docker Model Runner `v1.2.9` with CUDA llama.cpp commit `29b52d398`, Linux ARM64, and an NVIDIA GB10. The CLI returned `391` and the OpenAI-compatible API passed both text and image smoke tests at a 4,096-token context. [Validation report](DMR_VALIDATION.json)
31
+
32
+ ```bash
33
+ MODEL=hf.co/MirrorNeuronLab/Inkling-2-Mini-GGUF:Q4_K_M
34
+ docker model pull "$MODEL"
35
+ docker model configure --context-size 4096 "$MODEL"
36
+ docker model run "$MODEL" "What is 17 multiplied by 23? Reply with only the number."
37
+ ```
38
+
39
+ On Linux with NVIDIA GPUs, you can run a separate Docker Model Runner with a compatible CUDA build. Build llama.cpp `b12600` for your GPU with `-DGGML_CUDA=ON`, then pass the build's `bin` directory to the included launcher. It listens on localhost port `12438` by default. [Launcher](reproduce/start-docker-runner.sh)
40
+
41
+ ```bash
42
+ bash reproduce/start-docker-runner.sh /path/to/llama.cpp/build-cuda/bin
43
+ export MODEL_RUNNER_HOST=http://127.0.0.1:12438
44
+ ```
45
+
46
+ Run the pull, configure, and run commands above in that shell. Image input uses the `image_url` content type on Docker Model Runner's OpenAI-compatible chat completions endpoint. [Docker Model Runner API](https://docs.docker.com/ai/model-runner/api-reference/)
47
+
48
+ ## llama.cpp
49
+
50
+ ```bash
51
+ llama-server -hf MirrorNeuronLab/Inkling-2-Mini-GGUF:Q4_K_M --jinja -c 4096
52
+ ```
53
+
54
+ When using downloaded files, pass `-m Inkling-2-Mini-Q4_K_M.gguf --mmproj mmproj-Inkling-2-Mini-BF16.gguf` in place of `-hf` to enable image input.
55
+
56
+ ## Provenance and license
57
+
58
+ Thinking Machines Lab, Inc. developed the original model and released its weights under Apache 2.0. MirrorNeuronLab converted the model to GGUF and quantized its text weights. See the upstream model card for model capabilities and limitations. [License](LICENSE) · [Upstream model card](https://huggingface.co/thinkingmachines/Inkling-2-Mini) · [Thinking Machines Lab Model Acceptable Use Policy](https://thinkingmachines.ai/model-acceptable-use-policy/)
SHA256SUMS ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ b0dd687b73295497dd2668cc1593aab910eb2d389d0b16e887f067e0e54a5f8f Inkling-2-Mini-Q4_K_M.gguf
2
+ d46f556550a506ef8c4f3e54444d2c4780a2433672b728d5967d2516db32c59d mmproj-Inkling-2-Mini-BF16.gguf
chat_template.jinja ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set effort_map = {"none": 0.0, "minimal": 0.1, "low": 0.2, "medium": 0.7, "high": 0.9, "xhigh": 0.99, "max": 0.99} -%}
2
+ {%- set role_token = {"user": "<|message_user|>", "assistant": "<|message_model|>", "system": "<|message_system|>", "tool": "<|message_tool|>"} -%}
3
+
4
+ {%- macro emit_thinking_effort() -%}
5
+ {%- set eff = reasoning_effort if reasoning_effort is defined and reasoning_effort is not none else 0.9 -%}
6
+ {%- if eff is string -%}
7
+ {%- set key = eff | trim -%}
8
+ {%- if key not in effort_map -%}
9
+ {{- raise_exception("Unknown reasoning_effort: " ~ eff) -}}
10
+ {%- endif -%}
11
+ {%- set num = effort_map[key] -%}
12
+ {%- else -%}
13
+ {%- set num = eff | float -%}
14
+ {%- endif -%}
15
+ {%- if num < 0.0 or num > 0.99 -%}
16
+ {{- raise_exception("reasoning_effort must be in [0.0, 0.99]") -}}
17
+ {%- endif -%}
18
+ {{- "<|message_system|><|content_text|>Thinking effort level: " -}}
19
+ {%- if num == 0.0 -%}0{%- else -%}{{ num }}{%- endif -%}
20
+ {{- "<|end_message|>" -}}
21
+ {%- endmacro -%}
22
+
23
+ {%- if tools -%}
24
+ {%- set tool_state = namespace(specs=[]) -%}
25
+ {%- for tool in tools -%}
26
+ {%- set fn = tool.function if tool.function is defined else tool -%}
27
+ {%- set spec = {
28
+ "description": (fn.description if fn.description is defined and fn.description else ""),
29
+ "name": fn.name,
30
+ "parameters": (fn.parameters if fn.parameters is defined and fn.parameters else {}),
31
+ "type": (tool.type if tool.type is defined and tool.type else "function"),
32
+ } -%}
33
+ {%- set tool_state.specs = tool_state.specs + [spec] -%}
34
+ {%- endfor -%}
35
+ {{- "<|message_system|>tool_declare<|content_xml|>" -}}
36
+ {{- tool_state.specs | tojson(sort_keys=true, separators=(",", ":")) -}}
37
+ {{- "<|end_message|>" -}}
38
+ {%- endif -%}
39
+
40
+ {%- set state = namespace(effort_emitted=false) -%}
41
+ {%- for message in messages -%}
42
+ {%- if message.role not in role_token -%}
43
+ {{- raise_exception("Unknown message role: " ~ message.role) -}}
44
+ {%- endif -%}
45
+ {%- if not state.effort_emitted and message.role != "system" -%}
46
+ {{- emit_thinking_effort() -}}
47
+ {%- set state.effort_emitted = true -%}
48
+ {%- endif -%}
49
+
50
+ {%- set header = namespace(text=role_token[message.role]) -%}
51
+ {%- if message.role == "tool" -%}
52
+ {%- if message.name is defined and message.name -%}
53
+ {%- set header.text = header.text ~ message.name -%}
54
+ {%- elif message.tool_call_id is defined and message.tool_call_id -%}
55
+ {%- for prev in messages -%}
56
+ {%- if prev.role == "assistant" and prev.tool_calls -%}
57
+ {%- for tc in prev.tool_calls -%}
58
+ {%- if tc.id is defined and tc.id == message.tool_call_id and tc.function.name is defined -%}
59
+ {%- set header.text = header.text ~ tc.function.name -%}
60
+ {%- endif -%}
61
+ {%- endfor -%}
62
+ {%- endif -%}
63
+ {%- endfor -%}
64
+ {%- endif -%}
65
+ {%- elif message.role == "assistant" and message.name is defined and message.name -%}
66
+ {%- set header.text = header.text ~ message.name -%}
67
+ {%- endif -%}
68
+ {%- set rtok = header.text -%}
69
+ {%- set rendered -%}
70
+
71
+ {%- if message.role == "assistant" and message.reasoning_content is defined and message.reasoning_content -%}
72
+ {{- rtok ~ "<|content_thinking|>" ~ message.reasoning_content ~ "<|end_message|>" -}}
73
+ {%- endif -%}
74
+
75
+ {%- if message.content is string and (message.content or not (message.role == "assistant" and (message.tool_calls or message.reasoning_content))) -%}
76
+ {{- rtok ~ "<|content_text|>" ~ message.content ~ "<|end_message|>" -}}
77
+ {%- elif message.content -%}
78
+ {%- for part in message.content -%}
79
+ {%- if part is string -%}
80
+ {{- rtok ~ "<|content_text|>" ~ part ~ "<|end_message|>" -}}
81
+ {%- elif part.type is not defined or part.type in ("text", "input_text") -%}
82
+ {%- set text_part = (part.text if part.text is defined and part.text is string else "") -%}
83
+ {{- rtok ~ "<|content_text|>" ~ text_part ~ "<|end_message|>" -}}
84
+ {%- elif part.type in ("image", "input_image", "image_url") -%}
85
+ {%- if message.role not in ("user", "tool") -%}
86
+ {{- raise_exception("Image content is only supported for user and tool messages") -}}
87
+ {%- endif -%}
88
+ {{- rtok ~ "<|content_image|><|unused_200054|><|end_message|>" -}}
89
+ {%- elif part.type in ("audio", "input_audio", "audio_url") -%}
90
+ {{- raise_exception("Inkling 2 does not accept audio input") -}}
91
+ {%- else -%}
92
+ {{- raise_exception("Unsupported content part type: " ~ part.type) -}}
93
+ {%- endif -%}
94
+ {%- endfor -%}
95
+ {%- endif -%}
96
+
97
+ {%- if message.role == "assistant" and message.tool_calls -%}
98
+ {%- for tc in message.tool_calls -%}
99
+ {%- set fn = tc.function -%}
100
+ {%- if fn.name is not defined or fn.name is not string -%}
101
+ {{- raise_exception("tool call function name must be a string") -}}
102
+ {%- endif -%}
103
+ {%- if message.name is defined and message.name and message.name != fn.name -%}
104
+ {{- raise_exception("assistant name " ~ message.name ~ " does not match its tool call " ~ fn.name) -}}
105
+ {%- endif -%}
106
+ {%- set args = fn.arguments if fn.arguments is defined and fn.arguments else {} -%}
107
+ {%- if args is string -%}
108
+ {{- raise_exception("tool call arguments must be a parsed object, not a JSON string; canonicalize upstream") -}}
109
+ {%- endif -%}
110
+ {%- if args is not mapping -%}
111
+ {{- raise_exception("tool call arguments must be an object") -}}
112
+ {%- endif -%}
113
+ {{- "<|message_model|>" ~ fn.name ~ "<|content_invoke_tool_json|>" -}}
114
+ {{- '{"name":' ~ (fn.name | tojson(sort_keys=true, separators=(",", ":"))) ~ ',"args":' -}}
115
+ {{- "{" -}}
116
+ {%- for key, value in args | dictsort(case_sensitive=true) -%}
117
+ {{- (key | tojson) ~ ":" ~ (value | tojson(separators=(",", ":"))) -}}
118
+ {%- if not loop.last -%},{%- endif -%}
119
+ {%- endfor -%}
120
+ {{- "}}<|end_message|>" -}}
121
+ {%- endfor -%}
122
+ {%- endif -%}
123
+
124
+ {%- if message.role == "assistant" -%}
125
+ {{- "<|content_model_end_sampling|>" -}}
126
+ {%- endif -%}
127
+ {%- endset -%}
128
+ {%- if message.role == "assistant" -%}
129
+ {%- generation -%}{{- rendered -}}{%- endgeneration -%}
130
+ {%- else -%}
131
+ {{- rendered -}}
132
+ {%- endif -%}
133
+ {%- endfor -%}
134
+
135
+ {%- if not state.effort_emitted -%}
136
+ {{- emit_thinking_effort() -}}
137
+ {%- endif -%}
mmproj-Inkling-2-Mini-BF16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d46f556550a506ef8c4f3e54444d2c4780a2433672b728d5967d2516db32c59d
3
+ size 641806048
reproduce/start-docker-runner.sh ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [[ $# -ne 1 ]]; then
5
+ printf 'Usage: bash %s /path/to/llama.cpp/build-cuda/bin\n' "$0" >&2
6
+ exit 2
7
+ fi
8
+
9
+ backend_dir=$(realpath "$1")
10
+ test -x "$backend_dir/llama-server"
11
+
12
+ runner_name=${DMR_CONTAINER_NAME:-inkling-2-mini-runner}
13
+ runner_port=${DMR_PORT:-12438}
14
+
15
+ docker run -d --name "$runner_name" \
16
+ --gpus all \
17
+ --workdir /tmp \
18
+ --publish "127.0.0.1:${runner_port}:12434" \
19
+ --mount "type=volume,src=${runner_name}-models,dst=/models" \
20
+ --mount "type=bind,src=${backend_dir},dst=/opt/llama,readonly" \
21
+ --env MODEL_RUNNER_PORT=12434 \
22
+ --env LLAMA_SERVER_PATH=/opt/llama \
23
+ --env LD_LIBRARY_PATH=/opt/llama \
24
+ --env DISABLE_SERVER_UPDATE=1 \
25
+ --env 'LLAMA_ARGS=-ngl 999 --jinja --parallel 1 -t 8' \
26
+ docker/model-runner@sha256:ee3789655a824d9974510e491250c08a1fbf59e3b90c268c0d3db6ee55a5eed5