Image-Text-to-Text
Transformers
Safetensors
English
gemma4
gemma
multimodal
vision-language
quantized
int8
w8a8
quark
vllm
conversational
text-generation-inference
8-bit precision
Instructions to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8") model = AutoModelForMultimodalLM.from_pretrained("nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8
- SGLang
How to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with Docker Model Runner:
docker model run hf.co/nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8
Add files using upload-large-folder tool
Browse files- .gitattributes +1 -0
- LICENSE +202 -0
- NOTICE +23 -0
- README.md +183 -0
- chat_template.jinja +347 -0
- config.json +424 -0
- generation_config.json +14 -0
- model.safetensors +3 -0
- processor_config.json +75 -0
- tokenizer.json +3 -0
- tokenizer_config.json +96 -0
.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.
|
NOTICE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Gemma 4 31B Instruct
|
| 2 |
+
Copyright (c) Google DeepMind
|
| 3 |
+
|
| 4 |
+
Original model weights: https://huggingface.co/google/gemma-4-31B-it
|
| 5 |
+
Distributed by Google DeepMind under the Apache License 2.0
|
| 6 |
+
(https://ai.google.dev/gemma/apache_2).
|
| 7 |
+
|
| 8 |
+
This repository contains a derivative work: an INT8 W8A8 post-training quantized
|
| 9 |
+
version of the above model, produced with AMD Quark
|
| 10 |
+
(https://github.com/amd/quark). The original BF16 weights have been transformed
|
| 11 |
+
into INT8 per-channel weights with per-token dynamic INT8 activations; the
|
| 12 |
+
embedding, lm_head and the entire vision tower remain in BF16.
|
| 13 |
+
|
| 14 |
+
Modifications made:
|
| 15 |
+
- Linear weights of the language tower converted from BF16 to INT8 with
|
| 16 |
+
per-output-channel symmetric scales.
|
| 17 |
+
- quantization_config block appended to config.json (custom_mode='quark',
|
| 18 |
+
pack_method='order', weight_format='real_quantized').
|
| 19 |
+
- All other tokenizer / processor / chat_template files are unchanged from
|
| 20 |
+
the upstream google/gemma-4-31B-it release.
|
| 21 |
+
|
| 22 |
+
The license, attribution and disclaimer of warranty terms of the Apache License
|
| 23 |
+
2.0 (see LICENSE) apply to both the original work and this derivative.
|
README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
base_model: google/gemma-4-31B-it
|
| 8 |
+
tags:
|
| 9 |
+
- gemma
|
| 10 |
+
- gemma4
|
| 11 |
+
- quantized
|
| 12 |
+
- int8
|
| 13 |
+
- w8a8
|
| 14 |
+
- quark
|
| 15 |
+
- vllm
|
| 16 |
+
- conversational
|
| 17 |
+
- text-generation-inference
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Gemma-4-31B-it-Quark-W8A8-INT8
|
| 21 |
+
|
| 22 |
+
W8A8 INT8 quantized version of [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it) using [AMD Quark](https://github.com/amd/quark).
|
| 23 |
+
|
| 24 |
+
## Model Details
|
| 25 |
+
|
| 26 |
+
| | |
|
| 27 |
+
|----------------|--------------------------------------------------------------------------------|
|
| 28 |
+
| Base Model | `google/gemma-4-31B-it` |
|
| 29 |
+
| Architecture | `Gemma4ForConditionalGeneration` (multimodal: text + vision) |
|
| 30 |
+
| Parameters | 31 B text decoder (quantized) + vision tower & embeddings kept in BF16 |
|
| 31 |
+
| Quantization | W8A8 INT8 (per-channel weight + per-token dynamic activation) |
|
| 32 |
+
| Quantizer | AMD Quark `0.11.1` (`ptpc_int8` scheme, `pack_method='order'`) |
|
| 33 |
+
| Model Size | ~32 GB (single `model.safetensors`) |
|
| 34 |
+
| Original Size | ~62.5 GB (BF16) |
|
| 35 |
+
| Compression | ~2× size reduction |
|
| 36 |
+
|
| 37 |
+
### Quantization Scheme
|
| 38 |
+
|
| 39 |
+
| Component | dtype | Granularity | Mode |
|
| 40 |
+
|-------------|-------|----------------------------|--------------------|
|
| 41 |
+
| Weight | INT8 | per-channel (`ch_axis=0`) | symmetric, static |
|
| 42 |
+
| Activation | INT8 | per-token (`ch_axis=1`) | symmetric, dynamic |
|
| 43 |
+
| `lm_head` | BF16 | — | unquantized |
|
| 44 |
+
| `embed_tokens` | BF16 | — | unquantized |
|
| 45 |
+
| `vision_tower` / `embed_vision` | BF16 | — | unquantized (multimodal preserved) |
|
| 46 |
+
|
| 47 |
+
## Accuracy
|
| 48 |
+
|
| 49 |
+
GSM8K 8-shot evaluation on the full 1319-question test split (vLLM, `temperature=0`, `concurrency=16`, `max_tokens=512`, standard chat template with `####` answer format):
|
| 50 |
+
|
| 51 |
+
| Model | Scheme | Accuracy | Correct |
|
| 52 |
+
|----------------------------------------|-------------------------------------|------------|--------------|
|
| 53 |
+
| `google/gemma-4-31B-it` (BF16 baseline) | — | **96.74%** | 1276 / 1319 |
|
| 54 |
+
| **This model (Quark W8A8 INT8)** | per-channel weight + per-token act. | **96.66%** | 1275 / 1319 |
|
| 55 |
+
|
| 56 |
+
Δ vs BF16: **−0.08pp (essentially lossless)**.
|
| 57 |
+
|
| 58 |
+
## How to Use
|
| 59 |
+
|
| 60 |
+
### With vLLM (Recommended)
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
# Start the server (single MI300X / MI350X / MI355X is enough; A100-80G also works)
|
| 64 |
+
vllm serve nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 \
|
| 65 |
+
--tensor-parallel-size 1 \
|
| 66 |
+
--max-model-len 8192 \
|
| 67 |
+
--gpu-memory-utilization 0.9 \
|
| 68 |
+
--trust-remote-code
|
| 69 |
+
|
| 70 |
+
# Chat completion
|
| 71 |
+
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
|
| 72 |
+
"model": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8",
|
| 73 |
+
"messages": [{"role": "user", "content": "Hello! What is the capital of France?"}],
|
| 74 |
+
"max_tokens": 256,
|
| 75 |
+
"temperature": 0.7
|
| 76 |
+
}'
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
### Hardware Requirements
|
| 80 |
+
|
| 81 |
+
- **Minimum**: 1× GPU with ≥48 GB VRAM (e.g., AMD MI300X / MI350X / MI355X, NVIDIA A100-80G / H100).
|
| 82 |
+
- For longer context or larger batches use TP=2 across two of the same GPUs.
|
| 83 |
+
|
| 84 |
+
## Quantization Details
|
| 85 |
+
|
| 86 |
+
This model was quantized using AMD Quark's per-token per-channel INT8 scheme:
|
| 87 |
+
|
| 88 |
+
- **Weight quantization**: INT8 per-channel (one scale per output channel), symmetric, static.
|
| 89 |
+
- **Activation quantization**: INT8 per-token (one scale per token), symmetric, dynamic (computed at inference time).
|
| 90 |
+
- **Excluded layers**: `lm_head`, `*embed_tokens*`, `*vision_tower*`, `*embed_vision*` (output head + token embedding + the entire vision tower remain in BF16).
|
| 91 |
+
- **Export**: `pack_method='order'`, `weight_format='real_quantized'`, `custom_mode='quark'` → real INT8 weights with BF16 scales (no fake-quant, no zero-point).
|
| 92 |
+
|
| 93 |
+
### Reproduce Quantization
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
# 1. Environment
|
| 97 |
+
pip install amd-quark==0.11.1 datasets accelerate
|
| 98 |
+
git clone https://github.com/huggingface/transformers.git
|
| 99 |
+
cd transformers && pip install -e . --no-deps # transformers main (>= 5.6.0.dev0)
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
# quark_gemma4_int8.py
|
| 104 |
+
import os, torch
|
| 105 |
+
from transformers import AutoTokenizer, Gemma4ForConditionalGeneration
|
| 106 |
+
from quark.torch import ModelQuantizer
|
| 107 |
+
from quark.torch.quantization.config.config import (
|
| 108 |
+
QTensorConfig, QuantizationConfig, Config, Dtype,
|
| 109 |
+
)
|
| 110 |
+
from quark.torch.quantization.config.type import (
|
| 111 |
+
RoundType, ScaleType, QSchemeType,
|
| 112 |
+
)
|
| 113 |
+
from quark.torch.quantization.observer import PerChannelMinMaxObserver
|
| 114 |
+
|
| 115 |
+
MODEL_IN = "google/gemma-4-31B-it"
|
| 116 |
+
MODEL_OUT = "./Gemma-4-31B-it-Quark-W8A8-INT8"
|
| 117 |
+
|
| 118 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_IN, trust_remote_code=True)
|
| 119 |
+
model = Gemma4ForConditionalGeneration.from_pretrained(
|
| 120 |
+
MODEL_IN, torch_dtype=torch.bfloat16,
|
| 121 |
+
device_map="auto", trust_remote_code=True,
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
weight_spec = QTensorConfig(
|
| 125 |
+
dtype=Dtype.int8, observer_cls=PerChannelMinMaxObserver,
|
| 126 |
+
symmetric=True, is_dynamic=False,
|
| 127 |
+
qscheme=QSchemeType.per_channel, ch_axis=0,
|
| 128 |
+
round_method=RoundType.round, scale_type=ScaleType.float,
|
| 129 |
+
)
|
| 130 |
+
input_spec = QTensorConfig(
|
| 131 |
+
dtype=Dtype.int8, observer_cls=PerChannelMinMaxObserver,
|
| 132 |
+
symmetric=True, is_dynamic=True,
|
| 133 |
+
qscheme=QSchemeType.per_channel, ch_axis=1,
|
| 134 |
+
round_method=RoundType.round, scale_type=ScaleType.float,
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
q_cfg = Config(
|
| 138 |
+
global_quant_config=QuantizationConfig(
|
| 139 |
+
input_tensors=input_spec, weight=weight_spec,
|
| 140 |
+
),
|
| 141 |
+
exclude=[
|
| 142 |
+
"lm_head", "*embed_tokens*",
|
| 143 |
+
"*vision_tower*", "*embed_vision*",
|
| 144 |
+
],
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
quantizer = ModelQuantizer(q_cfg, multi_device=True)
|
| 148 |
+
model = quantizer.quantize_model(model, dataloader=None) # PTQ, no calibration data needed for dynamic act
|
| 149 |
+
quantizer.freeze(model)
|
| 150 |
+
|
| 151 |
+
quantizer.export_model(
|
| 152 |
+
model, MODEL_OUT,
|
| 153 |
+
pack_method="order",
|
| 154 |
+
weight_format="real_quantized",
|
| 155 |
+
custom_mode="quark",
|
| 156 |
+
)
|
| 157 |
+
tokenizer.save_pretrained(MODEL_OUT)
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
## Citation
|
| 161 |
+
|
| 162 |
+
If you use this model, please cite the original Gemma 4 release:
|
| 163 |
+
|
| 164 |
+
```bibtex
|
| 165 |
+
@misc{google2026gemma4,
|
| 166 |
+
title = {Gemma 4},
|
| 167 |
+
author = {Google DeepMind},
|
| 168 |
+
year = {2026},
|
| 169 |
+
url = {https://huggingface.co/google/gemma-4-31B-it}
|
| 170 |
+
}
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
## License
|
| 174 |
+
|
| 175 |
+
This model is released under the **[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)**, following the [Gemma 4 license](https://ai.google.dev/gemma/apache_2) under which the upstream `google/gemma-4-31B-it` weights are distributed by Google DeepMind.
|
| 176 |
+
|
| 177 |
+
This is a quantized derivative of `google/gemma-4-31B-it`. Per Apache 2.0 §4:
|
| 178 |
+
|
| 179 |
+
- Modified files (the INT8-quantized `model.safetensors` and the appended `quantization_config` block in `config.json`) carry this notice as part of the model card.
|
| 180 |
+
- Original copyright and attribution notices from the base model are preserved (see `NOTICE`).
|
| 181 |
+
- A copy of the Apache 2.0 license text is included as `LICENSE`.
|
| 182 |
+
|
| 183 |
+
Original weights © Google DeepMind. Quantization performed by the model author; no warranty of any kind is provided (see `LICENSE` §7–8).
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro format_parameters(properties, required) -%}
|
| 2 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 3 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 4 |
+
{%- for key, value in properties | dictsort -%}
|
| 5 |
+
{%- set add_comma = false -%}
|
| 6 |
+
{%- if key not in standard_keys -%}
|
| 7 |
+
{%- if ns.found_first %},{% endif -%}
|
| 8 |
+
{%- set ns.found_first = true -%}
|
| 9 |
+
{{ key }}:{
|
| 10 |
+
{%- if value['description'] -%}
|
| 11 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 12 |
+
{%- set add_comma = true -%}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 15 |
+
{%- if value['enum'] -%}
|
| 16 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 17 |
+
enum:{{ format_argument(value['enum']) }}
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 20 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 21 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 22 |
+
items:{
|
| 23 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 24 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 25 |
+
{%- if item_value is not none -%}
|
| 26 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 27 |
+
{%- set ns_items.found_first = true -%}
|
| 28 |
+
{%- if item_key == 'properties' -%}
|
| 29 |
+
properties:{
|
| 30 |
+
{%- if item_value is mapping -%}
|
| 31 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
}
|
| 34 |
+
{%- elif item_key == 'required' -%}
|
| 35 |
+
required:[
|
| 36 |
+
{%- for req_item in item_value -%}
|
| 37 |
+
<|"|>{{- req_item -}}<|"|>
|
| 38 |
+
{%- if not loop.last %},{% endif -%}
|
| 39 |
+
{%- endfor -%}
|
| 40 |
+
]
|
| 41 |
+
{%- elif item_key == 'type' -%}
|
| 42 |
+
{%- if item_value is string -%}
|
| 43 |
+
type:{{ format_argument(item_value | upper) }}
|
| 44 |
+
{%- else -%}
|
| 45 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 46 |
+
{%- endif -%}
|
| 47 |
+
{%- else -%}
|
| 48 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 49 |
+
{%- endif -%}
|
| 50 |
+
{%- endif -%}
|
| 51 |
+
{%- endfor -%}
|
| 52 |
+
}
|
| 53 |
+
{%- endif -%}
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- if value['nullable'] %}
|
| 56 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 57 |
+
nullable:true
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 60 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 61 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 62 |
+
properties:{
|
| 63 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 64 |
+
}
|
| 65 |
+
{%- elif value is mapping -%}
|
| 66 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 67 |
+
properties:{
|
| 68 |
+
{{- format_parameters(value, value['required'] | default([])) -}}
|
| 69 |
+
}
|
| 70 |
+
{%- endif -%}
|
| 71 |
+
{%- if value['required'] -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
required:[
|
| 74 |
+
{%- for item in value['required'] | default([]) -%}
|
| 75 |
+
<|"|>{{- item -}}<|"|>
|
| 76 |
+
{%- if not loop.last %},{% endif -%}
|
| 77 |
+
{%- endfor -%}
|
| 78 |
+
]
|
| 79 |
+
{%- endif -%}
|
| 80 |
+
{%- endif -%}
|
| 81 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 82 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 83 |
+
{%- endif -%}
|
| 84 |
+
{%- endfor -%}
|
| 85 |
+
{%- endmacro -%}
|
| 86 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 87 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 88 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 89 |
+
{%- if params -%}
|
| 90 |
+
,parameters:{
|
| 91 |
+
{%- if params['properties'] -%}
|
| 92 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- if params['required'] -%}
|
| 95 |
+
required:[
|
| 96 |
+
{%- for item in params['required'] -%}
|
| 97 |
+
<|"|>{{- item -}}<|"|>
|
| 98 |
+
{{- ',' if not loop.last -}}
|
| 99 |
+
{%- endfor -%}
|
| 100 |
+
],
|
| 101 |
+
{%- endif -%}
|
| 102 |
+
{%- if params['type'] -%}
|
| 103 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 104 |
+
{%- endif -%}
|
| 105 |
+
{%- endif -%}
|
| 106 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 107 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 108 |
+
,response:{
|
| 109 |
+
{%- if response_declaration['description'] -%}
|
| 110 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 113 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 114 |
+
{%- endif -%}
|
| 115 |
+
{%- endif -%}
|
| 116 |
+
}
|
| 117 |
+
{%- endmacro -%}
|
| 118 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 119 |
+
{%- if argument is string -%}
|
| 120 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 121 |
+
{%- elif argument is boolean -%}
|
| 122 |
+
{{- 'true' if argument else 'false' -}}
|
| 123 |
+
{%- elif argument is mapping -%}
|
| 124 |
+
{{- '{' -}}
|
| 125 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 126 |
+
{%- for key, value in argument | dictsort -%}
|
| 127 |
+
{%- if ns.found_first %},{% endif -%}
|
| 128 |
+
{%- set ns.found_first = true -%}
|
| 129 |
+
{%- if escape_keys -%}
|
| 130 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 131 |
+
{%- else -%}
|
| 132 |
+
{{- key -}}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 135 |
+
{%- endfor -%}
|
| 136 |
+
{{- '}' -}}
|
| 137 |
+
{%- elif argument is sequence -%}
|
| 138 |
+
{{- '[' -}}
|
| 139 |
+
{%- for item in argument -%}
|
| 140 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 141 |
+
{%- if not loop.last %},{% endif -%}
|
| 142 |
+
{%- endfor -%}
|
| 143 |
+
{{- ']' -}}
|
| 144 |
+
{%- else -%}
|
| 145 |
+
{{- argument -}}
|
| 146 |
+
{%- endif -%}
|
| 147 |
+
{%- endmacro -%}
|
| 148 |
+
{%- macro strip_thinking(text) -%}
|
| 149 |
+
{%- set ns = namespace(result='') -%}
|
| 150 |
+
{%- for part in text.split('<channel|>') -%}
|
| 151 |
+
{%- if '<|channel>' in part -%}
|
| 152 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 153 |
+
{%- else -%}
|
| 154 |
+
{%- set ns.result = ns.result + part -%}
|
| 155 |
+
{%- endif -%}
|
| 156 |
+
{%- endfor -%}
|
| 157 |
+
{{- ns.result | trim -}}
|
| 158 |
+
{%- endmacro -%}
|
| 159 |
+
|
| 160 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 161 |
+
{{- '<|tool_response>' -}}
|
| 162 |
+
{%- if response is mapping -%}
|
| 163 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 164 |
+
{%- for key, value in response | dictsort -%}
|
| 165 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 166 |
+
{%- if not loop.last %},{% endif -%}
|
| 167 |
+
{%- endfor -%}
|
| 168 |
+
{{- '}' -}}
|
| 169 |
+
{%- else -%}
|
| 170 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 171 |
+
{%- endif -%}
|
| 172 |
+
{{- '<tool_response|>' -}}
|
| 173 |
+
{%- endmacro -%}
|
| 174 |
+
|
| 175 |
+
{%- set ns = namespace(prev_message_type=None) -%}
|
| 176 |
+
{%- set loop_messages = messages -%}
|
| 177 |
+
{{- bos_token -}}
|
| 178 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 179 |
+
{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
|
| 180 |
+
{{- '<|turn>system\n' -}}
|
| 181 |
+
|
| 182 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 183 |
+
{%- if enable_thinking is defined and enable_thinking -%}
|
| 184 |
+
{{- '<|think|>\n' -}}
|
| 185 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 186 |
+
{%- endif -%}
|
| 187 |
+
|
| 188 |
+
{%- if messages[0]['role'] in ['system', 'developer'] -%}
|
| 189 |
+
{{- messages[0]['content'] | trim -}}
|
| 190 |
+
{%- set loop_messages = messages[1:] -%}
|
| 191 |
+
{%- endif -%}
|
| 192 |
+
|
| 193 |
+
{%- if tools -%}
|
| 194 |
+
{%- for tool in tools %}
|
| 195 |
+
{{- '<|tool>' -}}
|
| 196 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 197 |
+
{{- '<tool|>' -}}
|
| 198 |
+
{%- endfor %}
|
| 199 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 200 |
+
{%- endif -%}
|
| 201 |
+
|
| 202 |
+
{{- '<turn|>\n' -}}
|
| 203 |
+
{%- endif %}
|
| 204 |
+
|
| 205 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 206 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 207 |
+
{%- for i in range(loop_messages | length) -%}
|
| 208 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 209 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 210 |
+
{%- endif -%}
|
| 211 |
+
{%- endfor -%}
|
| 212 |
+
|
| 213 |
+
{#- Loop through messages -#}
|
| 214 |
+
{%- for message in loop_messages -%}
|
| 215 |
+
{%- if message['role'] != 'tool' -%}
|
| 216 |
+
{%- set ns.prev_message_type = None -%}
|
| 217 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 218 |
+
{#- Detect continuation: suppress duplicate <|turn>model when previous non-tool message was also assistant -#}
|
| 219 |
+
{%- set prev_nt = namespace(role=None, found=false) -%}
|
| 220 |
+
{%- if loop.index0 > 0 -%}
|
| 221 |
+
{%- for j in range(loop.index0 - 1, -1, -1) -%}
|
| 222 |
+
{%- if not prev_nt.found -%}
|
| 223 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 224 |
+
{%- set prev_nt.role = loop_messages[j]['role'] -%}
|
| 225 |
+
{%- set prev_nt.found = true -%}
|
| 226 |
+
{%- endif -%}
|
| 227 |
+
{%- endif -%}
|
| 228 |
+
{%- endfor -%}
|
| 229 |
+
{%- endif -%}
|
| 230 |
+
{%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
|
| 231 |
+
{%- if not continue_same_model_turn -%}
|
| 232 |
+
{{- '<|turn>' + role + '\n' }}
|
| 233 |
+
{%- endif -%}
|
| 234 |
+
|
| 235 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 236 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 237 |
+
{%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
|
| 238 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 239 |
+
{%- endif -%}
|
| 240 |
+
|
| 241 |
+
{%- if message['tool_calls'] -%}
|
| 242 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 243 |
+
{%- set function = tool_call['function'] -%}
|
| 244 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 245 |
+
{%- if function['arguments'] is mapping -%}
|
| 246 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 247 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 248 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 249 |
+
{%- set ns_args.found_first = true -%}
|
| 250 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 251 |
+
{%- endfor -%}
|
| 252 |
+
{%- elif function['arguments'] is string -%}
|
| 253 |
+
{{- function['arguments'] -}}
|
| 254 |
+
{%- endif -%}
|
| 255 |
+
{{- '}<tool_call|>' -}}
|
| 256 |
+
{%- endfor -%}
|
| 257 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 258 |
+
{%- endif -%}
|
| 259 |
+
|
| 260 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 261 |
+
{%- if message.get('tool_responses') -%}
|
| 262 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 263 |
+
{%- for tool_response in message['tool_responses'] -%}
|
| 264 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
|
| 265 |
+
{%- set ns_tr_out.flag = true -%}
|
| 266 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 267 |
+
{%- endfor -%}
|
| 268 |
+
{%- elif message.get('tool_calls') -%}
|
| 269 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 270 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 271 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 272 |
+
{%- if ns_tool_scan.stopped -%}
|
| 273 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 274 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 275 |
+
{%- else -%}
|
| 276 |
+
{%- set follow = loop_messages[k] -%}
|
| 277 |
+
{#- Resolve tool_call_id to function name -#}
|
| 278 |
+
{%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
|
| 279 |
+
{%- for tc in message['tool_calls'] -%}
|
| 280 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 281 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 282 |
+
{%- endif -%}
|
| 283 |
+
{%- endfor -%}
|
| 284 |
+
{#- Handle content as string or content-parts array -#}
|
| 285 |
+
{%- set tool_body = follow.get('content') -%}
|
| 286 |
+
{%- if tool_body is string -%}
|
| 287 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 288 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 289 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 290 |
+
{%- for part in tool_body -%}
|
| 291 |
+
{%- if part.get('type') == 'text' -%}
|
| 292 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 293 |
+
{%- endif -%}
|
| 294 |
+
{%- endfor -%}
|
| 295 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 296 |
+
{%- else -%}
|
| 297 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 298 |
+
{%- endif -%}
|
| 299 |
+
{%- set ns_tr_out.flag = true -%}
|
| 300 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 301 |
+
{%- endif -%}
|
| 302 |
+
{%- endfor -%}
|
| 303 |
+
{%- endif -%}
|
| 304 |
+
|
| 305 |
+
{%- if message['content'] is string -%}
|
| 306 |
+
{%- if role == 'model' -%}
|
| 307 |
+
{{- strip_thinking(message['content']) -}}
|
| 308 |
+
{%- else -%}
|
| 309 |
+
{{- message['content'] | trim -}}
|
| 310 |
+
{%- endif -%}
|
| 311 |
+
{%- elif message['content'] is sequence -%}
|
| 312 |
+
{%- for item in message['content'] -%}
|
| 313 |
+
{%- if item['type'] == 'text' -%}
|
| 314 |
+
{%- if role == 'model' -%}
|
| 315 |
+
{{- strip_thinking(item['text']) -}}
|
| 316 |
+
{%- else -%}
|
| 317 |
+
{{- item['text'] | trim -}}
|
| 318 |
+
{%- endif -%}
|
| 319 |
+
{%- elif item['type'] == 'image' -%}
|
| 320 |
+
{{- '<|image|>' -}}
|
| 321 |
+
{%- set ns.prev_message_type = 'image' -%}
|
| 322 |
+
{%- elif item['type'] == 'audio' -%}
|
| 323 |
+
{{- '<|audio|>' -}}
|
| 324 |
+
{%- set ns.prev_message_type = 'audio' -%}
|
| 325 |
+
{%- elif item['type'] == 'video' -%}
|
| 326 |
+
{{- '<|video|>' -}}
|
| 327 |
+
{%- set ns.prev_message_type = 'video' -%}
|
| 328 |
+
{%- endif -%}
|
| 329 |
+
{%- endfor -%}
|
| 330 |
+
{%- endif -%}
|
| 331 |
+
|
| 332 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 333 |
+
{{- '<|tool_response>' -}}
|
| 334 |
+
{%- elif not (ns_tr_out.flag and not message.get('content')) -%}
|
| 335 |
+
{{- '<turn|>\n' -}}
|
| 336 |
+
{%- endif -%}
|
| 337 |
+
{%- endif -%}
|
| 338 |
+
{%- endfor -%}
|
| 339 |
+
|
| 340 |
+
{%- if add_generation_prompt -%}
|
| 341 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 342 |
+
{{- '<|turn>model\n' -}}
|
| 343 |
+
{%- if not enable_thinking | default(false) -%}
|
| 344 |
+
{{- '<|channel>thought\n<channel|>' -}}
|
| 345 |
+
{%- endif -%}
|
| 346 |
+
{%- endif -%}
|
| 347 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"quantization_config": {
|
| 21 |
+
"algo_config": null,
|
| 22 |
+
"exclude": [
|
| 23 |
+
"model.vision_tower.patch_embedder.input_proj",
|
| 24 |
+
"model.vision_tower.encoder.layers.0.self_attn.q_proj.linear",
|
| 25 |
+
"model.vision_tower.encoder.layers.0.self_attn.k_proj.linear",
|
| 26 |
+
"model.vision_tower.encoder.layers.0.self_attn.v_proj.linear",
|
| 27 |
+
"model.vision_tower.encoder.layers.0.self_attn.o_proj.linear",
|
| 28 |
+
"model.vision_tower.encoder.layers.0.mlp.gate_proj.linear",
|
| 29 |
+
"model.vision_tower.encoder.layers.0.mlp.up_proj.linear",
|
| 30 |
+
"model.vision_tower.encoder.layers.0.mlp.down_proj.linear",
|
| 31 |
+
"model.vision_tower.encoder.layers.1.self_attn.q_proj.linear",
|
| 32 |
+
"model.vision_tower.encoder.layers.1.self_attn.k_proj.linear",
|
| 33 |
+
"model.vision_tower.encoder.layers.1.self_attn.v_proj.linear",
|
| 34 |
+
"model.vision_tower.encoder.layers.1.self_attn.o_proj.linear",
|
| 35 |
+
"model.vision_tower.encoder.layers.1.mlp.gate_proj.linear",
|
| 36 |
+
"model.vision_tower.encoder.layers.1.mlp.up_proj.linear",
|
| 37 |
+
"model.vision_tower.encoder.layers.1.mlp.down_proj.linear",
|
| 38 |
+
"model.vision_tower.encoder.layers.2.self_attn.q_proj.linear",
|
| 39 |
+
"model.vision_tower.encoder.layers.2.self_attn.k_proj.linear",
|
| 40 |
+
"model.vision_tower.encoder.layers.2.self_attn.v_proj.linear",
|
| 41 |
+
"model.vision_tower.encoder.layers.2.self_attn.o_proj.linear",
|
| 42 |
+
"model.vision_tower.encoder.layers.2.mlp.gate_proj.linear",
|
| 43 |
+
"model.vision_tower.encoder.layers.2.mlp.up_proj.linear",
|
| 44 |
+
"model.vision_tower.encoder.layers.2.mlp.down_proj.linear",
|
| 45 |
+
"model.vision_tower.encoder.layers.3.self_attn.q_proj.linear",
|
| 46 |
+
"model.vision_tower.encoder.layers.3.self_attn.k_proj.linear",
|
| 47 |
+
"model.vision_tower.encoder.layers.3.self_attn.v_proj.linear",
|
| 48 |
+
"model.vision_tower.encoder.layers.3.self_attn.o_proj.linear",
|
| 49 |
+
"model.vision_tower.encoder.layers.3.mlp.gate_proj.linear",
|
| 50 |
+
"model.vision_tower.encoder.layers.3.mlp.up_proj.linear",
|
| 51 |
+
"model.vision_tower.encoder.layers.3.mlp.down_proj.linear",
|
| 52 |
+
"model.vision_tower.encoder.layers.4.self_attn.q_proj.linear",
|
| 53 |
+
"model.vision_tower.encoder.layers.4.self_attn.k_proj.linear",
|
| 54 |
+
"model.vision_tower.encoder.layers.4.self_attn.v_proj.linear",
|
| 55 |
+
"model.vision_tower.encoder.layers.4.self_attn.o_proj.linear",
|
| 56 |
+
"model.vision_tower.encoder.layers.4.mlp.gate_proj.linear",
|
| 57 |
+
"model.vision_tower.encoder.layers.4.mlp.up_proj.linear",
|
| 58 |
+
"model.vision_tower.encoder.layers.4.mlp.down_proj.linear",
|
| 59 |
+
"model.vision_tower.encoder.layers.5.self_attn.q_proj.linear",
|
| 60 |
+
"model.vision_tower.encoder.layers.5.self_attn.k_proj.linear",
|
| 61 |
+
"model.vision_tower.encoder.layers.5.self_attn.v_proj.linear",
|
| 62 |
+
"model.vision_tower.encoder.layers.5.self_attn.o_proj.linear",
|
| 63 |
+
"model.vision_tower.encoder.layers.5.mlp.gate_proj.linear",
|
| 64 |
+
"model.vision_tower.encoder.layers.5.mlp.up_proj.linear",
|
| 65 |
+
"model.vision_tower.encoder.layers.5.mlp.down_proj.linear",
|
| 66 |
+
"model.vision_tower.encoder.layers.6.self_attn.q_proj.linear",
|
| 67 |
+
"model.vision_tower.encoder.layers.6.self_attn.k_proj.linear",
|
| 68 |
+
"model.vision_tower.encoder.layers.6.self_attn.v_proj.linear",
|
| 69 |
+
"model.vision_tower.encoder.layers.6.self_attn.o_proj.linear",
|
| 70 |
+
"model.vision_tower.encoder.layers.6.mlp.gate_proj.linear",
|
| 71 |
+
"model.vision_tower.encoder.layers.6.mlp.up_proj.linear",
|
| 72 |
+
"model.vision_tower.encoder.layers.6.mlp.down_proj.linear",
|
| 73 |
+
"model.vision_tower.encoder.layers.7.self_attn.q_proj.linear",
|
| 74 |
+
"model.vision_tower.encoder.layers.7.self_attn.k_proj.linear",
|
| 75 |
+
"model.vision_tower.encoder.layers.7.self_attn.v_proj.linear",
|
| 76 |
+
"model.vision_tower.encoder.layers.7.self_attn.o_proj.linear",
|
| 77 |
+
"model.vision_tower.encoder.layers.7.mlp.gate_proj.linear",
|
| 78 |
+
"model.vision_tower.encoder.layers.7.mlp.up_proj.linear",
|
| 79 |
+
"model.vision_tower.encoder.layers.7.mlp.down_proj.linear",
|
| 80 |
+
"model.vision_tower.encoder.layers.8.self_attn.q_proj.linear",
|
| 81 |
+
"model.vision_tower.encoder.layers.8.self_attn.k_proj.linear",
|
| 82 |
+
"model.vision_tower.encoder.layers.8.self_attn.v_proj.linear",
|
| 83 |
+
"model.vision_tower.encoder.layers.8.self_attn.o_proj.linear",
|
| 84 |
+
"model.vision_tower.encoder.layers.8.mlp.gate_proj.linear",
|
| 85 |
+
"model.vision_tower.encoder.layers.8.mlp.up_proj.linear",
|
| 86 |
+
"model.vision_tower.encoder.layers.8.mlp.down_proj.linear",
|
| 87 |
+
"model.vision_tower.encoder.layers.9.self_attn.q_proj.linear",
|
| 88 |
+
"model.vision_tower.encoder.layers.9.self_attn.k_proj.linear",
|
| 89 |
+
"model.vision_tower.encoder.layers.9.self_attn.v_proj.linear",
|
| 90 |
+
"model.vision_tower.encoder.layers.9.self_attn.o_proj.linear",
|
| 91 |
+
"model.vision_tower.encoder.layers.9.mlp.gate_proj.linear",
|
| 92 |
+
"model.vision_tower.encoder.layers.9.mlp.up_proj.linear",
|
| 93 |
+
"model.vision_tower.encoder.layers.9.mlp.down_proj.linear",
|
| 94 |
+
"model.vision_tower.encoder.layers.10.self_attn.q_proj.linear",
|
| 95 |
+
"model.vision_tower.encoder.layers.10.self_attn.k_proj.linear",
|
| 96 |
+
"model.vision_tower.encoder.layers.10.self_attn.v_proj.linear",
|
| 97 |
+
"model.vision_tower.encoder.layers.10.self_attn.o_proj.linear",
|
| 98 |
+
"model.vision_tower.encoder.layers.10.mlp.gate_proj.linear",
|
| 99 |
+
"model.vision_tower.encoder.layers.10.mlp.up_proj.linear",
|
| 100 |
+
"model.vision_tower.encoder.layers.10.mlp.down_proj.linear",
|
| 101 |
+
"model.vision_tower.encoder.layers.11.self_attn.q_proj.linear",
|
| 102 |
+
"model.vision_tower.encoder.layers.11.self_attn.k_proj.linear",
|
| 103 |
+
"model.vision_tower.encoder.layers.11.self_attn.v_proj.linear",
|
| 104 |
+
"model.vision_tower.encoder.layers.11.self_attn.o_proj.linear",
|
| 105 |
+
"model.vision_tower.encoder.layers.11.mlp.gate_proj.linear",
|
| 106 |
+
"model.vision_tower.encoder.layers.11.mlp.up_proj.linear",
|
| 107 |
+
"model.vision_tower.encoder.layers.11.mlp.down_proj.linear",
|
| 108 |
+
"model.vision_tower.encoder.layers.12.self_attn.q_proj.linear",
|
| 109 |
+
"model.vision_tower.encoder.layers.12.self_attn.k_proj.linear",
|
| 110 |
+
"model.vision_tower.encoder.layers.12.self_attn.v_proj.linear",
|
| 111 |
+
"model.vision_tower.encoder.layers.12.self_attn.o_proj.linear",
|
| 112 |
+
"model.vision_tower.encoder.layers.12.mlp.gate_proj.linear",
|
| 113 |
+
"model.vision_tower.encoder.layers.12.mlp.up_proj.linear",
|
| 114 |
+
"model.vision_tower.encoder.layers.12.mlp.down_proj.linear",
|
| 115 |
+
"model.vision_tower.encoder.layers.13.self_attn.q_proj.linear",
|
| 116 |
+
"model.vision_tower.encoder.layers.13.self_attn.k_proj.linear",
|
| 117 |
+
"model.vision_tower.encoder.layers.13.self_attn.v_proj.linear",
|
| 118 |
+
"model.vision_tower.encoder.layers.13.self_attn.o_proj.linear",
|
| 119 |
+
"model.vision_tower.encoder.layers.13.mlp.gate_proj.linear",
|
| 120 |
+
"model.vision_tower.encoder.layers.13.mlp.up_proj.linear",
|
| 121 |
+
"model.vision_tower.encoder.layers.13.mlp.down_proj.linear",
|
| 122 |
+
"model.vision_tower.encoder.layers.14.self_attn.q_proj.linear",
|
| 123 |
+
"model.vision_tower.encoder.layers.14.self_attn.k_proj.linear",
|
| 124 |
+
"model.vision_tower.encoder.layers.14.self_attn.v_proj.linear",
|
| 125 |
+
"model.vision_tower.encoder.layers.14.self_attn.o_proj.linear",
|
| 126 |
+
"model.vision_tower.encoder.layers.14.mlp.gate_proj.linear",
|
| 127 |
+
"model.vision_tower.encoder.layers.14.mlp.up_proj.linear",
|
| 128 |
+
"model.vision_tower.encoder.layers.14.mlp.down_proj.linear",
|
| 129 |
+
"model.vision_tower.encoder.layers.15.self_attn.q_proj.linear",
|
| 130 |
+
"model.vision_tower.encoder.layers.15.self_attn.k_proj.linear",
|
| 131 |
+
"model.vision_tower.encoder.layers.15.self_attn.v_proj.linear",
|
| 132 |
+
"model.vision_tower.encoder.layers.15.self_attn.o_proj.linear",
|
| 133 |
+
"model.vision_tower.encoder.layers.15.mlp.gate_proj.linear",
|
| 134 |
+
"model.vision_tower.encoder.layers.15.mlp.up_proj.linear",
|
| 135 |
+
"model.vision_tower.encoder.layers.15.mlp.down_proj.linear",
|
| 136 |
+
"model.vision_tower.encoder.layers.16.self_attn.q_proj.linear",
|
| 137 |
+
"model.vision_tower.encoder.layers.16.self_attn.k_proj.linear",
|
| 138 |
+
"model.vision_tower.encoder.layers.16.self_attn.v_proj.linear",
|
| 139 |
+
"model.vision_tower.encoder.layers.16.self_attn.o_proj.linear",
|
| 140 |
+
"model.vision_tower.encoder.layers.16.mlp.gate_proj.linear",
|
| 141 |
+
"model.vision_tower.encoder.layers.16.mlp.up_proj.linear",
|
| 142 |
+
"model.vision_tower.encoder.layers.16.mlp.down_proj.linear",
|
| 143 |
+
"model.vision_tower.encoder.layers.17.self_attn.q_proj.linear",
|
| 144 |
+
"model.vision_tower.encoder.layers.17.self_attn.k_proj.linear",
|
| 145 |
+
"model.vision_tower.encoder.layers.17.self_attn.v_proj.linear",
|
| 146 |
+
"model.vision_tower.encoder.layers.17.self_attn.o_proj.linear",
|
| 147 |
+
"model.vision_tower.encoder.layers.17.mlp.gate_proj.linear",
|
| 148 |
+
"model.vision_tower.encoder.layers.17.mlp.up_proj.linear",
|
| 149 |
+
"model.vision_tower.encoder.layers.17.mlp.down_proj.linear",
|
| 150 |
+
"model.vision_tower.encoder.layers.18.self_attn.q_proj.linear",
|
| 151 |
+
"model.vision_tower.encoder.layers.18.self_attn.k_proj.linear",
|
| 152 |
+
"model.vision_tower.encoder.layers.18.self_attn.v_proj.linear",
|
| 153 |
+
"model.vision_tower.encoder.layers.18.self_attn.o_proj.linear",
|
| 154 |
+
"model.vision_tower.encoder.layers.18.mlp.gate_proj.linear",
|
| 155 |
+
"model.vision_tower.encoder.layers.18.mlp.up_proj.linear",
|
| 156 |
+
"model.vision_tower.encoder.layers.18.mlp.down_proj.linear",
|
| 157 |
+
"model.vision_tower.encoder.layers.19.self_attn.q_proj.linear",
|
| 158 |
+
"model.vision_tower.encoder.layers.19.self_attn.k_proj.linear",
|
| 159 |
+
"model.vision_tower.encoder.layers.19.self_attn.v_proj.linear",
|
| 160 |
+
"model.vision_tower.encoder.layers.19.self_attn.o_proj.linear",
|
| 161 |
+
"model.vision_tower.encoder.layers.19.mlp.gate_proj.linear",
|
| 162 |
+
"model.vision_tower.encoder.layers.19.mlp.up_proj.linear",
|
| 163 |
+
"model.vision_tower.encoder.layers.19.mlp.down_proj.linear",
|
| 164 |
+
"model.vision_tower.encoder.layers.20.self_attn.q_proj.linear",
|
| 165 |
+
"model.vision_tower.encoder.layers.20.self_attn.k_proj.linear",
|
| 166 |
+
"model.vision_tower.encoder.layers.20.self_attn.v_proj.linear",
|
| 167 |
+
"model.vision_tower.encoder.layers.20.self_attn.o_proj.linear",
|
| 168 |
+
"model.vision_tower.encoder.layers.20.mlp.gate_proj.linear",
|
| 169 |
+
"model.vision_tower.encoder.layers.20.mlp.up_proj.linear",
|
| 170 |
+
"model.vision_tower.encoder.layers.20.mlp.down_proj.linear",
|
| 171 |
+
"model.vision_tower.encoder.layers.21.self_attn.q_proj.linear",
|
| 172 |
+
"model.vision_tower.encoder.layers.21.self_attn.k_proj.linear",
|
| 173 |
+
"model.vision_tower.encoder.layers.21.self_attn.v_proj.linear",
|
| 174 |
+
"model.vision_tower.encoder.layers.21.self_attn.o_proj.linear",
|
| 175 |
+
"model.vision_tower.encoder.layers.21.mlp.gate_proj.linear",
|
| 176 |
+
"model.vision_tower.encoder.layers.21.mlp.up_proj.linear",
|
| 177 |
+
"model.vision_tower.encoder.layers.21.mlp.down_proj.linear",
|
| 178 |
+
"model.vision_tower.encoder.layers.22.self_attn.q_proj.linear",
|
| 179 |
+
"model.vision_tower.encoder.layers.22.self_attn.k_proj.linear",
|
| 180 |
+
"model.vision_tower.encoder.layers.22.self_attn.v_proj.linear",
|
| 181 |
+
"model.vision_tower.encoder.layers.22.self_attn.o_proj.linear",
|
| 182 |
+
"model.vision_tower.encoder.layers.22.mlp.gate_proj.linear",
|
| 183 |
+
"model.vision_tower.encoder.layers.22.mlp.up_proj.linear",
|
| 184 |
+
"model.vision_tower.encoder.layers.22.mlp.down_proj.linear",
|
| 185 |
+
"model.vision_tower.encoder.layers.23.self_attn.q_proj.linear",
|
| 186 |
+
"model.vision_tower.encoder.layers.23.self_attn.k_proj.linear",
|
| 187 |
+
"model.vision_tower.encoder.layers.23.self_attn.v_proj.linear",
|
| 188 |
+
"model.vision_tower.encoder.layers.23.self_attn.o_proj.linear",
|
| 189 |
+
"model.vision_tower.encoder.layers.23.mlp.gate_proj.linear",
|
| 190 |
+
"model.vision_tower.encoder.layers.23.mlp.up_proj.linear",
|
| 191 |
+
"model.vision_tower.encoder.layers.23.mlp.down_proj.linear",
|
| 192 |
+
"model.vision_tower.encoder.layers.24.self_attn.q_proj.linear",
|
| 193 |
+
"model.vision_tower.encoder.layers.24.self_attn.k_proj.linear",
|
| 194 |
+
"model.vision_tower.encoder.layers.24.self_attn.v_proj.linear",
|
| 195 |
+
"model.vision_tower.encoder.layers.24.self_attn.o_proj.linear",
|
| 196 |
+
"model.vision_tower.encoder.layers.24.mlp.gate_proj.linear",
|
| 197 |
+
"model.vision_tower.encoder.layers.24.mlp.up_proj.linear",
|
| 198 |
+
"model.vision_tower.encoder.layers.24.mlp.down_proj.linear",
|
| 199 |
+
"model.vision_tower.encoder.layers.25.self_attn.q_proj.linear",
|
| 200 |
+
"model.vision_tower.encoder.layers.25.self_attn.k_proj.linear",
|
| 201 |
+
"model.vision_tower.encoder.layers.25.self_attn.v_proj.linear",
|
| 202 |
+
"model.vision_tower.encoder.layers.25.self_attn.o_proj.linear",
|
| 203 |
+
"model.vision_tower.encoder.layers.25.mlp.gate_proj.linear",
|
| 204 |
+
"model.vision_tower.encoder.layers.25.mlp.up_proj.linear",
|
| 205 |
+
"model.vision_tower.encoder.layers.25.mlp.down_proj.linear",
|
| 206 |
+
"model.vision_tower.encoder.layers.26.self_attn.q_proj.linear",
|
| 207 |
+
"model.vision_tower.encoder.layers.26.self_attn.k_proj.linear",
|
| 208 |
+
"model.vision_tower.encoder.layers.26.self_attn.v_proj.linear",
|
| 209 |
+
"model.vision_tower.encoder.layers.26.self_attn.o_proj.linear",
|
| 210 |
+
"model.vision_tower.encoder.layers.26.mlp.gate_proj.linear",
|
| 211 |
+
"model.vision_tower.encoder.layers.26.mlp.up_proj.linear",
|
| 212 |
+
"model.vision_tower.encoder.layers.26.mlp.down_proj.linear",
|
| 213 |
+
"model.embed_vision.embedding_projection",
|
| 214 |
+
"lm_head"
|
| 215 |
+
],
|
| 216 |
+
"export": {
|
| 217 |
+
"kv_cache_group": [],
|
| 218 |
+
"min_kv_scale": 0.0,
|
| 219 |
+
"pack_method": "order",
|
| 220 |
+
"weight_format": "real_quantized",
|
| 221 |
+
"weight_merge_groups": null
|
| 222 |
+
},
|
| 223 |
+
"global_quant_config": {
|
| 224 |
+
"bias": null,
|
| 225 |
+
"input_tensors": {
|
| 226 |
+
"ch_axis": 1,
|
| 227 |
+
"dtype": "int8",
|
| 228 |
+
"group_size": null,
|
| 229 |
+
"is_dynamic": true,
|
| 230 |
+
"is_scale_quant": false,
|
| 231 |
+
"mx_element_dtype": null,
|
| 232 |
+
"observer_cls": "PerChannelMinMaxObserver",
|
| 233 |
+
"qscheme": "per_channel",
|
| 234 |
+
"round_method": "round",
|
| 235 |
+
"scale_calculation_mode": null,
|
| 236 |
+
"scale_format": null,
|
| 237 |
+
"scale_type": "float",
|
| 238 |
+
"symmetric": true
|
| 239 |
+
},
|
| 240 |
+
"output_tensors": null,
|
| 241 |
+
"target_device": null,
|
| 242 |
+
"weight": {
|
| 243 |
+
"ch_axis": 0,
|
| 244 |
+
"dtype": "int8",
|
| 245 |
+
"group_size": null,
|
| 246 |
+
"is_dynamic": false,
|
| 247 |
+
"is_scale_quant": false,
|
| 248 |
+
"mx_element_dtype": null,
|
| 249 |
+
"observer_cls": "PerChannelMinMaxObserver",
|
| 250 |
+
"qscheme": "per_channel",
|
| 251 |
+
"round_method": "round",
|
| 252 |
+
"scale_calculation_mode": null,
|
| 253 |
+
"scale_format": null,
|
| 254 |
+
"scale_type": "float",
|
| 255 |
+
"symmetric": true
|
| 256 |
+
}
|
| 257 |
+
},
|
| 258 |
+
"kv_cache_post_rope": false,
|
| 259 |
+
"kv_cache_quant_config": {},
|
| 260 |
+
"layer_quant_config": {},
|
| 261 |
+
"layer_type_quant_config": {},
|
| 262 |
+
"quant_method": "quark",
|
| 263 |
+
"quant_mode": "eager_mode",
|
| 264 |
+
"softmax_quant_spec": null,
|
| 265 |
+
"version": "0.11.1"
|
| 266 |
+
},
|
| 267 |
+
"text_config": {
|
| 268 |
+
"attention_bias": false,
|
| 269 |
+
"attention_dropout": 0.0,
|
| 270 |
+
"attention_k_eq_v": true,
|
| 271 |
+
"bos_token_id": 2,
|
| 272 |
+
"dtype": "bfloat16",
|
| 273 |
+
"enable_moe_block": false,
|
| 274 |
+
"eos_token_id": 1,
|
| 275 |
+
"expert_intermediate_size": null,
|
| 276 |
+
"final_logit_softcapping": 30.0,
|
| 277 |
+
"global_head_dim": 512,
|
| 278 |
+
"head_dim": 256,
|
| 279 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 280 |
+
"hidden_size": 5376,
|
| 281 |
+
"hidden_size_per_layer_input": 0,
|
| 282 |
+
"initializer_range": 0.02,
|
| 283 |
+
"intermediate_size": 21504,
|
| 284 |
+
"layer_types": [
|
| 285 |
+
"sliding_attention",
|
| 286 |
+
"sliding_attention",
|
| 287 |
+
"sliding_attention",
|
| 288 |
+
"sliding_attention",
|
| 289 |
+
"sliding_attention",
|
| 290 |
+
"full_attention",
|
| 291 |
+
"sliding_attention",
|
| 292 |
+
"sliding_attention",
|
| 293 |
+
"sliding_attention",
|
| 294 |
+
"sliding_attention",
|
| 295 |
+
"sliding_attention",
|
| 296 |
+
"full_attention",
|
| 297 |
+
"sliding_attention",
|
| 298 |
+
"sliding_attention",
|
| 299 |
+
"sliding_attention",
|
| 300 |
+
"sliding_attention",
|
| 301 |
+
"sliding_attention",
|
| 302 |
+
"full_attention",
|
| 303 |
+
"sliding_attention",
|
| 304 |
+
"sliding_attention",
|
| 305 |
+
"sliding_attention",
|
| 306 |
+
"sliding_attention",
|
| 307 |
+
"sliding_attention",
|
| 308 |
+
"full_attention",
|
| 309 |
+
"sliding_attention",
|
| 310 |
+
"sliding_attention",
|
| 311 |
+
"sliding_attention",
|
| 312 |
+
"sliding_attention",
|
| 313 |
+
"sliding_attention",
|
| 314 |
+
"full_attention",
|
| 315 |
+
"sliding_attention",
|
| 316 |
+
"sliding_attention",
|
| 317 |
+
"sliding_attention",
|
| 318 |
+
"sliding_attention",
|
| 319 |
+
"sliding_attention",
|
| 320 |
+
"full_attention",
|
| 321 |
+
"sliding_attention",
|
| 322 |
+
"sliding_attention",
|
| 323 |
+
"sliding_attention",
|
| 324 |
+
"sliding_attention",
|
| 325 |
+
"sliding_attention",
|
| 326 |
+
"full_attention",
|
| 327 |
+
"sliding_attention",
|
| 328 |
+
"sliding_attention",
|
| 329 |
+
"sliding_attention",
|
| 330 |
+
"sliding_attention",
|
| 331 |
+
"sliding_attention",
|
| 332 |
+
"full_attention",
|
| 333 |
+
"sliding_attention",
|
| 334 |
+
"sliding_attention",
|
| 335 |
+
"sliding_attention",
|
| 336 |
+
"sliding_attention",
|
| 337 |
+
"sliding_attention",
|
| 338 |
+
"full_attention",
|
| 339 |
+
"sliding_attention",
|
| 340 |
+
"sliding_attention",
|
| 341 |
+
"sliding_attention",
|
| 342 |
+
"sliding_attention",
|
| 343 |
+
"sliding_attention",
|
| 344 |
+
"full_attention"
|
| 345 |
+
],
|
| 346 |
+
"max_position_embeddings": 262144,
|
| 347 |
+
"model_type": "gemma4_text",
|
| 348 |
+
"moe_intermediate_size": null,
|
| 349 |
+
"num_attention_heads": 32,
|
| 350 |
+
"num_experts": null,
|
| 351 |
+
"num_global_key_value_heads": 4,
|
| 352 |
+
"num_hidden_layers": 60,
|
| 353 |
+
"num_key_value_heads": 16,
|
| 354 |
+
"num_kv_shared_layers": 0,
|
| 355 |
+
"pad_token_id": 0,
|
| 356 |
+
"rms_norm_eps": 1e-06,
|
| 357 |
+
"rope_parameters": {
|
| 358 |
+
"full_attention": {
|
| 359 |
+
"partial_rotary_factor": 0.25,
|
| 360 |
+
"rope_theta": 1000000.0,
|
| 361 |
+
"rope_type": "proportional"
|
| 362 |
+
},
|
| 363 |
+
"sliding_attention": {
|
| 364 |
+
"rope_theta": 10000.0,
|
| 365 |
+
"rope_type": "default"
|
| 366 |
+
}
|
| 367 |
+
},
|
| 368 |
+
"sliding_window": 1024,
|
| 369 |
+
"tie_word_embeddings": true,
|
| 370 |
+
"top_k_experts": null,
|
| 371 |
+
"use_bidirectional_attention": "vision",
|
| 372 |
+
"use_cache": true,
|
| 373 |
+
"use_double_wide_mlp": false,
|
| 374 |
+
"vocab_size": 262144,
|
| 375 |
+
"vocab_size_per_layer_input": 262144
|
| 376 |
+
},
|
| 377 |
+
"tie_word_embeddings": true,
|
| 378 |
+
"transformers_version": "5.6.0.dev0",
|
| 379 |
+
"video_token_id": 258884,
|
| 380 |
+
"vision_config": {
|
| 381 |
+
"_name_or_path": "",
|
| 382 |
+
"architectures": null,
|
| 383 |
+
"attention_bias": false,
|
| 384 |
+
"attention_dropout": 0.0,
|
| 385 |
+
"chunk_size_feed_forward": 0,
|
| 386 |
+
"default_output_length": 280,
|
| 387 |
+
"dtype": "bfloat16",
|
| 388 |
+
"global_head_dim": 72,
|
| 389 |
+
"head_dim": 72,
|
| 390 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 391 |
+
"hidden_size": 1152,
|
| 392 |
+
"id2label": {
|
| 393 |
+
"0": "LABEL_0",
|
| 394 |
+
"1": "LABEL_1"
|
| 395 |
+
},
|
| 396 |
+
"initializer_range": 0.02,
|
| 397 |
+
"intermediate_size": 4304,
|
| 398 |
+
"is_encoder_decoder": false,
|
| 399 |
+
"label2id": {
|
| 400 |
+
"LABEL_0": 0,
|
| 401 |
+
"LABEL_1": 1
|
| 402 |
+
},
|
| 403 |
+
"max_position_embeddings": 131072,
|
| 404 |
+
"model_type": "gemma4_vision",
|
| 405 |
+
"num_attention_heads": 16,
|
| 406 |
+
"num_hidden_layers": 27,
|
| 407 |
+
"num_key_value_heads": 16,
|
| 408 |
+
"output_attentions": false,
|
| 409 |
+
"output_hidden_states": false,
|
| 410 |
+
"patch_size": 16,
|
| 411 |
+
"pooling_kernel_size": 3,
|
| 412 |
+
"position_embedding_size": 10240,
|
| 413 |
+
"problem_type": null,
|
| 414 |
+
"return_dict": true,
|
| 415 |
+
"rms_norm_eps": 1e-06,
|
| 416 |
+
"rope_parameters": {
|
| 417 |
+
"rope_theta": 100.0,
|
| 418 |
+
"rope_type": "default"
|
| 419 |
+
},
|
| 420 |
+
"standardize": true,
|
| 421 |
+
"use_clipped_linears": false
|
| 422 |
+
},
|
| 423 |
+
"vision_soft_tokens_per_image": 280
|
| 424 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 2,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
1,
|
| 6 |
+
106,
|
| 7 |
+
50
|
| 8 |
+
],
|
| 9 |
+
"pad_token_id": 0,
|
| 10 |
+
"temperature": 1.0,
|
| 11 |
+
"top_k": 64,
|
| 12 |
+
"top_p": 0.95,
|
| 13 |
+
"transformers_version": "5.6.0.dev0"
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2bc23ef9a67dd909effef1d26b6fc2d9b13def70d0aa2f4ccccb07b512c41aaa
|
| 3 |
+
size 33268121104
|
processor_config.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_ms_per_token": 40,
|
| 3 |
+
"audio_seq_length": 750,
|
| 4 |
+
"feature_extractor": {
|
| 5 |
+
"dither": 0.0,
|
| 6 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 7 |
+
"feature_size": 128,
|
| 8 |
+
"fft_length": 512,
|
| 9 |
+
"fft_overdrive": false,
|
| 10 |
+
"frame_length": 320,
|
| 11 |
+
"hop_length": 160,
|
| 12 |
+
"input_scale_factor": 1.0,
|
| 13 |
+
"max_frequency": 8000.0,
|
| 14 |
+
"mel_floor": 0.001,
|
| 15 |
+
"min_frequency": 0.0,
|
| 16 |
+
"padding_side": "right",
|
| 17 |
+
"padding_value": 0.0,
|
| 18 |
+
"per_bin_mean": null,
|
| 19 |
+
"per_bin_stddev": null,
|
| 20 |
+
"preemphasis": 0.0,
|
| 21 |
+
"preemphasis_htk_flavor": true,
|
| 22 |
+
"return_attention_mask": true,
|
| 23 |
+
"sampling_rate": 16000
|
| 24 |
+
},
|
| 25 |
+
"image_processor": {
|
| 26 |
+
"do_convert_rgb": true,
|
| 27 |
+
"do_normalize": false,
|
| 28 |
+
"do_rescale": true,
|
| 29 |
+
"do_resize": true,
|
| 30 |
+
"image_mean": [
|
| 31 |
+
0.0,
|
| 32 |
+
0.0,
|
| 33 |
+
0.0
|
| 34 |
+
],
|
| 35 |
+
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
+
"image_seq_length": 280,
|
| 37 |
+
"image_std": [
|
| 38 |
+
1.0,
|
| 39 |
+
1.0,
|
| 40 |
+
1.0
|
| 41 |
+
],
|
| 42 |
+
"max_soft_tokens": 280,
|
| 43 |
+
"patch_size": 16,
|
| 44 |
+
"pooling_kernel_size": 3,
|
| 45 |
+
"resample": 3,
|
| 46 |
+
"rescale_factor": 0.00392156862745098
|
| 47 |
+
},
|
| 48 |
+
"image_seq_length": 280,
|
| 49 |
+
"processor_class": "Gemma4Processor",
|
| 50 |
+
"video_processor": {
|
| 51 |
+
"do_convert_rgb": true,
|
| 52 |
+
"do_normalize": true,
|
| 53 |
+
"do_rescale": true,
|
| 54 |
+
"do_resize": true,
|
| 55 |
+
"do_sample_frames": true,
|
| 56 |
+
"image_mean": [
|
| 57 |
+
0.0,
|
| 58 |
+
0.0,
|
| 59 |
+
0.0
|
| 60 |
+
],
|
| 61 |
+
"image_std": [
|
| 62 |
+
1.0,
|
| 63 |
+
1.0,
|
| 64 |
+
1.0
|
| 65 |
+
],
|
| 66 |
+
"max_soft_tokens": 70,
|
| 67 |
+
"num_frames": 32,
|
| 68 |
+
"patch_size": 16,
|
| 69 |
+
"pooling_kernel_size": 3,
|
| 70 |
+
"resample": 3,
|
| 71 |
+
"rescale_factor": 0.00392156862745098,
|
| 72 |
+
"return_metadata": false,
|
| 73 |
+
"video_processor_type": "Gemma4VideoProcessor"
|
| 74 |
+
}
|
| 75 |
+
}
|
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,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"soc_token": "<|channel>",
|
| 89 |
+
"sot_token": "<|turn>",
|
| 90 |
+
"stc_token": "<|tool_call>",
|
| 91 |
+
"std_token": "<|tool>",
|
| 92 |
+
"str_token": "<|tool_response>",
|
| 93 |
+
"think_token": "<|think|>",
|
| 94 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 95 |
+
"unk_token": "<unk>"
|
| 96 |
+
}
|