Text Generation
Transformers
Safetensors
PEFT
English
gemma4
image-text-to-text
merged
lora
qlora
sft
trl
code
java
junit
unit-test-generation
mutation-testing
vllm
conversational
Eval Results (legacy)
Instructions to use SASVAAI/gemma-4-26b-jUnitTestGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SASVAAI/gemma-4-26b-jUnitTestGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SASVAAI/gemma-4-26b-jUnitTestGeneration") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("SASVAAI/gemma-4-26b-jUnitTestGeneration") model = AutoModelForMultimodalLM.from_pretrained("SASVAAI/gemma-4-26b-jUnitTestGeneration", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use SASVAAI/gemma-4-26b-jUnitTestGeneration with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SASVAAI/gemma-4-26b-jUnitTestGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SASVAAI/gemma-4-26b-jUnitTestGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SASVAAI/gemma-4-26b-jUnitTestGeneration", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SASVAAI/gemma-4-26b-jUnitTestGeneration
- SGLang
How to use SASVAAI/gemma-4-26b-jUnitTestGeneration 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 "SASVAAI/gemma-4-26b-jUnitTestGeneration" \ --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": "SASVAAI/gemma-4-26b-jUnitTestGeneration", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "SASVAAI/gemma-4-26b-jUnitTestGeneration" \ --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": "SASVAAI/gemma-4-26b-jUnitTestGeneration", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SASVAAI/gemma-4-26b-jUnitTestGeneration with Docker Model Runner:
docker model run hf.co/SASVAAI/gemma-4-26b-jUnitTestGeneration
Add merged Gemma-4-26B-A4B JUnit test generator, LoRA adapter and model card
#1
by aaron-psl - opened
- .gitattributes +2 -0
- LICENSE +202 -0
- README.md +622 -1
- adapter/README.md +23 -0
- adapter/adapter_config.json +46 -0
- adapter/adapter_model.safetensors +3 -0
- adapter/all_results.json +7 -0
- adapter/chat_template.jinja +390 -0
- adapter/eval_results.json +11 -0
- adapter/predictions.jsonl +0 -0
- adapter/tokenizer.json +3 -0
- adapter/tokenizer_config.json +142 -0
- adapter/train_results.json +7 -0
- adapter/trainer_state.json +504 -0
- chat_template.jinja +390 -0
- config.json +146 -0
- generation_config.json +14 -0
- model-00001-of-00011.safetensors +3 -0
- model-00002-of-00011.safetensors +3 -0
- model-00003-of-00011.safetensors +3 -0
- model-00004-of-00011.safetensors +3 -0
- model-00005-of-00011.safetensors +3 -0
- model-00006-of-00011.safetensors +3 -0
- model-00007-of-00011.safetensors +3 -0
- model-00008-of-00011.safetensors +3 -0
- model-00009-of-00011.safetensors +3 -0
- model-00010-of-00011.safetensors +3 -0
- model-00011-of-00011.safetensors +3 -0
- model.safetensors.index.json +0 -0
- processor_config.json +75 -0
- tokenizer.json +3 -0
- tokenizer_config.json +142 -0
.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 |
+
adapter/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ONS 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 2026 Alibaba Cloud
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
CHANGED
|
@@ -1,3 +1,624 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
# ---- Identity -------------------------------------------------------------
|
| 3 |
+
base_model: google/gemma-4-26B-A4B-it
|
| 4 |
+
base_model_relation: merge
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
license: apache-2.0 # verified: inherited from google/gemma-4-26B-A4B-it, whose
|
| 10 |
+
# Hub metadata declares license:apache-2.0 (license_link
|
| 11 |
+
# https://ai.google.dev/gemma/docs/gemma_4_license). The base
|
| 12 |
+
# repo ships no LICENSE file; the Apache-2.0 text is included
|
| 13 |
+
# here verbatim. Training data is methods2test (MIT); the
|
| 14 |
+
# Java projects it was mined from carry their own licences
|
| 15 |
+
# (see Training details).
|
| 16 |
+
|
| 17 |
+
# ---- Discovery ------------------------------------------------------------
|
| 18 |
+
tags:
|
| 19 |
+
- merged
|
| 20 |
+
- lora
|
| 21 |
+
- qlora
|
| 22 |
+
- sft
|
| 23 |
+
- trl
|
| 24 |
+
- peft
|
| 25 |
+
- text-generation
|
| 26 |
+
- code
|
| 27 |
+
- java
|
| 28 |
+
- junit
|
| 29 |
+
- unit-test-generation
|
| 30 |
+
- mutation-testing
|
| 31 |
+
- vllm
|
| 32 |
+
|
| 33 |
+
metrics:
|
| 34 |
+
- pass@k
|
| 35 |
+
- accuracy
|
| 36 |
+
|
| 37 |
+
# ---- Structured evaluation ------------------------------------------------
|
| 38 |
+
model-index:
|
| 39 |
+
- name: gemma-4-26b-jUnitTestGeneration
|
| 40 |
+
results:
|
| 41 |
+
- task:
|
| 42 |
+
type: text-generation
|
| 43 |
+
name: Focal Java method to one JUnit test method (compile, pass, kill a PIT mutant)
|
| 44 |
+
dataset:
|
| 45 |
+
type: andstor/methods2test_runnable
|
| 46 |
+
name: methods2test runnable test split, 332 harness-verified rows from 86 Maven projects (project-disjoint from training)
|
| 47 |
+
split: test
|
| 48 |
+
revision: ed8cded666b2f7d101ba04a7a8d121b6249d8c39
|
| 49 |
+
metrics:
|
| 50 |
+
- type: pass@k
|
| 51 |
+
name: pass@5 (greedy + 4 samples at T=0.8; any candidate compiles, passes and kills a PIT mutant) — the search metric
|
| 52 |
+
value: 0.503012
|
| 53 |
+
- type: pass@1
|
| 54 |
+
name: pass@1, greedy (compiles, passes and kills a PIT mutant)
|
| 55 |
+
value: 0.246988
|
| 56 |
+
- type: accuracy
|
| 57 |
+
name: Greedy compile rate (mvn test-compile succeeds with the method inserted)
|
| 58 |
+
value: 0.421687
|
| 59 |
+
- type: accuracy
|
| 60 |
+
name: Greedy mean PIT kill fraction on the focal method's mutants
|
| 61 |
+
value: 0.206093
|
| 62 |
---
|
| 63 |
+
|
| 64 |
+
# Gemma-4-26B-A4B JUnit Test Generator
|
| 65 |
+
|
| 66 |
+
Given a Java focal method, a skeleton of its class, and the existing test class
|
| 67 |
+
the new test will be inserted into, emits **one JUnit test method** starting
|
| 68 |
+
with `@Test`. A test counts as correct only if it compiles in the real project,
|
| 69 |
+
passes against the real implementation, and kills at least one
|
| 70 |
+
[PIT](https://pitest.org/) mutant of the focal method.
|
| 71 |
+
|
| 72 |
+
This repository holds **two forms of the same model**:
|
| 73 |
+
|
| 74 |
+
| Where | What | Use it when |
|
| 75 |
+
|---|---|---|
|
| 76 |
+
| repository root | [google/gemma-4-26B-A4B-it](https://huggingface.co/google/gemma-4-26B-A4B-it) with the LoRA merged in, bfloat16, 11 safetensors shards (~51.6 GB) | you want one directory to load or serve, e.g. with vLLM |
|
| 77 |
+
| `adapter/` | the LoRA adapter itself (35.5 MiB, QLoRA-trained) plus the training run's state, results and every validation prediction with its harness verdict | you already have the base model, or need the base in 4-bit on one GPU |
|
| 78 |
+
|
| 79 |
+
The adapter was trained with **QLoRA (4-bit NF4 base, bf16 compute)** via
|
| 80 |
+
[TRL](https://github.com/huggingface/trl) SFT and merged with
|
| 81 |
+
`PeftModel.merge_and_unload`. Every number in this card was measured on the
|
| 82 |
+
merged weights at the root, served with vLLM, and graded by building and
|
| 83 |
+
running each test inside its own Maven project.
|
| 84 |
+
|
| 85 |
+
> **The headline number assumes you can run the tests.** 0.503 is **pass@5**:
|
| 86 |
+
> the share of 332 held-out focal methods for which *at least one of five*
|
| 87 |
+
> candidates (one greedy, four sampled at temperature 0.8) compiles, passes and
|
| 88 |
+
> kills a mutant. A single greedy answer succeeds on **0.247**. Use 0.503 only
|
| 89 |
+
> if your deployment generates several candidates, runs them, and keeps one
|
| 90 |
+
> that passes; otherwise the honest figure is 0.247. The untuned base model was
|
| 91 |
+
> never scored on these rows, so this card does not establish how much of
|
| 92 |
+
> either number the fine-tune is responsible for. Read
|
| 93 |
+
> [How these values were chosen](#how-these-values-were-chosen) and
|
| 94 |
+
> [Evaluation](#evaluation) before quoting anything.
|
| 95 |
+
|
| 96 |
+
## Model details
|
| 97 |
+
|
| 98 |
+
| | |
|
| 99 |
+
|---|---|
|
| 100 |
+
| Developed by | SASVA AI Model Cognition Labs (MCL) Team |
|
| 101 |
+
| Base model | [`google/gemma-4-26B-A4B-it`](https://huggingface.co/google/gemma-4-26B-A4B-it) |
|
| 102 |
+
| Base revision | `4d7ae4984b7db7de8f8457170b3f1a419ee76d52` |
|
| 103 |
+
| Base parameters | 25,805,936,206 total (Hub safetensors metadata); mixture-of-experts, ~4B active per token |
|
| 104 |
+
| Architecture family | `gemma4` (`Gemma4ForConditionalGeneration`; text tower with 30 layers, 128 experts, hidden size 2816, vocabulary 262,144) |
|
| 105 |
+
| Adaptation | LoRA (`r=16`, `alpha=32`, `dropout=0.05`, rsLoRA off, DoRA off), merged into the root weights; adapter kept under `adapter/` |
|
| 106 |
+
| Trainable modules | `q_proj`, `k_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj` on all 30 layers; `v_proj` on the 25 sliding-window layers (see below) |
|
| 107 |
+
| Excluded modules | `.*vision_tower.*` (the vision tower is untouched; training and evaluation were text-only) |
|
| 108 |
+
| Training method | `qlora` (`--load-in-4bit`, run 14 / trial 1) |
|
| 109 |
+
| Refinement | none |
|
| 110 |
+
| Precision | training: 4-bit NF4 base with double quantisation, bf16 compute; adapter saved in bfloat16; root weights: bfloat16 merge |
|
| 111 |
+
| Language | English prompts, Java output |
|
| 112 |
+
| License | Apache-2.0 (inherited from the base model); training data methods2test is MIT |
|
| 113 |
+
|
| 114 |
+
Trainable parameters: **18,585,600** across 205 modules, 0.072% of the base
|
| 115 |
+
model's parameters. `adapter/adapter_model.safetensors` is 37,232,104 bytes
|
| 116 |
+
(410 tensors, `lora_A` + `lora_B` per module, all bfloat16). Every tensor sits
|
| 117 |
+
under `base_model.model.model.language_model`.
|
| 118 |
+
|
| 119 |
+
**One Gemma 4 structural fact shapes the module list.** The 30 text layers
|
| 120 |
+
alternate 5 sliding-window attention layers with one full-attention layer, so
|
| 121 |
+
layers 5, 11, 17, 23 and 29 are global attention, and the global layers have
|
| 122 |
+
**no `v_proj` weight**. PEFT therefore attached `v_proj` adapters to 25 layers
|
| 123 |
+
and the other six projections to 30. The tensor counts match: 60 per projection
|
| 124 |
+
for 30 layers × A/B, 50 for `v_proj`.
|
| 125 |
+
|
| 126 |
+
## Intended use
|
| 127 |
+
|
| 128 |
+
**Direct use.** Draft a unit test for one Java method, for a developer to
|
| 129 |
+
review, run and keep. The model is most useful inside a loop that compiles and
|
| 130 |
+
runs its output: generate several candidates, run them, keep one that passes.
|
| 131 |
+
That loop is what pass@5 measures.
|
| 132 |
+
|
| 133 |
+
The model was trained on a specific prompt shape and that shape is part of the
|
| 134 |
+
contract:
|
| 135 |
+
|
| 136 |
+
- System prompt (verbatim, from the training and evaluation command lines):
|
| 137 |
+
*"You are a Java test generation expert. Given a focal method with its class
|
| 138 |
+
skeleton and target test class, write a single JUnit test method (starting
|
| 139 |
+
with `@Test`) that compiles, passes against the correct implementation, and
|
| 140 |
+
is designed to kill a PIT mutant by testing boundary conditions, edge cases,
|
| 141 |
+
and specific logic branches. Output only the raw Java test method starting
|
| 142 |
+
with `@Test`, with no explanation or surrounding text."*
|
| 143 |
+
- User turn: the instruction, a blank line, then the context block inside a
|
| 144 |
+
bare ```` ``` ```` fence (`instruction + "\n\n```\n" + context + "\n```"`).
|
| 145 |
+
The instruction is, with the three names filled in:
|
| 146 |
+
*"Write one JUnit test method for the focal method `{focal_method}` of class
|
| 147 |
+
`{focal_class}`. The method will be inserted into the existing test class
|
| 148 |
+
`{test_class}` shown after the focal class, so use only what is visible there
|
| 149 |
+
and in the focal class. Output only the Java test method, starting with
|
| 150 |
+
@Test. No class declaration, no imports, no explanation."*
|
| 151 |
+
- The context block is, in this order:
|
| 152 |
+
1. `// Focal class: <path>` and the focal class skeleton: fields, every
|
| 153 |
+
method's signature, and the full body of the focal method only.
|
| 154 |
+
2. A blank line, `// Test class: <path>`.
|
| 155 |
+
3. `// Java source level: <level>`, with a reminder of what the level forbids
|
| 156 |
+
for 1.5 to 1.7 (for example `1.6 (no diamond operator <>, lambdas, method
|
| 157 |
+
references, try-with-resources, multi-catch or switch on String)`). Every
|
| 158 |
+
evaluation row has this line; 38% of training rows have no level because
|
| 159 |
+
their parent POMs no longer resolve.
|
| 160 |
+
4. The test class's `import` lines as they are at the project's commit.
|
| 161 |
+
5. The test class skeleton: its declaration and fields, no test methods.
|
| 162 |
+
- Applied through the tokenizer's chat template (`chat_template.jinja`,
|
| 163 |
+
shipped in this repo) with `add_generation_prompt=True`. Do not concatenate
|
| 164 |
+
strings by hand.
|
| 165 |
+
- The output is one Java method starting with `@Test`, meant to be inserted
|
| 166 |
+
into the test class as-is. It may only use imports already in the test
|
| 167 |
+
class.
|
| 168 |
+
- Greedy decoding for a single answer; the four extra pass@5 candidates were
|
| 169 |
+
sampled at `temperature=0.8`, `top_p=0.95`. Scored with
|
| 170 |
+
`max_new_tokens=1024`.
|
| 171 |
+
|
| 172 |
+
**Out-of-scope use.** Generating whole test classes or test suites. Projects
|
| 173 |
+
that are not Maven, or that need a JDK newer than the one you compile with.
|
| 174 |
+
Accepting a generated test without running it. Using "the test passes" as
|
| 175 |
+
evidence that the code under test is correct: the model writes tests that pass
|
| 176 |
+
against the current implementation, bugs included.
|
| 177 |
+
|
| 178 |
+
## How to get started
|
| 179 |
+
|
| 180 |
+
The prompt pieces are the same in every path. The example is validation row
|
| 181 |
+
292 (`ArrayMatcher.matches`, from the `arquillian/algeron` project).
|
| 182 |
+
|
| 183 |
+
```python
|
| 184 |
+
SYSTEM = (
|
| 185 |
+
"You are a Java test generation expert. Given a focal method with its class "
|
| 186 |
+
"skeleton and target test class, write a single JUnit test method (starting with "
|
| 187 |
+
"`@Test`) that compiles, passes against the correct implementation, and is designed "
|
| 188 |
+
"to kill a PIT mutant by testing boundary conditions, edge cases, and specific logic "
|
| 189 |
+
"branches. Output only the raw Java test method starting with `@Test`, with no "
|
| 190 |
+
"explanation or surrounding text."
|
| 191 |
+
)
|
| 192 |
+
INSTRUCTION = (
|
| 193 |
+
"Write one JUnit test method for the focal method `matches` of class `ArrayMatcher`. "
|
| 194 |
+
"The method will be inserted into the existing test class `ArrayMatcherTest` shown "
|
| 195 |
+
"after the focal class, so use only what is visible there and in the focal class. "
|
| 196 |
+
"Output only the Java test method, starting with @Test. No class declaration, no "
|
| 197 |
+
"imports, no explanation."
|
| 198 |
+
)
|
| 199 |
+
context = """// Focal class: pact/provider/core/src/main/java/org/arquillian/algeron/pact/provider/core/ArrayMatcher.java
|
| 200 |
+
class ArrayMatcher {
|
| 201 |
+
public static final Optional<String> firstMatch(String[] patternArray, String value);
|
| 202 |
+
|
| 203 |
+
public static final boolean matches(String[] patternArray, String value) {
|
| 204 |
+
return firstMatch(patternArray, value).isPresent();
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// Test class: pact/provider/core/src/test/java/org/arquillian/algeron/pact/provider/core/ArrayMatcherTest.java
|
| 209 |
+
// Java source level: 1.8
|
| 210 |
+
import org.junit.Test;
|
| 211 |
+
import static org.assertj.core.api.Assertions.assertThat;
|
| 212 |
+
|
| 213 |
+
class ArrayMatcherTest {
|
| 214 |
+
}"""
|
| 215 |
+
messages = [
|
| 216 |
+
{"role": "system", "content": SYSTEM},
|
| 217 |
+
{"role": "user", "content": f"{INSTRUCTION}\n\n```\n{context}\n```"},
|
| 218 |
+
]
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
**1. Fused weights with transformers** (about 52 GB of accelerator memory in
|
| 222 |
+
bfloat16):
|
| 223 |
+
|
| 224 |
+
```python
|
| 225 |
+
import torch
|
| 226 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 227 |
+
|
| 228 |
+
REPO = "SASVAAI/gemma-4-26b-jUnitTestGeneration"
|
| 229 |
+
tokenizer = AutoTokenizer.from_pretrained(REPO)
|
| 230 |
+
model = AutoModelForCausalLM.from_pretrained(REPO, dtype=torch.bfloat16, device_map="auto")
|
| 231 |
+
model.eval()
|
| 232 |
+
|
| 233 |
+
inputs = tokenizer.apply_chat_template(
|
| 234 |
+
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
| 235 |
+
).to(model.device)
|
| 236 |
+
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
|
| 237 |
+
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True).strip())
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
**2. Fused weights with vLLM** (how the numbers below were produced; the
|
| 241 |
+
tensor-parallel degree must divide the 16 attention heads):
|
| 242 |
+
|
| 243 |
+
```bash
|
| 244 |
+
pip install "vllm>=0.19.1"
|
| 245 |
+
vllm serve SASVAAI/gemma-4-26b-jUnitTestGeneration --tensor-parallel-size 4 --max-model-len 10240
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
```python
|
| 249 |
+
from openai import OpenAI
|
| 250 |
+
|
| 251 |
+
client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
|
| 252 |
+
# one greedy answer
|
| 253 |
+
r = client.chat.completions.create(
|
| 254 |
+
model="SASVAAI/gemma-4-26b-jUnitTestGeneration",
|
| 255 |
+
messages=messages, temperature=0, max_tokens=1024,
|
| 256 |
+
)
|
| 257 |
+
# four more candidates, as in pass@5
|
| 258 |
+
extra = client.chat.completions.create(
|
| 259 |
+
model="SASVAAI/gemma-4-26b-jUnitTestGeneration",
|
| 260 |
+
messages=messages, temperature=0.8, top_p=0.95, n=4, max_tokens=1024,
|
| 261 |
+
)
|
| 262 |
+
candidates = [r.choices[0].message.content] + [c.message.content for c in extra.choices]
|
| 263 |
+
```
|
| 264 |
+
|
| 265 |
+
**3. Adapter on the base model** (base in 4-bit fits one 24 GB-class GPU,
|
| 266 |
+
about 16 GB):
|
| 267 |
+
|
| 268 |
+
```python
|
| 269 |
+
import torch
|
| 270 |
+
from peft import PeftModel
|
| 271 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 272 |
+
|
| 273 |
+
BASE = "google/gemma-4-26B-A4B-it"
|
| 274 |
+
REPO = "SASVAAI/gemma-4-26b-jUnitTestGeneration"
|
| 275 |
+
tokenizer = AutoTokenizer.from_pretrained(REPO, subfolder="adapter")
|
| 276 |
+
model = AutoModelForCausalLM.from_pretrained(BASE, dtype=torch.bfloat16, device_map="auto")
|
| 277 |
+
model = PeftModel.from_pretrained(model, REPO, subfolder="adapter")
|
| 278 |
+
model.eval()
|
| 279 |
+
# then generate exactly as in path 1
|
| 280 |
+
```
|
| 281 |
+
|
| 282 |
+
For the 4-bit base pass `quantization_config=BitsAndBytesConfig(load_in_4bit=True,
|
| 283 |
+
bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True,
|
| 284 |
+
bnb_4bit_compute_dtype=torch.bfloat16)`, which reproduces the training-time
|
| 285 |
+
numerics. vLLM cannot attach a LoRA to this architecture (its
|
| 286 |
+
`Gemma4ForConditionalGeneration` does not list LoRA support), which is why the
|
| 287 |
+
fused weights are at the root.
|
| 288 |
+
|
| 289 |
+
The greedy output recorded for this row during evaluation (vLLM, fused
|
| 290 |
+
weights). It compiled, passed, and killed 1 of the focal method's 2 mutants:
|
| 291 |
+
|
| 292 |
+
```java
|
| 293 |
+
@Test
|
| 294 |
+
public void shouldMatchWhenValueIsPresentInPatternArray() {
|
| 295 |
+
assertThat(ArrayMatcher.matches(new String[]{"a", "b", "c"}, "b")).isTrue();
|
| 296 |
+
}
|
| 297 |
+
```
|
| 298 |
+
|
| 299 |
+
> Decoding matters. pass@1 was scored greedily and pass@5 added four samples
|
| 300 |
+
> at T=0.8, top_p 0.95, all with `max_new_tokens=1024` through the chat
|
| 301 |
+
> template. No other sampling setting was validated.
|
| 302 |
+
|
| 303 |
+
## Training details
|
| 304 |
+
|
| 305 |
+
**Data.** 5,488 training rows and 332 validation rows built from
|
| 306 |
+
[methods2test](https://github.com/microsoft/methods2test) (MIT), through
|
| 307 |
+
[`andstor/methods2test_raw`](https://huggingface.co/datasets/andstor/methods2test_raw)
|
| 308 |
+
(revision `1a0f08c6`), `_meta` (`ae2bdff5`) and `_runnable` (`ed8cded6`), by a
|
| 309 |
+
deterministic script (`autocatalyst.datagen.methods2test`, seed 0). No model
|
| 310 |
+
generated any training content: every target is a test a developer wrote in
|
| 311 |
+
an open-source project.
|
| 312 |
+
|
| 313 |
+
Row construction, as recorded in the builder's manifest:
|
| 314 |
+
|
| 315 |
+
- **Training rows** come from methods2test's validation split: 44,298 rows
|
| 316 |
+
scanned, 26,752 eligible, at most 25 rows per project, 5,488 kept from 394
|
| 317 |
+
projects. Dropped: 10,754 with no resolvable commit, 2,684 tests without an
|
| 318 |
+
assertion, 225 constructor focal methods, 3,361 inputs over 7,000 characters,
|
| 319 |
+
522 targets over 2,500 characters, 141 inputs that grew too long once the
|
| 320 |
+
test class's imports were added.
|
| 321 |
+
- **Validation rows** come from methods2test's test split, restricted to the
|
| 322 |
+
`_runnable` ids (Maven projects that build): 78,388 scanned, 2,903 eligible,
|
| 323 |
+
at most 6 rows per project, 400 requested. Each candidate's reference test
|
| 324 |
+
was then run through the full harness below; 75 were rejected (23 did not
|
| 325 |
+
compile on the pinned toolchain, 24 killed no mutant, 9 failed, 19 PIT
|
| 326 |
+
errors) and 332 kept from 86 projects. **Every validation reference passes
|
| 327 |
+
all three gates**, so a perfect model scores 1.0.
|
| 328 |
+
- **No project appears in both splits** (394 training projects, 86 validation
|
| 329 |
+
projects, overlap 0).
|
| 330 |
+
- **Input** never contains the reference test or any other test method of the
|
| 331 |
+
test class.
|
| 332 |
+
- **Java levels in validation:** 1.8 (149 rows), 1.7 (80), 1.6 (72), 1.5 (31).
|
| 333 |
+
|
| 334 |
+
| | |
|
| 335 |
+
|---|---|
|
| 336 |
+
| Train samples | 5,488 (394 projects) |
|
| 337 |
+
| Validation samples | 332 (86 projects) |
|
| 338 |
+
| Project overlap | 0 |
|
| 339 |
+
| Prompt format | chat template + system prompt + instruction / fenced-context user turn (see Intended use) |
|
| 340 |
+
| Loss masking | answer tokens only; prompt tokens set to `-100` |
|
| 341 |
+
| Truncation | sequences cut to `max_seq_len` 4096; no sample was dropped for length |
|
| 342 |
+
|
| 343 |
+
**Source-code licences.** methods2test is MIT, but each row's focal class and
|
| 344 |
+
test come from a third-party Java project with its own licence. The licence
|
| 345 |
+
field in `andstor/methods2test_raw` reads only `licensed` for 391 of the 394
|
| 346 |
+
training projects (2 are Apache-2.0, 1 "Other") and for 85 of the 86
|
| 347 |
+
validation projects (1 is GPL-3.0), so per-project licences were not verified
|
| 348 |
+
for this release. Review this before a public release.
|
| 349 |
+
|
| 350 |
+
An LLM (Claude Opus 4.6, `claude-opus-4-6`, via an internal inference gateway)
|
| 351 |
+
proposed the hyperparameters the search tried and wrote the system prompt from
|
| 352 |
+
the project's problem statement. It generated no training content and computed
|
| 353 |
+
no metric; every metric was computed by compiling and running Java.
|
| 354 |
+
|
| 355 |
+
### Method
|
| 356 |
+
|
| 357 |
+
| | |
|
| 358 |
+
|---|---|
|
| 359 |
+
| SFT method | `qlora` |
|
| 360 |
+
| Base quantisation during training | 4-bit NF4, double quantisation, bf16 compute (`bitsandbytes`) |
|
| 361 |
+
| Refinement stage | none |
|
| 362 |
+
| Auto class | `AutoModelForCausalLM` (resolves to `Gemma4ForConditionalGeneration`) |
|
| 363 |
+
| Hardware | 6x NVIDIA H100 80GB HBM3, `torchrun --nproc_per_node=6` |
|
| 364 |
+
|
| 365 |
+
The project allowed one method (`qlora`). No refinement stage ran; the
|
| 366 |
+
published adapter is the SFT adapter and the root weights are its merge.
|
| 367 |
+
|
| 368 |
+
### Final hyperparameters
|
| 369 |
+
|
| 370 |
+
| Hyperparameter | Value | Source |
|
| 371 |
+
|---|---|---|
|
| 372 |
+
| `learning_rate` | 0.0002 | `[TRAIN]` cmdline |
|
| 373 |
+
| `lr_scheduler_type` | cosine | `[TRAIN]` cmdline |
|
| 374 |
+
| `num_train_epochs` | 2 | platform hyperparameter record, `adapter/trainer_state.json` |
|
| 375 |
+
| `per_device_train_batch_size` | 1 | platform hyperparameter record, `adapter/trainer_state.json` |
|
| 376 |
+
| `gradient_accumulation_steps` | 4 | platform hyperparameter record |
|
| 377 |
+
| `max_seq_length` | 4096 | platform hyperparameter record |
|
| 378 |
+
| `warmup_ratio` | 0.05 | platform hyperparameter record |
|
| 379 |
+
| `weight_decay` | 0.01 | platform hyperparameter record |
|
| 380 |
+
| `loraplus_lr_ratio` | 1.0 (off) | platform hyperparameter record |
|
| 381 |
+
| `lora_r` / `lora_alpha` / `lora_dropout` | 16 / 32 / 0.05 | `[TRAIN]` cmdline, `adapter/adapter_config.json` |
|
| 382 |
+
| `use_rslora` / `use_dora` | `false` / `false` | `adapter/adapter_config.json` |
|
| 383 |
+
| `target_modules` | the 7 listed in Model details | `adapter/adapter_config.json` |
|
| 384 |
+
| `load_in_4bit` | `true` (NF4, double quant, bf16 compute) | `[TRAIN]` cmdline |
|
| 385 |
+
|
| 386 |
+
**Effective batch size: 24** (`1 x 4 x 6`). Optimizer steps: 458 (229 per
|
| 387 |
+
epoch).
|
| 388 |
+
|
| 389 |
+
`neftune_noise_alpha` (0.0), `use_dora`, `use_rslora` and `lora_init`
|
| 390 |
+
(`default`) were left at their no-op defaults. KD parameters are omitted
|
| 391 |
+
deliberately: this is a `qlora` run, not a distillation run.
|
| 392 |
+
|
| 393 |
+
> Provenance note: every value above was recovered from the platform database
|
| 394 |
+
> (`runs`, `experiments`, `events` tables for run 14) and cross-checked against
|
| 395 |
+
> the `[TRAIN]` command line recorded in the run log and against the shipped
|
| 396 |
+
> `adapter/adapter_config.json`. The logged command line is cut off after
|
| 397 |
+
> `--epochs`; the values after it come from the run's recorded hyperparameter
|
| 398 |
+
> JSON.
|
| 399 |
+
|
| 400 |
+
### How these values were chosen
|
| 401 |
+
|
| 402 |
+
> These hyperparameters were selected by an automated search
|
| 403 |
+
> (`autocatalyst.cli.run_autoresearch`): an agent proposes one change at a
|
| 404 |
+
> time, runs train then eval, and keeps or discards on `junit_pass_at_k`
|
| 405 |
+
> (higher is better).
|
| 406 |
+
|
| 407 |
+
Run 14 ran **6 trials in 12 h 25 m** (2026-10-09 18:09 to 2026-10-10 06:35
|
| 408 |
+
UTC); all 6 scored. This checkpoint is **trial 1**, the search's starting
|
| 409 |
+
configuration, and no later trial beat it. Every trial trained on the same
|
| 410 |
+
5,488 rows and was scored on the same 332 validation rows.
|
| 411 |
+
|
| 412 |
+
| # | r | Dropout | LR | Epochs | Train | Eval | pass@5 | Kept |
|
| 413 |
+
|---|---|---|---|---|---|---|---|---|
|
| 414 |
+
| **1** | **16** | **0.05** | **2e-4** | **2** | **92 m** | **29 m** | **0.503012** | **yes** |
|
| 415 |
+
| 2 | 16 | 0.05 | 2e-4 | 3 | 137 m | 30 m | 0.445783 | no |
|
| 416 |
+
| 3 | 16 | 0.05 | 1e-4 | 2 | 92 m | 14 m | 0.466867 | no |
|
| 417 |
+
| 4 | 32 | 0.05 | 2e-4 | 2 | 92 m | 15 m | 0.481928 | no |
|
| 418 |
+
| 5 | 16 | 0.10 | 2e-4 | 2 | 92 m | 15 m | 0.430723 | no |
|
| 419 |
+
| 6 | 16 | 0.05 | 3e-4 | 2 | 92 m | 43 m | 0.478916 | no |
|
| 420 |
+
|
| 421 |
+
All trials: QLoRA, `lora_alpha = 2 x r`, cosine schedule, batch 1 per device,
|
| 422 |
+
gradient accumulation 4, warmup 0.05, weight decay 0.01, `max_seq_len` 4096,
|
| 423 |
+
LoRA+ off, rsLoRA and DoRA off.
|
| 424 |
+
|
| 425 |
+
**What the search actually established: nothing beyond noise.** Five single
|
| 426 |
+
changes from the starting point (one more epoch, half or 1.5x the learning
|
| 427 |
+
rate, rank 32, dropout 0.10) all scored lower, between 0.431 and 0.482. pass@5
|
| 428 |
+
mixes four temperature-0.8 samples into each row's result, so two evaluations
|
| 429 |
+
of the *same* weights differ from run to run; the spread of these six trials
|
| 430 |
+
(0.43 to 0.50) is the best available estimate of that noise. Treat trials
|
| 431 |
+
within about 0.05 of each other as tied, and read 0.503 as a high draw.
|
| 432 |
+
|
| 433 |
+
**The previous search on this task.** Run 12 (2026-10-08) searched the same
|
| 434 |
+
space on an earlier version of the dataset (333 validation rows, no Java level
|
| 435 |
+
line in the prompt) and kept on greedy pass@1. Its best checkpoint scored pass@1
|
| 436 |
+
0.276. In a separate check that sampled it five times at temperature 0.8, it
|
| 437 |
+
reached pass@5 0.486 (0.505 counting its greedy answer too). So this
|
| 438 |
+
checkpoint is not better than run 12's: its greedy pass@1 is lower (0.247), and
|
| 439 |
+
its pass@5 is about level. The jump from "0.276" to "0.503" between the two
|
| 440 |
+
runs is the change of metric, not of model.
|
| 441 |
+
|
| 442 |
+
**Search space.** Four knobs were varied (`LORA_R`, `LORA_DROPOUT`,
|
| 443 |
+
`LEARNING_RATE`, `EPOCHS`). `LR_SCHEDULER`, `GRAD_ACCUM`, `WARMUP_RATIO`,
|
| 444 |
+
`WEIGHT_DECAY`, `MAX_SEQ_LEN`, `LORAPLUS_LR_RATIO`, `USE_RSLORA`, `USE_DORA`,
|
| 445 |
+
`BATCH_SIZE` and the training method were never moved.
|
| 446 |
+
|
| 447 |
+
**Observed training metrics** (this checkpoint).
|
| 448 |
+
|
| 449 |
+
| | |
|
| 450 |
+
|---|---|
|
| 451 |
+
| Final train loss (mean over the run) | 0.7416771020431185 |
|
| 452 |
+
| Last logged train loss (step 450) | 0.5607 (grad norm 0.31, token accuracy 0.864) |
|
| 453 |
+
| Final eval loss (teacher-forced, answer tokens) | 0.5725216269493103 |
|
| 454 |
+
| Eval mean token accuracy | 0.8667 |
|
| 455 |
+
| Train runtime | 5,444.8575 s |
|
| 456 |
+
| Total FLOPs | 1.6958247325338173e+18 |
|
| 457 |
+
| Throughput | 2.016 samples/s, 0.084 steps/s |
|
| 458 |
+
|
| 459 |
+
458 optimizer steps ran. The logged train loss fell from 5.8956 at step 10
|
| 460 |
+
(grad norm 8.0) to 0.5607 at step 450, with a minimum of 0.5260; the reported
|
| 461 |
+
train loss is the mean over the run, not a converged value.
|
| 462 |
+
|
| 463 |
+
## Evaluation
|
| 464 |
+
|
| 465 |
+
**Protocol.** All 332 validation rows, prompts rendered through the chat
|
| 466 |
+
template, `max_new_tokens=1024`. The platform merged the adapter into the base
|
| 467 |
+
and generated with vLLM 0.19.1 in bfloat16 at tensor-parallel 4 on four H100s:
|
| 468 |
+
one greedy answer per row, then four more sampled at temperature 0.8, top_p
|
| 469 |
+
0.95. Generation plus grading took 1,722 s. The merged weights it served are
|
| 470 |
+
the ones at this repository's root.
|
| 471 |
+
|
| 472 |
+
**The harness** (`junit_mutation` evaluator) grades each candidate inside its
|
| 473 |
+
own project, never by comparing text:
|
| 474 |
+
|
| 475 |
+
1. Check out the project at the row's commit and insert the candidate method
|
| 476 |
+
into the test class.
|
| 477 |
+
2. **Compile:** `mvn test-compile` (JDK 8, Maven 3.6.3).
|
| 478 |
+
3. **Pass:** run that one test method (`mvn test -Dtest=Class#method`); it must
|
| 479 |
+
pass against the real implementation.
|
| 480 |
+
4. **Kill:** mutate the focal class with PIT 1.14.4 and run only the candidate
|
| 481 |
+
test against the mutants; it must kill at least one mutant of the focal
|
| 482 |
+
method.
|
| 483 |
+
|
| 484 |
+
A candidate scores 1 only if it clears all three gates. pass@1 is the greedy
|
| 485 |
+
candidate's score; pass@5 counts a row as solved if any of the five candidates
|
| 486 |
+
scores 1.
|
| 487 |
+
|
| 488 |
+
| Metric | Value |
|
| 489 |
+
|---|---|
|
| 490 |
+
| pass@5, greedy + 4 samples (**the search metric**) | 0.503012 (167 / 332) |
|
| 491 |
+
| pass@1, greedy | 0.246988 (82 / 332) |
|
| 492 |
+
| Greedy compile rate | 0.421687 (140 / 332) |
|
| 493 |
+
| Greedy test-pass rate | 0.246988 (82 / 332) |
|
| 494 |
+
| Greedy mean kill fraction (killed / mutants of the focal method) | 0.206093 |
|
| 495 |
+
|
| 496 |
+
**Where the greedy answers fail** (from `adapter/predictions.jsonl`):
|
| 497 |
+
|
| 498 |
+
| Greedy outcome | Rows | Share |
|
| 499 |
+
|---|---|---|
|
| 500 |
+
| Does not compile | 192 | 57.8% |
|
| 501 |
+
| …of which ran into the 1,024-token cap | 66 | 19.9% |
|
| 502 |
+
| Compiles but the test fails | 58 | 17.5% |
|
| 503 |
+
| Passes but kills no mutant | 0 | 0% |
|
| 504 |
+
| Clears all three gates | 82 | 24.7% |
|
| 505 |
+
|
| 506 |
+
The 66 capped outputs are repetition loops; every one fails to compile. The
|
| 507 |
+
median greedy answer is 119 tokens against a reference median of 105. Of the
|
| 508 |
+
58 test failures, 35 are failed assertions (`AssertionError`,
|
| 509 |
+
`ComparisonFailure`, `AssertionFailedError`): the test ran but expected a
|
| 510 |
+
different value from the one the code returns. The rest are exceptions thrown
|
| 511 |
+
during the test. Every greedy test that passed also killed a mutant, so the
|
| 512 |
+
mutation gate rejected nothing here.
|
| 513 |
+
|
| 514 |
+
**Where the other 85 pass@5 wins come from.** Of the 167 solved rows, 82 were
|
| 515 |
+
solved by the greedy answer and 85 only by a sampled one (attempt 2: 33, 3: 21,
|
| 516 |
+
4: 15, 5: 16).
|
| 517 |
+
|
| 518 |
+
**Baseline for comparison. Not measured.** The untuned
|
| 519 |
+
`google/gemma-4-26B-A4B-it` was never scored on these 332 rows, so nothing here
|
| 520 |
+
quantifies how much of the score the fine-tuning is responsible for. This is
|
| 521 |
+
the most important gap in this card.
|
| 522 |
+
|
| 523 |
+
**This is a validation split the search selected against.** 6 trials were
|
| 524 |
+
scored on these same 332 rows and the best was kept, so expect optimistic bias
|
| 525 |
+
on top of the sampling noise already described. The rows come from projects
|
| 526 |
+
that do not appear in training, but from the same methods2test snapshot, so
|
| 527 |
+
they are unseen projects, not code written after the training data.
|
| 528 |
+
|
| 529 |
+
**The evaluation set is reproducible.** `adapter/predictions.jsonl` holds every
|
| 530 |
+
one of the 332 rows: instruction, context, greedy prediction, reference test,
|
| 531 |
+
and the harness verdict (`stage`, compiler or surefire error text, mutants,
|
| 532 |
+
kills, per-attempt stages and the winning candidate). Local paths in error
|
| 533 |
+
text are replaced with `<project>/`.
|
| 534 |
+
|
| 535 |
+
## Limitations and bias
|
| 536 |
+
|
| 537 |
+
**pass@5 needs a test runner.** Without one, you get the greedy answer and
|
| 538 |
+
pass@1 0.247: three of four single answers fail.
|
| 539 |
+
|
| 540 |
+
**No baseline, so no established gain.** See Evaluation.
|
| 541 |
+
|
| 542 |
+
**One in five greedy answers never stops.** Repetition loops consume the whole
|
| 543 |
+
1,024-token budget and never compile. Treat a capped output as a failure.
|
| 544 |
+
|
| 545 |
+
**Most failures are compile errors.** Using a class or method that is not
|
| 546 |
+
visible, an import the test class lacks, or a language feature above the
|
| 547 |
+
project's Java level. Keep the `// Java source level:` line and the test class's
|
| 548 |
+
imports in the prompt; they are what the model uses to avoid this.
|
| 549 |
+
|
| 550 |
+
**Passing tests encode current behaviour.** The model writes tests that pass
|
| 551 |
+
against the implementation as it is. If the method has a bug, a passing test
|
| 552 |
+
locks the bug in.
|
| 553 |
+
|
| 554 |
+
**Killing one mutant is a low bar.** The gate needs one killed mutant, not
|
| 555 |
+
all; the mean kill fraction is 0.21. A passing test is not evidence of
|
| 556 |
+
thorough coverage.
|
| 557 |
+
|
| 558 |
+
**Prompt shape is the contract.** Change the system prompt, the instruction
|
| 559 |
+
sentence, the context block's order, or the code fence, and you are evaluating
|
| 560 |
+
a model nobody measured.
|
| 561 |
+
|
| 562 |
+
**Domain narrowness.** Maven projects from GitHub mined by methods2test, Java
|
| 563 |
+
1.5 to 1.8 in evaluation (training also saw 9, 10 and 11), with the JUnit 4,
|
| 564 |
+
JUnit 5 or TestNG setup and assertion libraries those projects use. Gradle builds, newer Java, Kotlin
|
| 565 |
+
and non-English identifiers are unmeasured.
|
| 566 |
+
|
| 567 |
+
**Inherits all biases and limitations of the base model.** This adapter
|
| 568 |
+
changes 0.07% of the parameters and was not evaluated for safety or fairness.
|
| 569 |
+
The base model's own card governs those properties.
|
| 570 |
+
|
| 571 |
+
## Merged-weights equivalence
|
| 572 |
+
|
| 573 |
+
The root weights are `adapter/` merged into the base in bfloat16
|
| 574 |
+
(`PeftModel.merge_and_unload` through `autocatalyst.serving.merge`,
|
| 575 |
+
transformers 5.6.2). The merge was written as one 49 GB shard plus one 2.3 GB
|
| 576 |
+
shard; for this release its tensors were copied unchanged into 11 shards of at
|
| 577 |
+
most 5 GB (same tensor names, dtypes and values; 26 sampled tensors were
|
| 578 |
+
checked equal to the source). They are the weights the evaluation above was
|
| 579 |
+
served from, so the numbers in this card are the fused model's numbers. The
|
| 580 |
+
merged directory keeps the untouched vision tower and the processor config so
|
| 581 |
+
it loads as the base does.
|
| 582 |
+
|
| 583 |
+
## Environmental impact
|
| 584 |
+
|
| 585 |
+
| | |
|
| 586 |
+
|---|---|
|
| 587 |
+
| Hardware | 6x NVIDIA H100 80GB HBM3 |
|
| 588 |
+
| Training time | 90.7 minutes (5,444.86 s) |
|
| 589 |
+
| Cloud provider / region | on-premise |
|
| 590 |
+
|
| 591 |
+
Covers this trial only. The full 6-trial search that selected it took
|
| 592 |
+
12 h 25 m on the same hardware.
|
| 593 |
+
|
| 594 |
+
## Framework versions
|
| 595 |
+
|
| 596 |
+
- PEFT 0.18.1
|
| 597 |
+
- TRL: 1.0.0
|
| 598 |
+
- Transformers: 5.7.0.dev0 (git main) for training; 5.6.2 for the merge
|
| 599 |
+
- Pytorch: 2.5.1+cu121
|
| 600 |
+
- bitsandbytes: 0.49.2
|
| 601 |
+
- flash-attn: 2.8.3
|
| 602 |
+
- vLLM: 0.19.1 (evaluation)
|
| 603 |
+
- Evaluation toolchain: JDK 8, Maven 3.6.3, PIT 1.14.4
|
| 604 |
+
- Python: 3.12.3
|
| 605 |
+
|
| 606 |
+
PEFT's version is the one recorded in `adapter/adapter_config.json` at save
|
| 607 |
+
time; the rest are the pinned versions of the training and evaluation
|
| 608 |
+
environments. `transformers` is a git-main build: the `gemma4` architecture is
|
| 609 |
+
not in the stable PyPI release used for training.
|
| 610 |
+
|
| 611 |
+
## Citation
|
| 612 |
+
|
| 613 |
+
```bibtex
|
| 614 |
+
@misc{gemma4_junit_test_generation_2026,
|
| 615 |
+
title = {Gemma-4-26B-A4B JUnit Test Generator},
|
| 616 |
+
author = {{SASVA AI Model Cognition Labs}},
|
| 617 |
+
year = {2026},
|
| 618 |
+
url = {https://huggingface.co/SASVAAI/gemma-4-26b-jUnitTestGeneration}
|
| 619 |
+
}
|
| 620 |
+
```
|
| 621 |
+
|
| 622 |
+
Training and evaluation data: methods2test, Tufano et al., "Methods2Test: A
|
| 623 |
+
dataset of focal methods mapped to test cases", MSR 2022,
|
| 624 |
+
https://github.com/microsoft/methods2test (MIT).
|
adapter/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LoRA adapter (this subfolder)
|
| 2 |
+
|
| 3 |
+
The QLoRA adapter that was merged into the weights at the repository root.
|
| 4 |
+
Same training, same evaluation, same numbers: everything is documented in the
|
| 5 |
+
root `README.md`. Load it on the base model instead of the fused weights when
|
| 6 |
+
memory is tight (the base in 4-bit plus this adapter fits one 24 GB-class GPU):
|
| 7 |
+
|
| 8 |
+
```python
|
| 9 |
+
from peft import PeftModel
|
| 10 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 11 |
+
|
| 12 |
+
REPO = "SASVAAI/gemma-4-26b-jUnitTestGeneration"
|
| 13 |
+
tokenizer = AutoTokenizer.from_pretrained(REPO, subfolder="adapter")
|
| 14 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-4-26B-A4B-it", dtype="bfloat16", device_map="auto")
|
| 15 |
+
model = PeftModel.from_pretrained(model, REPO, subfolder="adapter")
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
Files: `adapter_config.json`, `adapter_model.safetensors` (37,232,104 bytes,
|
| 19 |
+
410 bfloat16 tensors), the tokenizer and chat template the adapter was trained
|
| 20 |
+
with, and the training run's `trainer_state.json`, `all_results.json`,
|
| 21 |
+
`train_results.json`, `eval_results.json` and `predictions.jsonl` (all 332
|
| 22 |
+
validation rows with the greedy prediction, the reference test and the harness
|
| 23 |
+
verdict for every candidate).
|
adapter/adapter_config.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "google/gemma-4-26B-A4B-it",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": ".*vision_tower.*",
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 32,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.05,
|
| 22 |
+
"megatron_config": null,
|
| 23 |
+
"megatron_core": "megatron.core",
|
| 24 |
+
"modules_to_save": null,
|
| 25 |
+
"peft_type": "LORA",
|
| 26 |
+
"peft_version": "0.18.1",
|
| 27 |
+
"qalora_group_size": 16,
|
| 28 |
+
"r": 16,
|
| 29 |
+
"rank_pattern": {},
|
| 30 |
+
"revision": null,
|
| 31 |
+
"target_modules": [
|
| 32 |
+
"k_proj",
|
| 33 |
+
"down_proj",
|
| 34 |
+
"q_proj",
|
| 35 |
+
"up_proj",
|
| 36 |
+
"gate_proj",
|
| 37 |
+
"o_proj",
|
| 38 |
+
"v_proj"
|
| 39 |
+
],
|
| 40 |
+
"target_parameters": null,
|
| 41 |
+
"task_type": "CAUSAL_LM",
|
| 42 |
+
"trainable_token_indices": null,
|
| 43 |
+
"use_dora": false,
|
| 44 |
+
"use_qalora": false,
|
| 45 |
+
"use_rslora": false
|
| 46 |
+
}
|
adapter/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d63a81f1a72e6ddb027c24afd3bb1ab5620dba46dd33f2b56f4265b5f4843423
|
| 3 |
+
size 37232104
|
adapter/all_results.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"total_flos": 1.6958247325338173e+18,
|
| 3 |
+
"train_loss": 0.7416771020431185,
|
| 4 |
+
"train_runtime": 5444.8575,
|
| 5 |
+
"train_samples_per_second": 2.016,
|
| 6 |
+
"train_steps_per_second": 0.084
|
| 7 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#
|
| 2 |
+
Template: Google Gemma 4 Canonical Chat Template
|
| 3 |
+
Author: Google Gemma Engineering Team
|
| 4 |
+
Published: 2026-07-09
|
| 5 |
+
Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.
|
| 6 |
+
#}
|
| 7 |
+
{%- macro format_parameters(properties, required, filter_keys=false) -%}
|
| 8 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 9 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 10 |
+
{%- for key, value in properties | dictsort -%}
|
| 11 |
+
{%- set add_comma = false -%}
|
| 12 |
+
{%- if not filter_keys or key not in standard_keys -%}
|
| 13 |
+
{%- if ns.found_first %},{% endif -%}
|
| 14 |
+
{%- set ns.found_first = true -%}
|
| 15 |
+
{{ key }}:{
|
| 16 |
+
{%- if value['description'] -%}
|
| 17 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 18 |
+
{%- set add_comma = true -%}
|
| 19 |
+
{%- endif -%}
|
| 20 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 21 |
+
{%- if value['enum'] -%}
|
| 22 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 23 |
+
enum:{{ format_argument(value['enum']) }}
|
| 24 |
+
{%- endif -%}
|
| 25 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 26 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 27 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 28 |
+
items:{
|
| 29 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 30 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 31 |
+
{%- if item_value is not none -%}
|
| 32 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 33 |
+
{%- set ns_items.found_first = true -%}
|
| 34 |
+
{%- if item_key == 'properties' -%}
|
| 35 |
+
properties:{
|
| 36 |
+
{%- if item_value is mapping -%}
|
| 37 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 38 |
+
{%- endif -%}
|
| 39 |
+
}
|
| 40 |
+
{%- elif item_key == 'required' -%}
|
| 41 |
+
required:[
|
| 42 |
+
{%- for req_item in item_value -%}
|
| 43 |
+
<|"|>{{- req_item -}}<|"|>
|
| 44 |
+
{%- if not loop.last %},{% endif -%}
|
| 45 |
+
{%- endfor -%}
|
| 46 |
+
]
|
| 47 |
+
{%- elif item_key == 'type' -%}
|
| 48 |
+
{%- if item_value is string -%}
|
| 49 |
+
type:{{ format_argument(item_value | upper) }}
|
| 50 |
+
{%- else -%}
|
| 51 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 52 |
+
{%- endif -%}
|
| 53 |
+
{%- else -%}
|
| 54 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 55 |
+
{%- endif -%}
|
| 56 |
+
{%- endif -%}
|
| 57 |
+
{%- endfor -%}
|
| 58 |
+
}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{%- endif -%}
|
| 61 |
+
{%- if value['nullable'] %}
|
| 62 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 63 |
+
nullable:true
|
| 64 |
+
{%- endif -%}
|
| 65 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 66 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 67 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 68 |
+
properties:{
|
| 69 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 70 |
+
}
|
| 71 |
+
{%- elif value is mapping -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
properties:{
|
| 74 |
+
{{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
|
| 75 |
+
}
|
| 76 |
+
{%- endif -%}
|
| 77 |
+
{%- if value['required'] -%}
|
| 78 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 79 |
+
required:[
|
| 80 |
+
{%- for item in value['required'] | default([]) -%}
|
| 81 |
+
<|"|>{{- item -}}<|"|>
|
| 82 |
+
{%- if not loop.last %},{% endif -%}
|
| 83 |
+
{%- endfor -%}
|
| 84 |
+
]
|
| 85 |
+
{%- endif -%}
|
| 86 |
+
{%- endif -%}
|
| 87 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 88 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 89 |
+
{%- endif -%}
|
| 90 |
+
{%- endfor -%}
|
| 91 |
+
{%- endmacro -%}
|
| 92 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 93 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 94 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 95 |
+
{%- if params -%}
|
| 96 |
+
,parameters:{
|
| 97 |
+
{%- if params['properties'] -%}
|
| 98 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 99 |
+
{%- endif -%}
|
| 100 |
+
{%- if params['required'] -%}
|
| 101 |
+
required:[
|
| 102 |
+
{%- for item in params['required'] -%}
|
| 103 |
+
<|"|>{{- item -}}<|"|>
|
| 104 |
+
{{- ',' if not loop.last -}}
|
| 105 |
+
{%- endfor -%}
|
| 106 |
+
],
|
| 107 |
+
{%- endif -%}
|
| 108 |
+
{%- if params['type'] -%}
|
| 109 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 110 |
+
{%- endif -%}
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 113 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 114 |
+
,response:{
|
| 115 |
+
{%- if response_declaration['description'] -%}
|
| 116 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 117 |
+
{%- endif -%}
|
| 118 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 119 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 120 |
+
{%- endif -%}
|
| 121 |
+
{%- endif -%}
|
| 122 |
+
}
|
| 123 |
+
{%- endmacro -%}
|
| 124 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 125 |
+
{%- if argument is none -%}
|
| 126 |
+
{{- 'null' -}}
|
| 127 |
+
{%- elif argument is string -%}
|
| 128 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 129 |
+
{%- elif argument is boolean -%}
|
| 130 |
+
{{- 'true' if argument else 'false' -}}
|
| 131 |
+
{%- elif argument is mapping -%}
|
| 132 |
+
{{- '{' -}}
|
| 133 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 134 |
+
{%- for key, value in argument | dictsort -%}
|
| 135 |
+
{%- if ns.found_first %},{% endif -%}
|
| 136 |
+
{%- set ns.found_first = true -%}
|
| 137 |
+
{%- if escape_keys -%}
|
| 138 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 139 |
+
{%- else -%}
|
| 140 |
+
{{- key -}}
|
| 141 |
+
{%- endif -%}
|
| 142 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 143 |
+
{%- endfor -%}
|
| 144 |
+
{{- '}' -}}
|
| 145 |
+
{%- elif argument is sequence -%}
|
| 146 |
+
{{- '[' -}}
|
| 147 |
+
{%- for item in argument -%}
|
| 148 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 149 |
+
{%- if not loop.last %},{% endif -%}
|
| 150 |
+
{%- endfor -%}
|
| 151 |
+
{{- ']' -}}
|
| 152 |
+
{%- else -%}
|
| 153 |
+
{{- argument -}}
|
| 154 |
+
{%- endif -%}
|
| 155 |
+
{%- endmacro -%}
|
| 156 |
+
{%- macro strip_thinking(text) -%}
|
| 157 |
+
{%- set ns = namespace(result='') -%}
|
| 158 |
+
{%- for part in text.split('<channel|>') -%}
|
| 159 |
+
{%- if '<|channel>' in part -%}
|
| 160 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 161 |
+
{%- else -%}
|
| 162 |
+
{%- set ns.result = ns.result + part -%}
|
| 163 |
+
{%- endif -%}
|
| 164 |
+
{%- endfor -%}
|
| 165 |
+
{{- ns.result | trim -}}
|
| 166 |
+
{%- endmacro -%}
|
| 167 |
+
|
| 168 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 169 |
+
{{- '<|tool_response>' -}}
|
| 170 |
+
{%- if response is mapping -%}
|
| 171 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 172 |
+
{%- for key, value in response | dictsort -%}
|
| 173 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 174 |
+
{%- if not loop.last %},{% endif -%}
|
| 175 |
+
{%- endfor -%}
|
| 176 |
+
{{- '}' -}}
|
| 177 |
+
{%- else -%}
|
| 178 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 179 |
+
{%- endif -%}
|
| 180 |
+
{{- '<tool_response|>' -}}
|
| 181 |
+
{%- endmacro -%}
|
| 182 |
+
|
| 183 |
+
{#- ===== SETUP ===== -#}
|
| 184 |
+
{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
|
| 185 |
+
{%- set loop_messages = messages -%}
|
| 186 |
+
{%- set enable_thinking = enable_thinking | default(false) -%}
|
| 187 |
+
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 188 |
+
{{- bos_token -}}
|
| 189 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 190 |
+
{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
|
| 191 |
+
{{- '<|turn>system\n' -}}
|
| 192 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 193 |
+
{%- if enable_thinking -%}
|
| 194 |
+
{{- '<|think|>\n' -}}
|
| 195 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 196 |
+
{%- endif -%}
|
| 197 |
+
{%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
|
| 198 |
+
{%- if messages[0]['content'] is string -%}
|
| 199 |
+
{{- messages[0]['content'] | trim -}}
|
| 200 |
+
{%- elif messages[0]['content'] is sequence -%}
|
| 201 |
+
{%- for item in messages[0]['content'] -%}
|
| 202 |
+
{{- item['text'] | trim + ' '-}}
|
| 203 |
+
{%- endfor -%}
|
| 204 |
+
{%- endif -%}
|
| 205 |
+
{%- set loop_messages = messages[1:] -%}
|
| 206 |
+
{%- endif -%}
|
| 207 |
+
{%- if tools -%}
|
| 208 |
+
{%- for tool in tools %}
|
| 209 |
+
{{- '<|tool>' -}}
|
| 210 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 211 |
+
{{- '<tool|>' -}}
|
| 212 |
+
{%- endfor %}
|
| 213 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 214 |
+
{%- endif -%}
|
| 215 |
+
{{- '<turn|>\n' -}}
|
| 216 |
+
{%- endif %}
|
| 217 |
+
|
| 218 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 219 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 220 |
+
{%- for i in range(loop_messages | length) -%}
|
| 221 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 222 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 223 |
+
{%- endif -%}
|
| 224 |
+
{%- endfor -%}
|
| 225 |
+
|
| 226 |
+
{#- Loop through messages -#}
|
| 227 |
+
{%- for message in loop_messages -%}
|
| 228 |
+
{%- if message['role'] != 'tool' -%}
|
| 229 |
+
{%- set ns.prev_message_type = None -%}
|
| 230 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 231 |
+
{#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
|
| 232 |
+
{%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
|
| 233 |
+
{%- if not continue_same_model_turn -%}
|
| 234 |
+
{{- '<|turn>' + role + '\n' }}
|
| 235 |
+
|
| 236 |
+
{%- endif -%}
|
| 237 |
+
|
| 238 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 239 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 240 |
+
{%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
|
| 241 |
+
{%- if thinking_text and thinking_gate -%}
|
| 242 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 243 |
+
{%- endif -%}
|
| 244 |
+
|
| 245 |
+
{%- if message.get('tool_calls') -%}
|
| 246 |
+
{%- for tool_call in message.get('tool_calls') -%}
|
| 247 |
+
{%- set function = tool_call['function'] -%}
|
| 248 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 249 |
+
{%- if function['arguments'] is mapping -%}
|
| 250 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 251 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 252 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 253 |
+
{%- set ns_args.found_first = true -%}
|
| 254 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 255 |
+
{%- endfor -%}
|
| 256 |
+
{%- elif function['arguments'] is none -%}
|
| 257 |
+
{%- else -%}
|
| 258 |
+
{{- raise_exception(
|
| 259 |
+
"chat_template: tool_calls[].function.arguments must be a "
|
| 260 |
+
"JSON object (mapping), not a string. Deserialize arguments "
|
| 261 |
+
"before passing to the template."
|
| 262 |
+
) -}}
|
| 263 |
+
{%- endif -%}
|
| 264 |
+
{{- '}<tool_call|>' -}}
|
| 265 |
+
{%- endfor -%}
|
| 266 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 267 |
+
{%- endif -%}
|
| 268 |
+
|
| 269 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 270 |
+
{%- if message.get('tool_responses') -%}
|
| 271 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 272 |
+
{%- for tool_response in message.get('tool_responses') -%}
|
| 273 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
|
| 274 |
+
{%- set ns_tr_out.flag = true -%}
|
| 275 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 276 |
+
{%- endfor -%}
|
| 277 |
+
{%- elif message.get('tool_calls') -%}
|
| 278 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 279 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 280 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 281 |
+
{%- if ns_tool_scan.stopped -%}
|
| 282 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 283 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 284 |
+
{%- else -%}
|
| 285 |
+
{%- set follow = loop_messages[k] -%}
|
| 286 |
+
{#- Resolve tool_call_id to function name -#}
|
| 287 |
+
{%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
|
| 288 |
+
{%- for tc in message.get('tool_calls') -%}
|
| 289 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 290 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 291 |
+
{%- endif -%}
|
| 292 |
+
{%- endfor -%}
|
| 293 |
+
{#- Handle content as string or content-parts array -#}
|
| 294 |
+
{%- set tool_body = follow.get('content') -%}
|
| 295 |
+
{%- if tool_body is string -%}
|
| 296 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 297 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 298 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 299 |
+
{%- for part in tool_body -%}
|
| 300 |
+
{%- if part.get('type') == 'text' -%}
|
| 301 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 302 |
+
{%- endif -%}
|
| 303 |
+
{%- endfor -%}
|
| 304 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 305 |
+
{%- for part in tool_body -%}
|
| 306 |
+
{%- if part.get('type') in ['image', 'image_url'] -%}
|
| 307 |
+
{{- '<|image|>' -}}
|
| 308 |
+
{%- elif part.get('type') in ['audio', 'input_audio'] -%}
|
| 309 |
+
{{- '<|audio|>' -}}
|
| 310 |
+
{%- elif part.get('type') == 'video' -%}
|
| 311 |
+
{{- '<|video|>' -}}
|
| 312 |
+
{%- endif -%}
|
| 313 |
+
{%- endfor -%}
|
| 314 |
+
{%- else -%}
|
| 315 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 316 |
+
{%- endif -%}
|
| 317 |
+
{%- set ns_tr_out.flag = true -%}
|
| 318 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 319 |
+
{%- endif -%}
|
| 320 |
+
{%- endfor -%}
|
| 321 |
+
{%- endif -%}
|
| 322 |
+
|
| 323 |
+
{%- set captured_content -%}
|
| 324 |
+
{%- if message.get('content') is string -%}
|
| 325 |
+
{%- if role == 'model' -%}
|
| 326 |
+
{{- strip_thinking(message['content']) -}}
|
| 327 |
+
{%- else -%}
|
| 328 |
+
{{- message['content'] | trim -}}
|
| 329 |
+
{%- endif -%}
|
| 330 |
+
{%- elif message.get('content') is sequence -%}
|
| 331 |
+
{%- for item in message['content'] -%}
|
| 332 |
+
{%- if item.get('type') == 'text' -%}
|
| 333 |
+
{%- if role == 'model' -%}
|
| 334 |
+
{{- strip_thinking(item['text']) -}}
|
| 335 |
+
{%- else -%}
|
| 336 |
+
{{- item['text'] | trim -}}
|
| 337 |
+
{%- endif -%}
|
| 338 |
+
{%- elif item.get('type') in ['image', 'image_url'] -%}
|
| 339 |
+
{{- '<|image|>' -}}
|
| 340 |
+
{%- elif item.get('type') in ['audio', 'input_audio'] -%}
|
| 341 |
+
{{- '<|audio|>' -}}
|
| 342 |
+
{%- elif item.get('type') == 'video' -%}
|
| 343 |
+
{{- '<|video|>' -}}
|
| 344 |
+
{%- endif -%}
|
| 345 |
+
{%- endfor -%}
|
| 346 |
+
{%- endif -%}
|
| 347 |
+
{%- endset -%}
|
| 348 |
+
|
| 349 |
+
{{- captured_content -}}
|
| 350 |
+
{%- set has_content = captured_content | trim | length > 0 -%}
|
| 351 |
+
|
| 352 |
+
{#- Forward-scan: find next non-tool message role for continuation detection -#}
|
| 353 |
+
{%- set next_nt = namespace(role=None, found=false) -%}
|
| 354 |
+
{%- for j in range(loop.index0 + 1, loop_messages | length) -%}
|
| 355 |
+
{%- if not next_nt.found -%}
|
| 356 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 357 |
+
{%- set next_nt.role = loop_messages[j]['role'] -%}
|
| 358 |
+
{%- set next_nt.found = true -%}
|
| 359 |
+
{%- endif -%}
|
| 360 |
+
{%- endif -%}
|
| 361 |
+
{%- endfor -%}
|
| 362 |
+
|
| 363 |
+
{%- set continues_into_next = (
|
| 364 |
+
role == 'model'
|
| 365 |
+
and next_nt.role == 'assistant'
|
| 366 |
+
and (not message.get('tool_calls') or ns_tr_out.flag)
|
| 367 |
+
) -%}
|
| 368 |
+
|
| 369 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 370 |
+
{{- '<|tool_response>' -}}
|
| 371 |
+
{%- elif continues_into_next -%}
|
| 372 |
+
{%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
|
| 373 |
+
{{- '<turn|>\n' -}}
|
| 374 |
+
{%- endif -%}
|
| 375 |
+
|
| 376 |
+
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
|
| 377 |
+
{%- set ns.prev_non_tool_role = message['role'] -%}
|
| 378 |
+
{%- endif -%}
|
| 379 |
+
{%- endfor -%}
|
| 380 |
+
|
| 381 |
+
{%- if add_generation_prompt -%}
|
| 382 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 383 |
+
{{- '<|turn>model\n' -}}
|
| 384 |
+
{%- if not enable_thinking -%}
|
| 385 |
+
{{- '<|channel>thought\n<channel|>' -}}
|
| 386 |
+
{%- endif -%}
|
| 387 |
+
{%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
|
| 388 |
+
{{- '<|channel>thought\n' -}}
|
| 389 |
+
{%- endif -%}
|
| 390 |
+
{%- endif -%}
|
adapter/eval_results.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metrics": {
|
| 3 |
+
"junit_pass_rate": 0.2469879518072289,
|
| 4 |
+
"junit_compile_rate": 0.42168674698795183,
|
| 5 |
+
"junit_test_rate": 0.2469879518072289,
|
| 6 |
+
"junit_kill_fraction": 0.2060925018756344,
|
| 7 |
+
"junit_pass_at_k": 0.5030120481927711,
|
| 8 |
+
"junit_attempts": 5.0
|
| 9 |
+
},
|
| 10 |
+
"num_samples": 332
|
| 11 |
+
}
|
adapter/predictions.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
adapter/tokenizer.json
ADDED
|
@@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|
|
|
|
|
|
|
|
|
|
| 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": false,
|
| 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": "right",
|
| 46 |
+
"processor_class": "Gemma4Processor",
|
| 47 |
+
"response_schema": {
|
| 48 |
+
"properties": {
|
| 49 |
+
"content": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
+
"role": {
|
| 53 |
+
"const": "assistant"
|
| 54 |
+
},
|
| 55 |
+
"thinking": {
|
| 56 |
+
"type": "string"
|
| 57 |
+
},
|
| 58 |
+
"tool_calls": {
|
| 59 |
+
"items": {
|
| 60 |
+
"properties": {
|
| 61 |
+
"function": {
|
| 62 |
+
"properties": {
|
| 63 |
+
"arguments": {
|
| 64 |
+
"additionalProperties": {},
|
| 65 |
+
"type": "object",
|
| 66 |
+
"x-parser": "gemma4-tool-call"
|
| 67 |
+
},
|
| 68 |
+
"name": {
|
| 69 |
+
"type": "string"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"type": "object",
|
| 73 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 74 |
+
},
|
| 75 |
+
"type": {
|
| 76 |
+
"const": "function"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"type": "object"
|
| 80 |
+
},
|
| 81 |
+
"type": "array",
|
| 82 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 83 |
+
}
|
| 84 |
+
},
|
| 85 |
+
"type": "object",
|
| 86 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 87 |
+
},
|
| 88 |
+
"response_template": {
|
| 89 |
+
"defaults": {
|
| 90 |
+
"role": "assistant"
|
| 91 |
+
},
|
| 92 |
+
"fields": {
|
| 93 |
+
"content": {
|
| 94 |
+
"close": [
|
| 95 |
+
"<turn|>",
|
| 96 |
+
"<|tool_response>",
|
| 97 |
+
"<eos>"
|
| 98 |
+
],
|
| 99 |
+
"content": "text"
|
| 100 |
+
},
|
| 101 |
+
"thinking": {
|
| 102 |
+
"close": "<channel|>",
|
| 103 |
+
"content": "text",
|
| 104 |
+
"open": "<|channel>thought\n"
|
| 105 |
+
},
|
| 106 |
+
"tool_calls": {
|
| 107 |
+
"close": "<tool_call|>",
|
| 108 |
+
"content": "json",
|
| 109 |
+
"content_args": {
|
| 110 |
+
"string_delims": [
|
| 111 |
+
[
|
| 112 |
+
"<|\"|>",
|
| 113 |
+
"<|\"|>"
|
| 114 |
+
]
|
| 115 |
+
],
|
| 116 |
+
"unquoted_keys": true
|
| 117 |
+
},
|
| 118 |
+
"open_pattern": "<\\|tool_call>call:(?P<name>\\w+)",
|
| 119 |
+
"repeats": true,
|
| 120 |
+
"transform": {
|
| 121 |
+
"function": {
|
| 122 |
+
"arguments": "{content}",
|
| 123 |
+
"name": "{name}"
|
| 124 |
+
},
|
| 125 |
+
"type": "function"
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
"start_anchor": [
|
| 130 |
+
"<|turn>model\n",
|
| 131 |
+
"<tool_response|>"
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
"soc_token": "<|channel>",
|
| 135 |
+
"sot_token": "<|turn>",
|
| 136 |
+
"stc_token": "<|tool_call>",
|
| 137 |
+
"std_token": "<|tool>",
|
| 138 |
+
"str_token": "<|tool_response>",
|
| 139 |
+
"think_token": "<|think|>",
|
| 140 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 141 |
+
"unk_token": "<unk>"
|
| 142 |
+
}
|
adapter/train_results.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"total_flos": 1.6958247325338173e+18,
|
| 3 |
+
"train_loss": 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_global_step": null,
|
| 3 |
+
"best_metric": null,
|
| 4 |
+
"best_model_checkpoint": null,
|
| 5 |
+
"epoch": 2.0,
|
| 6 |
+
"eval_steps": 9999,
|
| 7 |
+
"global_step": 458,
|
| 8 |
+
"is_hyper_param_search": false,
|
| 9 |
+
"is_local_process_zero": true,
|
| 10 |
+
"is_world_process_zero": true,
|
| 11 |
+
"log_history": [
|
| 12 |
+
{
|
| 13 |
+
"entropy": 1.0486987829208374,
|
| 14 |
+
"epoch": 0.04371584699453552,
|
| 15 |
+
"grad_norm": 8.0,
|
| 16 |
+
"learning_rate": 7.82608695652174e-05,
|
| 17 |
+
"loss": 5.89563102722168,
|
| 18 |
+
"mean_token_accuracy": 0.4319680668413639,
|
| 19 |
+
"num_tokens": 239087.0,
|
| 20 |
+
"step": 10
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"entropy": 0.884407639503479,
|
| 24 |
+
"epoch": 0.08743169398907104,
|
| 25 |
+
"grad_norm": 1.2578125,
|
| 26 |
+
"learning_rate": 0.00016521739130434784,
|
| 27 |
+
"loss": 2.102974700927734,
|
| 28 |
+
"mean_token_accuracy": 0.6724865823984146,
|
| 29 |
+
"num_tokens": 475150.0,
|
| 30 |
+
"step": 20
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"entropy": 1.1834268897771836,
|
| 34 |
+
"epoch": 0.13114754098360656,
|
| 35 |
+
"grad_norm": 0.70703125,
|
| 36 |
+
"learning_rate": 0.0001999061302243977,
|
| 37 |
+
"loss": 1.1062660217285156,
|
| 38 |
+
"mean_token_accuracy": 0.7651933252811431,
|
| 39 |
+
"num_tokens": 717465.0,
|
| 40 |
+
"step": 30
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"entropy": 0.7881059303879738,
|
| 44 |
+
"epoch": 0.17486338797814208,
|
| 45 |
+
"grad_norm": 0.302734375,
|
| 46 |
+
"learning_rate": 0.000199333119673151,
|
| 47 |
+
"loss": 0.7654059410095215,
|
| 48 |
+
"mean_token_accuracy": 0.8342122867703438,
|
| 49 |
+
"num_tokens": 966531.0,
|
| 50 |
+
"step": 40
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"entropy": 0.6791177123785019,
|
| 54 |
+
"epoch": 0.2185792349726776,
|
| 55 |
+
"grad_norm": 0.2890625,
|
| 56 |
+
"learning_rate": 0.00019824223223072895,
|
| 57 |
+
"loss": 0.6887028694152832,
|
| 58 |
+
"mean_token_accuracy": 0.8460865274071694,
|
| 59 |
+
"num_tokens": 1212977.0,
|
| 60 |
+
"step": 50
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"entropy": 0.6520723849534988,
|
| 64 |
+
"epoch": 0.26229508196721313,
|
| 65 |
+
"grad_norm": 16.125,
|
| 66 |
+
"learning_rate": 0.00019663915527913625,
|
| 67 |
+
"loss": 0.6579425811767579,
|
| 68 |
+
"mean_token_accuracy": 0.8477372005581856,
|
| 69 |
+
"num_tokens": 1453667.0,
|
| 70 |
+
"step": 60
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"entropy": 0.6275352656841278,
|
| 74 |
+
"epoch": 0.30601092896174864,
|
| 75 |
+
"grad_norm": 0.376953125,
|
| 76 |
+
"learning_rate": 0.00019453224651931635,
|
| 77 |
+
"loss": 0.6366048336029053,
|
| 78 |
+
"mean_token_accuracy": 0.853670459985733,
|
| 79 |
+
"num_tokens": 1700109.0,
|
| 80 |
+
"step": 70
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"entropy": 0.6275677800178527,
|
| 84 |
+
"epoch": 0.34972677595628415,
|
| 85 |
+
"grad_norm": 0.228515625,
|
| 86 |
+
"learning_rate": 0.00019193249039796854,
|
| 87 |
+
"loss": 0.629797887802124,
|
| 88 |
+
"mean_token_accuracy": 0.8567495480179786,
|
| 89 |
+
"num_tokens": 1956002.0,
|
| 90 |
+
"step": 80
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"entropy": 0.6235676869750023,
|
| 94 |
+
"epoch": 0.39344262295081966,
|
| 95 |
+
"grad_norm": 0.50390625,
|
| 96 |
+
"learning_rate": 0.00018885344083972914,
|
| 97 |
+
"loss": 0.6312247753143311,
|
| 98 |
+
"mean_token_accuracy": 0.852640126645565,
|
| 99 |
+
"num_tokens": 2204874.0,
|
| 100 |
+
"step": 90
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"entropy": 0.62629174888134,
|
| 104 |
+
"epoch": 0.4371584699453552,
|
| 105 |
+
"grad_norm": 0.41796875,
|
| 106 |
+
"learning_rate": 0.0001853111505832843,
|
| 107 |
+
"loss": 0.630945348739624,
|
| 108 |
+
"mean_token_accuracy": 0.8508004978299141,
|
| 109 |
+
"num_tokens": 2458424.0,
|
| 110 |
+
"step": 100
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"entropy": 0.6070425912737847,
|
| 114 |
+
"epoch": 0.4808743169398907,
|
| 115 |
+
"grad_norm": 0.3515625,
|
| 116 |
+
"learning_rate": 0.00018132408748982356,
|
| 117 |
+
"loss": 0.6076114654541016,
|
| 118 |
+
"mean_token_accuracy": 0.8586151331663132,
|
| 119 |
+
"num_tokens": 2703644.0,
|
| 120 |
+
"step": 110
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"entropy": 0.6136491641402244,
|
| 124 |
+
"epoch": 0.5245901639344263,
|
| 125 |
+
"grad_norm": 0.283203125,
|
| 126 |
+
"learning_rate": 0.0001769130382601629,
|
| 127 |
+
"loss": 0.6096392631530761,
|
| 128 |
+
"mean_token_accuracy": 0.8566672906279564,
|
| 129 |
+
"num_tokens": 2942548.0,
|
| 130 |
+
"step": 120
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"entropy": 0.5921711333096027,
|
| 134 |
+
"epoch": 0.5683060109289617,
|
| 135 |
+
"grad_norm": 0.203125,
|
| 136 |
+
"learning_rate": 0.00017210100006251163,
|
| 137 |
+
"loss": 0.6015676498413086,
|
| 138 |
+
"mean_token_accuracy": 0.856255167722702,
|
| 139 |
+
"num_tokens": 3198996.0,
|
| 140 |
+
"step": 130
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"entropy": 0.5744436584413052,
|
| 144 |
+
"epoch": 0.6120218579234973,
|
| 145 |
+
"grad_norm": 8.8125,
|
| 146 |
+
"learning_rate": 0.00016691306063588583,
|
| 147 |
+
"loss": 0.5779120445251464,
|
| 148 |
+
"mean_token_accuracy": 0.8660892397165298,
|
| 149 |
+
"num_tokens": 3437901.0,
|
| 150 |
+
"step": 140
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"entropy": 0.5826737284660339,
|
| 154 |
+
"epoch": 0.6557377049180327,
|
| 155 |
+
"grad_norm": 0.2412109375,
|
| 156 |
+
"learning_rate": 0.00016137626749425377,
|
| 157 |
+
"loss": 0.5811635494232178,
|
| 158 |
+
"mean_token_accuracy": 0.8659511938691139,
|
| 159 |
+
"num_tokens": 3683492.0,
|
| 160 |
+
"step": 150
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"entropy": 0.5969281956553459,
|
| 164 |
+
"epoch": 0.6994535519125683,
|
| 165 |
+
"grad_norm": 0.2216796875,
|
| 166 |
+
"learning_rate": 0.0001555194869133219,
|
| 167 |
+
"loss": 0.6036740779876709,
|
| 168 |
+
"mean_token_accuracy": 0.8583549842238426,
|
| 169 |
+
"num_tokens": 3935944.0,
|
| 170 |
+
"step": 160
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"entropy": 0.6209515765309334,
|
| 174 |
+
"epoch": 0.7431693989071039,
|
| 175 |
+
"grad_norm": 0.248046875,
|
| 176 |
+
"learning_rate": 0.00014937325343513953,
|
| 177 |
+
"loss": 0.6191730499267578,
|
| 178 |
+
"mean_token_accuracy": 0.8536601454019547,
|
| 179 |
+
"num_tokens": 4195223.0,
|
| 180 |
+
"step": 170
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"entropy": 0.573480324447155,
|
| 184 |
+
"epoch": 0.7868852459016393,
|
| 185 |
+
"grad_norm": 0.265625,
|
| 186 |
+
"learning_rate": 0.0001429696106751352,
|
| 187 |
+
"loss": 0.5765636444091797,
|
| 188 |
+
"mean_token_accuracy": 0.8647082209587097,
|
| 189 |
+
"num_tokens": 4435668.0,
|
| 190 |
+
"step": 180
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"entropy": 0.5718808308243751,
|
| 194 |
+
"epoch": 0.8306010928961749,
|
| 195 |
+
"grad_norm": 0.1982421875,
|
| 196 |
+
"learning_rate": 0.000136341944261543,
|
| 197 |
+
"loss": 0.5744711875915527,
|
| 198 |
+
"mean_token_accuracy": 0.8627334550023079,
|
| 199 |
+
"num_tokens": 4676607.0,
|
| 200 |
+
"step": 190
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"entropy": 0.5809279806911946,
|
| 204 |
+
"epoch": 0.8743169398907104,
|
| 205 |
+
"grad_norm": 0.8515625,
|
| 206 |
+
"learning_rate": 0.000129524807778196,
|
| 207 |
+
"loss": 0.5852269649505615,
|
| 208 |
+
"mean_token_accuracy": 0.8613690108060836,
|
| 209 |
+
"num_tokens": 4927228.0,
|
| 210 |
+
"step": 200
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"entropy": 0.5811030484735966,
|
| 214 |
+
"epoch": 0.9180327868852459,
|
| 215 |
+
"grad_norm": 0.73828125,
|
| 216 |
+
"learning_rate": 0.00012255374261813944,
|
| 217 |
+
"loss": 0.5799302101135254,
|
| 218 |
+
"mean_token_accuracy": 0.8622894912958146,
|
| 219 |
+
"num_tokens": 5174966.0,
|
| 220 |
+
"step": 210
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"entropy": 0.5655277840793133,
|
| 224 |
+
"epoch": 0.9617486338797814,
|
| 225 |
+
"grad_norm": 0.2080078125,
|
| 226 |
+
"learning_rate": 0.00011546509268726438,
|
| 227 |
+
"loss": 0.5731849670410156,
|
| 228 |
+
"mean_token_accuracy": 0.8623020827770234,
|
| 229 |
+
"num_tokens": 5424008.0,
|
| 230 |
+
"step": 220
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"entropy": 0.5541020051026956,
|
| 234 |
+
"epoch": 1.0043715846994536,
|
| 235 |
+
"grad_norm": 0.26171875,
|
| 236 |
+
"learning_rate": 0.00010829581492401102,
|
| 237 |
+
"loss": 0.5521286010742188,
|
| 238 |
+
"mean_token_accuracy": 0.8678772892707434,
|
| 239 |
+
"num_tokens": 5649285.0,
|
| 240 |
+
"step": 230
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"entropy": 0.5556444957852363,
|
| 244 |
+
"epoch": 1.048087431693989,
|
| 245 |
+
"grad_norm": 1.515625,
|
| 246 |
+
"learning_rate": 0.000101083286623004,
|
| 247 |
+
"loss": 0.5597594261169434,
|
| 248 |
+
"mean_token_accuracy": 0.8667374014854431,
|
| 249 |
+
"num_tokens": 5885960.0,
|
| 250 |
+
"step": 240
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"entropy": 0.5644011072814464,
|
| 254 |
+
"epoch": 1.0918032786885246,
|
| 255 |
+
"grad_norm": 0.8203125,
|
| 256 |
+
"learning_rate": 9.386511056714527e-05,
|
| 257 |
+
"loss": 0.565219783782959,
|
| 258 |
+
"mean_token_accuracy": 0.8634485810995102,
|
| 259 |
+
"num_tokens": 6135390.0,
|
| 260 |
+
"step": 250
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"entropy": 0.5583239279687404,
|
| 264 |
+
"epoch": 1.1355191256830601,
|
| 265 |
+
"grad_norm": 0.2734375,
|
| 266 |
+
"learning_rate": 8.667891898411531e-05,
|
| 267 |
+
"loss": 0.5607303619384766,
|
| 268 |
+
"mean_token_accuracy": 0.8667840331792831,
|
| 269 |
+
"num_tokens": 6399066.0,
|
| 270 |
+
"step": 260
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"entropy": 0.5657123997807503,
|
| 274 |
+
"epoch": 1.1792349726775957,
|
| 275 |
+
"grad_norm": 0.4609375,
|
| 276 |
+
"learning_rate": 7.956217734936353e-05,
|
| 277 |
+
"loss": 0.5595542907714843,
|
| 278 |
+
"mean_token_accuracy": 0.8627277389168739,
|
| 279 |
+
"num_tokens": 6645578.0,
|
| 280 |
+
"step": 270
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"entropy": 0.5563506670296192,
|
| 284 |
+
"epoch": 1.222950819672131,
|
| 285 |
+
"grad_norm": 0.3359375,
|
| 286 |
+
"learning_rate": 7.255198905846655e-05,
|
| 287 |
+
"loss": 0.5601570129394531,
|
| 288 |
+
"mean_token_accuracy": 0.8659737527370452,
|
| 289 |
+
"num_tokens": 6884408.0,
|
| 290 |
+
"step": 280
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"entropy": 0.5562774635851383,
|
| 294 |
+
"epoch": 1.2666666666666666,
|
| 295 |
+
"grad_norm": 0.57421875,
|
| 296 |
+
"learning_rate": 6.568490198720426e-05,
|
| 297 |
+
"loss": 0.5596513271331787,
|
| 298 |
+
"mean_token_accuracy": 0.8656521663069725,
|
| 299 |
+
"num_tokens": 7127266.0,
|
| 300 |
+
"step": 290
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"entropy": 0.5515452794730663,
|
| 304 |
+
"epoch": 1.3103825136612022,
|
| 305 |
+
"grad_norm": 0.216796875,
|
| 306 |
+
"learning_rate": 5.899671794785839e-05,
|
| 307 |
+
"loss": 0.5530119895935058,
|
| 308 |
+
"mean_token_accuracy": 0.8674060195684433,
|
| 309 |
+
"num_tokens": 7367949.0,
|
| 310 |
+
"step": 300
|
| 311 |
+
},
|
| 312 |
+
{
|
| 313 |
+
"entropy": 0.5612388111650943,
|
| 314 |
+
"epoch": 1.3540983606557377,
|
| 315 |
+
"grad_norm": 0.2578125,
|
| 316 |
+
"learning_rate": 5.252230603514081e-05,
|
| 317 |
+
"loss": 0.5572527885437012,
|
| 318 |
+
"mean_token_accuracy": 0.8650377497076989,
|
| 319 |
+
"num_tokens": 7602388.0,
|
| 320 |
+
"step": 310
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"entropy": 0.5349247701466083,
|
| 324 |
+
"epoch": 1.3978142076502733,
|
| 325 |
+
"grad_norm": 0.515625,
|
| 326 |
+
"learning_rate": 4.629542083487931e-05,
|
| 327 |
+
"loss": 0.5396371841430664,
|
| 328 |
+
"mean_token_accuracy": 0.8693908914923668,
|
| 329 |
+
"num_tokens": 7852679.0,
|
| 330 |
+
"step": 320
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"entropy": 0.5618424162268638,
|
| 334 |
+
"epoch": 1.4415300546448089,
|
| 335 |
+
"grad_norm": 45.0,
|
| 336 |
+
"learning_rate": 4.034852644323661e-05,
|
| 337 |
+
"loss": 0.5663045406341553,
|
| 338 |
+
"mean_token_accuracy": 0.8645561948418617,
|
| 339 |
+
"num_tokens": 8109647.0,
|
| 340 |
+
"step": 330
|
| 341 |
+
},
|
| 342 |
+
{
|
| 343 |
+
"entropy": 0.5594642959535122,
|
| 344 |
+
"epoch": 1.4852459016393442,
|
| 345 |
+
"grad_norm": 1.703125,
|
| 346 |
+
"learning_rate": 3.4712627213945084e-05,
|
| 347 |
+
"loss": 0.5558950424194335,
|
| 348 |
+
"mean_token_accuracy": 0.866220836341381,
|
| 349 |
+
"num_tokens": 8355525.0,
|
| 350 |
+
"step": 340
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"entropy": 0.5425299815833569,
|
| 354 |
+
"epoch": 1.5289617486338798,
|
| 355 |
+
"grad_norm": 2.34375,
|
| 356 |
+
"learning_rate": 2.941710611596271e-05,
|
| 357 |
+
"loss": 0.5427396774291993,
|
| 358 |
+
"mean_token_accuracy": 0.8683088988065719,
|
| 359 |
+
"num_tokens": 8601424.0,
|
| 360 |
+
"step": 350
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"entropy": 0.5427556604146957,
|
| 364 |
+
"epoch": 1.5726775956284151,
|
| 365 |
+
"grad_norm": 0.2421875,
|
| 366 |
+
"learning_rate": 2.4489571544277945e-05,
|
| 367 |
+
"loss": 0.5439925193786621,
|
| 368 |
+
"mean_token_accuracy": 0.8654883369803429,
|
| 369 |
+
"num_tokens": 8839615.0,
|
| 370 |
+
"step": 360
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"entropy": 0.5338973246514798,
|
| 374 |
+
"epoch": 1.6163934426229507,
|
| 375 |
+
"grad_norm": 0.255859375,
|
| 376 |
+
"learning_rate": 1.9955713382522113e-05,
|
| 377 |
+
"loss": 0.5421658992767334,
|
| 378 |
+
"mean_token_accuracy": 0.8713514551520347,
|
| 379 |
+
"num_tokens": 9083652.0,
|
| 380 |
+
"step": 370
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"entropy": 0.5581418260931968,
|
| 384 |
+
"epoch": 1.6601092896174863,
|
| 385 |
+
"grad_norm": 0.2578125,
|
| 386 |
+
"learning_rate": 1.5839169067811555e-05,
|
| 387 |
+
"loss": 0.556967830657959,
|
| 388 |
+
"mean_token_accuracy": 0.8669070154428482,
|
| 389 |
+
"num_tokens": 9332032.0,
|
| 390 |
+
"step": 380
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"entropy": 0.5558001473546028,
|
| 394 |
+
"epoch": 1.7038251366120218,
|
| 395 |
+
"grad_norm": 0.2275390625,
|
| 396 |
+
"learning_rate": 1.2161400356095375e-05,
|
| 397 |
+
"loss": 0.5525641441345215,
|
| 398 |
+
"mean_token_accuracy": 0.8654688194394111,
|
| 399 |
+
"num_tokens": 9578174.0,
|
| 400 |
+
"step": 390
|
| 401 |
+
},
|
| 402 |
+
{
|
| 403 |
+
"entropy": 0.5537898987531662,
|
| 404 |
+
"epoch": 1.7475409836065574,
|
| 405 |
+
"grad_norm": 0.435546875,
|
| 406 |
+
"learning_rate": 8.941581430497481e-06,
|
| 407 |
+
"loss": 0.5493928909301757,
|
| 408 |
+
"mean_token_accuracy": 0.865025418996811,
|
| 409 |
+
"num_tokens": 9824290.0,
|
| 410 |
+
"step": 400
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"entropy": 0.5512544997036457,
|
| 414 |
+
"epoch": 1.791256830601093,
|
| 415 |
+
"grad_norm": 0.36328125,
|
| 416 |
+
"learning_rate": 6.196498936004235e-06,
|
| 417 |
+
"loss": 0.5473986625671386,
|
| 418 |
+
"mean_token_accuracy": 0.8674423485994339,
|
| 419 |
+
"num_tokens": 10083095.0,
|
| 420 |
+
"step": 410
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"entropy": 0.5495157755911351,
|
| 424 |
+
"epoch": 1.8349726775956285,
|
| 425 |
+
"grad_norm": 0.203125,
|
| 426 |
+
"learning_rate": 3.940464461670135e-06,
|
| 427 |
+
"loss": 0.5492633819580078,
|
| 428 |
+
"mean_token_accuracy": 0.8675305873155594,
|
| 429 |
+
"num_tokens": 10326638.0,
|
| 430 |
+
"step": 420
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"entropy": 0.5277233310043812,
|
| 434 |
+
"epoch": 1.8786885245901639,
|
| 435 |
+
"grad_norm": 0.224609375,
|
| 436 |
+
"learning_rate": 2.1852399266194314e-06,
|
| 437 |
+
"loss": 0.5260457038879395,
|
| 438 |
+
"mean_token_accuracy": 0.8726123124361038,
|
| 439 |
+
"num_tokens": 10564686.0,
|
| 440 |
+
"step": 430
|
| 441 |
+
},
|
| 442 |
+
{
|
| 443 |
+
"entropy": 0.5520216427743435,
|
| 444 |
+
"epoch": 1.9224043715846995,
|
| 445 |
+
"grad_norm": 0.375,
|
| 446 |
+
"learning_rate": 9.399762588459204e-07,
|
| 447 |
+
"loss": 0.5484935283660889,
|
| 448 |
+
"mean_token_accuracy": 0.8669327393174171,
|
| 449 |
+
"num_tokens": 10821540.0,
|
| 450 |
+
"step": 440
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"entropy": 0.5562359377741813,
|
| 454 |
+
"epoch": 1.966120218579235,
|
| 455 |
+
"grad_norm": 0.3125,
|
| 456 |
+
"learning_rate": 2.1116568651156076e-07,
|
| 457 |
+
"loss": 0.5606791973114014,
|
| 458 |
+
"mean_token_accuracy": 0.8641782850027084,
|
| 459 |
+
"num_tokens": 11063652.0,
|
| 460 |
+
"step": 450
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"epoch": 2.0,
|
| 464 |
+
"eval_entropy": 0.5339264491839069,
|
| 465 |
+
"eval_loss": 0.5725216269493103,
|
| 466 |
+
"eval_mean_token_accuracy": 0.866687899189336,
|
| 467 |
+
"eval_num_tokens": 11252147.0,
|
| 468 |
+
"eval_runtime": 39.3277,
|
| 469 |
+
"eval_samples_per_second": 8.442,
|
| 470 |
+
"eval_steps_per_second": 1.424,
|
| 471 |
+
"step": 458
|
| 472 |
+
},
|
| 473 |
+
{
|
| 474 |
+
"epoch": 2.0,
|
| 475 |
+
"step": 458,
|
| 476 |
+
"total_flos": 1.6958247325338173e+18,
|
| 477 |
+
"train_loss": 0.7416771020431185,
|
| 478 |
+
"train_runtime": 5444.8575,
|
| 479 |
+
"train_samples_per_second": 2.016,
|
| 480 |
+
"train_steps_per_second": 0.084
|
| 481 |
+
}
|
| 482 |
+
],
|
| 483 |
+
"logging_steps": 10,
|
| 484 |
+
"max_steps": 458,
|
| 485 |
+
"num_input_tokens_seen": 0,
|
| 486 |
+
"num_train_epochs": 2,
|
| 487 |
+
"save_steps": 9999,
|
| 488 |
+
"stateful_callbacks": {
|
| 489 |
+
"TrainerControl": {
|
| 490 |
+
"args": {
|
| 491 |
+
"should_epoch_stop": false,
|
| 492 |
+
"should_evaluate": false,
|
| 493 |
+
"should_log": false,
|
| 494 |
+
"should_save": true,
|
| 495 |
+
"should_training_stop": true
|
| 496 |
+
},
|
| 497 |
+
"attributes": {}
|
| 498 |
+
}
|
| 499 |
+
},
|
| 500 |
+
"total_flos": 1.6958247325338173e+18,
|
| 501 |
+
"train_batch_size": 1,
|
| 502 |
+
"trial_name": null,
|
| 503 |
+
"trial_params": null
|
| 504 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#
|
| 2 |
+
Template: Google Gemma 4 Canonical Chat Template
|
| 3 |
+
Author: Google Gemma Engineering Team
|
| 4 |
+
Published: 2026-07-09
|
| 5 |
+
Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.
|
| 6 |
+
#}
|
| 7 |
+
{%- macro format_parameters(properties, required, filter_keys=false) -%}
|
| 8 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 9 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 10 |
+
{%- for key, value in properties | dictsort -%}
|
| 11 |
+
{%- set add_comma = false -%}
|
| 12 |
+
{%- if not filter_keys or key not in standard_keys -%}
|
| 13 |
+
{%- if ns.found_first %},{% endif -%}
|
| 14 |
+
{%- set ns.found_first = true -%}
|
| 15 |
+
{{ key }}:{
|
| 16 |
+
{%- if value['description'] -%}
|
| 17 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 18 |
+
{%- set add_comma = true -%}
|
| 19 |
+
{%- endif -%}
|
| 20 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 21 |
+
{%- if value['enum'] -%}
|
| 22 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 23 |
+
enum:{{ format_argument(value['enum']) }}
|
| 24 |
+
{%- endif -%}
|
| 25 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 26 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 27 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 28 |
+
items:{
|
| 29 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 30 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 31 |
+
{%- if item_value is not none -%}
|
| 32 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 33 |
+
{%- set ns_items.found_first = true -%}
|
| 34 |
+
{%- if item_key == 'properties' -%}
|
| 35 |
+
properties:{
|
| 36 |
+
{%- if item_value is mapping -%}
|
| 37 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 38 |
+
{%- endif -%}
|
| 39 |
+
}
|
| 40 |
+
{%- elif item_key == 'required' -%}
|
| 41 |
+
required:[
|
| 42 |
+
{%- for req_item in item_value -%}
|
| 43 |
+
<|"|>{{- req_item -}}<|"|>
|
| 44 |
+
{%- if not loop.last %},{% endif -%}
|
| 45 |
+
{%- endfor -%}
|
| 46 |
+
]
|
| 47 |
+
{%- elif item_key == 'type' -%}
|
| 48 |
+
{%- if item_value is string -%}
|
| 49 |
+
type:{{ format_argument(item_value | upper) }}
|
| 50 |
+
{%- else -%}
|
| 51 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 52 |
+
{%- endif -%}
|
| 53 |
+
{%- else -%}
|
| 54 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 55 |
+
{%- endif -%}
|
| 56 |
+
{%- endif -%}
|
| 57 |
+
{%- endfor -%}
|
| 58 |
+
}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{%- endif -%}
|
| 61 |
+
{%- if value['nullable'] %}
|
| 62 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 63 |
+
nullable:true
|
| 64 |
+
{%- endif -%}
|
| 65 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 66 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 67 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 68 |
+
properties:{
|
| 69 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 70 |
+
}
|
| 71 |
+
{%- elif value is mapping -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
properties:{
|
| 74 |
+
{{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
|
| 75 |
+
}
|
| 76 |
+
{%- endif -%}
|
| 77 |
+
{%- if value['required'] -%}
|
| 78 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 79 |
+
required:[
|
| 80 |
+
{%- for item in value['required'] | default([]) -%}
|
| 81 |
+
<|"|>{{- item -}}<|"|>
|
| 82 |
+
{%- if not loop.last %},{% endif -%}
|
| 83 |
+
{%- endfor -%}
|
| 84 |
+
]
|
| 85 |
+
{%- endif -%}
|
| 86 |
+
{%- endif -%}
|
| 87 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 88 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 89 |
+
{%- endif -%}
|
| 90 |
+
{%- endfor -%}
|
| 91 |
+
{%- endmacro -%}
|
| 92 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 93 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 94 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 95 |
+
{%- if params -%}
|
| 96 |
+
,parameters:{
|
| 97 |
+
{%- if params['properties'] -%}
|
| 98 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 99 |
+
{%- endif -%}
|
| 100 |
+
{%- if params['required'] -%}
|
| 101 |
+
required:[
|
| 102 |
+
{%- for item in params['required'] -%}
|
| 103 |
+
<|"|>{{- item -}}<|"|>
|
| 104 |
+
{{- ',' if not loop.last -}}
|
| 105 |
+
{%- endfor -%}
|
| 106 |
+
],
|
| 107 |
+
{%- endif -%}
|
| 108 |
+
{%- if params['type'] -%}
|
| 109 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 110 |
+
{%- endif -%}
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 113 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 114 |
+
,response:{
|
| 115 |
+
{%- if response_declaration['description'] -%}
|
| 116 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 117 |
+
{%- endif -%}
|
| 118 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 119 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 120 |
+
{%- endif -%}
|
| 121 |
+
{%- endif -%}
|
| 122 |
+
}
|
| 123 |
+
{%- endmacro -%}
|
| 124 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 125 |
+
{%- if argument is none -%}
|
| 126 |
+
{{- 'null' -}}
|
| 127 |
+
{%- elif argument is string -%}
|
| 128 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 129 |
+
{%- elif argument is boolean -%}
|
| 130 |
+
{{- 'true' if argument else 'false' -}}
|
| 131 |
+
{%- elif argument is mapping -%}
|
| 132 |
+
{{- '{' -}}
|
| 133 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 134 |
+
{%- for key, value in argument | dictsort -%}
|
| 135 |
+
{%- if ns.found_first %},{% endif -%}
|
| 136 |
+
{%- set ns.found_first = true -%}
|
| 137 |
+
{%- if escape_keys -%}
|
| 138 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 139 |
+
{%- else -%}
|
| 140 |
+
{{- key -}}
|
| 141 |
+
{%- endif -%}
|
| 142 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 143 |
+
{%- endfor -%}
|
| 144 |
+
{{- '}' -}}
|
| 145 |
+
{%- elif argument is sequence -%}
|
| 146 |
+
{{- '[' -}}
|
| 147 |
+
{%- for item in argument -%}
|
| 148 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 149 |
+
{%- if not loop.last %},{% endif -%}
|
| 150 |
+
{%- endfor -%}
|
| 151 |
+
{{- ']' -}}
|
| 152 |
+
{%- else -%}
|
| 153 |
+
{{- argument -}}
|
| 154 |
+
{%- endif -%}
|
| 155 |
+
{%- endmacro -%}
|
| 156 |
+
{%- macro strip_thinking(text) -%}
|
| 157 |
+
{%- set ns = namespace(result='') -%}
|
| 158 |
+
{%- for part in text.split('<channel|>') -%}
|
| 159 |
+
{%- if '<|channel>' in part -%}
|
| 160 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 161 |
+
{%- else -%}
|
| 162 |
+
{%- set ns.result = ns.result + part -%}
|
| 163 |
+
{%- endif -%}
|
| 164 |
+
{%- endfor -%}
|
| 165 |
+
{{- ns.result | trim -}}
|
| 166 |
+
{%- endmacro -%}
|
| 167 |
+
|
| 168 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 169 |
+
{{- '<|tool_response>' -}}
|
| 170 |
+
{%- if response is mapping -%}
|
| 171 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 172 |
+
{%- for key, value in response | dictsort -%}
|
| 173 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 174 |
+
{%- if not loop.last %},{% endif -%}
|
| 175 |
+
{%- endfor -%}
|
| 176 |
+
{{- '}' -}}
|
| 177 |
+
{%- else -%}
|
| 178 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 179 |
+
{%- endif -%}
|
| 180 |
+
{{- '<tool_response|>' -}}
|
| 181 |
+
{%- endmacro -%}
|
| 182 |
+
|
| 183 |
+
{#- ===== SETUP ===== -#}
|
| 184 |
+
{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
|
| 185 |
+
{%- set loop_messages = messages -%}
|
| 186 |
+
{%- set enable_thinking = enable_thinking | default(false) -%}
|
| 187 |
+
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 188 |
+
{{- bos_token -}}
|
| 189 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 190 |
+
{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
|
| 191 |
+
{{- '<|turn>system\n' -}}
|
| 192 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 193 |
+
{%- if enable_thinking -%}
|
| 194 |
+
{{- '<|think|>\n' -}}
|
| 195 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 196 |
+
{%- endif -%}
|
| 197 |
+
{%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
|
| 198 |
+
{%- if messages[0]['content'] is string -%}
|
| 199 |
+
{{- messages[0]['content'] | trim -}}
|
| 200 |
+
{%- elif messages[0]['content'] is sequence -%}
|
| 201 |
+
{%- for item in messages[0]['content'] -%}
|
| 202 |
+
{{- item['text'] | trim + ' '-}}
|
| 203 |
+
{%- endfor -%}
|
| 204 |
+
{%- endif -%}
|
| 205 |
+
{%- set loop_messages = messages[1:] -%}
|
| 206 |
+
{%- endif -%}
|
| 207 |
+
{%- if tools -%}
|
| 208 |
+
{%- for tool in tools %}
|
| 209 |
+
{{- '<|tool>' -}}
|
| 210 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 211 |
+
{{- '<tool|>' -}}
|
| 212 |
+
{%- endfor %}
|
| 213 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 214 |
+
{%- endif -%}
|
| 215 |
+
{{- '<turn|>\n' -}}
|
| 216 |
+
{%- endif %}
|
| 217 |
+
|
| 218 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 219 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 220 |
+
{%- for i in range(loop_messages | length) -%}
|
| 221 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 222 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 223 |
+
{%- endif -%}
|
| 224 |
+
{%- endfor -%}
|
| 225 |
+
|
| 226 |
+
{#- Loop through messages -#}
|
| 227 |
+
{%- for message in loop_messages -%}
|
| 228 |
+
{%- if message['role'] != 'tool' -%}
|
| 229 |
+
{%- set ns.prev_message_type = None -%}
|
| 230 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 231 |
+
{#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
|
| 232 |
+
{%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
|
| 233 |
+
{%- if not continue_same_model_turn -%}
|
| 234 |
+
{{- '<|turn>' + role + '\n' }}
|
| 235 |
+
|
| 236 |
+
{%- endif -%}
|
| 237 |
+
|
| 238 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 239 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 240 |
+
{%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
|
| 241 |
+
{%- if thinking_text and thinking_gate -%}
|
| 242 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 243 |
+
{%- endif -%}
|
| 244 |
+
|
| 245 |
+
{%- if message.get('tool_calls') -%}
|
| 246 |
+
{%- for tool_call in message.get('tool_calls') -%}
|
| 247 |
+
{%- set function = tool_call['function'] -%}
|
| 248 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 249 |
+
{%- if function['arguments'] is mapping -%}
|
| 250 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 251 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 252 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 253 |
+
{%- set ns_args.found_first = true -%}
|
| 254 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 255 |
+
{%- endfor -%}
|
| 256 |
+
{%- elif function['arguments'] is none -%}
|
| 257 |
+
{%- else -%}
|
| 258 |
+
{{- raise_exception(
|
| 259 |
+
"chat_template: tool_calls[].function.arguments must be a "
|
| 260 |
+
"JSON object (mapping), not a string. Deserialize arguments "
|
| 261 |
+
"before passing to the template."
|
| 262 |
+
) -}}
|
| 263 |
+
{%- endif -%}
|
| 264 |
+
{{- '}<tool_call|>' -}}
|
| 265 |
+
{%- endfor -%}
|
| 266 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 267 |
+
{%- endif -%}
|
| 268 |
+
|
| 269 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 270 |
+
{%- if message.get('tool_responses') -%}
|
| 271 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 272 |
+
{%- for tool_response in message.get('tool_responses') -%}
|
| 273 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
|
| 274 |
+
{%- set ns_tr_out.flag = true -%}
|
| 275 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 276 |
+
{%- endfor -%}
|
| 277 |
+
{%- elif message.get('tool_calls') -%}
|
| 278 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 279 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 280 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 281 |
+
{%- if ns_tool_scan.stopped -%}
|
| 282 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 283 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 284 |
+
{%- else -%}
|
| 285 |
+
{%- set follow = loop_messages[k] -%}
|
| 286 |
+
{#- Resolve tool_call_id to function name -#}
|
| 287 |
+
{%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
|
| 288 |
+
{%- for tc in message.get('tool_calls') -%}
|
| 289 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 290 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 291 |
+
{%- endif -%}
|
| 292 |
+
{%- endfor -%}
|
| 293 |
+
{#- Handle content as string or content-parts array -#}
|
| 294 |
+
{%- set tool_body = follow.get('content') -%}
|
| 295 |
+
{%- if tool_body is string -%}
|
| 296 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 297 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 298 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 299 |
+
{%- for part in tool_body -%}
|
| 300 |
+
{%- if part.get('type') == 'text' -%}
|
| 301 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 302 |
+
{%- endif -%}
|
| 303 |
+
{%- endfor -%}
|
| 304 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 305 |
+
{%- for part in tool_body -%}
|
| 306 |
+
{%- if part.get('type') in ['image', 'image_url'] -%}
|
| 307 |
+
{{- '<|image|>' -}}
|
| 308 |
+
{%- elif part.get('type') in ['audio', 'input_audio'] -%}
|
| 309 |
+
{{- '<|audio|>' -}}
|
| 310 |
+
{%- elif part.get('type') == 'video' -%}
|
| 311 |
+
{{- '<|video|>' -}}
|
| 312 |
+
{%- endif -%}
|
| 313 |
+
{%- endfor -%}
|
| 314 |
+
{%- else -%}
|
| 315 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 316 |
+
{%- endif -%}
|
| 317 |
+
{%- set ns_tr_out.flag = true -%}
|
| 318 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 319 |
+
{%- endif -%}
|
| 320 |
+
{%- endfor -%}
|
| 321 |
+
{%- endif -%}
|
| 322 |
+
|
| 323 |
+
{%- set captured_content -%}
|
| 324 |
+
{%- if message.get('content') is string -%}
|
| 325 |
+
{%- if role == 'model' -%}
|
| 326 |
+
{{- strip_thinking(message['content']) -}}
|
| 327 |
+
{%- else -%}
|
| 328 |
+
{{- message['content'] | trim -}}
|
| 329 |
+
{%- endif -%}
|
| 330 |
+
{%- elif message.get('content') is sequence -%}
|
| 331 |
+
{%- for item in message['content'] -%}
|
| 332 |
+
{%- if item.get('type') == 'text' -%}
|
| 333 |
+
{%- if role == 'model' -%}
|
| 334 |
+
{{- strip_thinking(item['text']) -}}
|
| 335 |
+
{%- else -%}
|
| 336 |
+
{{- item['text'] | trim -}}
|
| 337 |
+
{%- endif -%}
|
| 338 |
+
{%- elif item.get('type') in ['image', 'image_url'] -%}
|
| 339 |
+
{{- '<|image|>' -}}
|
| 340 |
+
{%- elif item.get('type') in ['audio', 'input_audio'] -%}
|
| 341 |
+
{{- '<|audio|>' -}}
|
| 342 |
+
{%- elif item.get('type') == 'video' -%}
|
| 343 |
+
{{- '<|video|>' -}}
|
| 344 |
+
{%- endif -%}
|
| 345 |
+
{%- endfor -%}
|
| 346 |
+
{%- endif -%}
|
| 347 |
+
{%- endset -%}
|
| 348 |
+
|
| 349 |
+
{{- captured_content -}}
|
| 350 |
+
{%- set has_content = captured_content | trim | length > 0 -%}
|
| 351 |
+
|
| 352 |
+
{#- Forward-scan: find next non-tool message role for continuation detection -#}
|
| 353 |
+
{%- set next_nt = namespace(role=None, found=false) -%}
|
| 354 |
+
{%- for j in range(loop.index0 + 1, loop_messages | length) -%}
|
| 355 |
+
{%- if not next_nt.found -%}
|
| 356 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 357 |
+
{%- set next_nt.role = loop_messages[j]['role'] -%}
|
| 358 |
+
{%- set next_nt.found = true -%}
|
| 359 |
+
{%- endif -%}
|
| 360 |
+
{%- endif -%}
|
| 361 |
+
{%- endfor -%}
|
| 362 |
+
|
| 363 |
+
{%- set continues_into_next = (
|
| 364 |
+
role == 'model'
|
| 365 |
+
and next_nt.role == 'assistant'
|
| 366 |
+
and (not message.get('tool_calls') or ns_tr_out.flag)
|
| 367 |
+
) -%}
|
| 368 |
+
|
| 369 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 370 |
+
{{- '<|tool_response>' -}}
|
| 371 |
+
{%- elif continues_into_next -%}
|
| 372 |
+
{%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
|
| 373 |
+
{{- '<turn|>\n' -}}
|
| 374 |
+
{%- endif -%}
|
| 375 |
+
|
| 376 |
+
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
|
| 377 |
+
{%- set ns.prev_non_tool_role = message['role'] -%}
|
| 378 |
+
{%- endif -%}
|
| 379 |
+
{%- endfor -%}
|
| 380 |
+
|
| 381 |
+
{%- if add_generation_prompt -%}
|
| 382 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 383 |
+
{{- '<|turn>model\n' -}}
|
| 384 |
+
{%- if not enable_thinking -%}
|
| 385 |
+
{{- '<|channel>thought\n<channel|>' -}}
|
| 386 |
+
{%- endif -%}
|
| 387 |
+
{%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
|
| 388 |
+
{{- '<|channel>thought\n' -}}
|
| 389 |
+
{%- endif -%}
|
| 390 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Gemma4ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"audio_config": null,
|
| 6 |
+
"audio_token_id": 258881,
|
| 7 |
+
"boa_token_id": 256000,
|
| 8 |
+
"boi_token_id": 255999,
|
| 9 |
+
"dtype": "bfloat16",
|
| 10 |
+
"eoa_token_id": 258883,
|
| 11 |
+
"eoa_token_index": 258883,
|
| 12 |
+
"eoi_token_id": 258882,
|
| 13 |
+
"eos_token_id": [
|
| 14 |
+
1,
|
| 15 |
+
106
|
| 16 |
+
],
|
| 17 |
+
"image_token_id": 258880,
|
| 18 |
+
"initializer_range": 0.02,
|
| 19 |
+
"model_type": "gemma4",
|
| 20 |
+
"text_config": {
|
| 21 |
+
"attention_bias": false,
|
| 22 |
+
"attention_dropout": 0.0,
|
| 23 |
+
"attention_k_eq_v": true,
|
| 24 |
+
"bos_token_id": 2,
|
| 25 |
+
"dtype": "bfloat16",
|
| 26 |
+
"enable_moe_block": true,
|
| 27 |
+
"eos_token_id": 1,
|
| 28 |
+
"final_logit_softcapping": 30.0,
|
| 29 |
+
"global_head_dim": 512,
|
| 30 |
+
"head_dim": 256,
|
| 31 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 32 |
+
"hidden_size": 2816,
|
| 33 |
+
"hidden_size_per_layer_input": 0,
|
| 34 |
+
"initializer_range": 0.02,
|
| 35 |
+
"intermediate_size": 2112,
|
| 36 |
+
"layer_types": [
|
| 37 |
+
"sliding_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"sliding_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"sliding_attention",
|
| 58 |
+
"sliding_attention",
|
| 59 |
+
"sliding_attention",
|
| 60 |
+
"full_attention",
|
| 61 |
+
"sliding_attention",
|
| 62 |
+
"sliding_attention",
|
| 63 |
+
"sliding_attention",
|
| 64 |
+
"sliding_attention",
|
| 65 |
+
"sliding_attention",
|
| 66 |
+
"full_attention"
|
| 67 |
+
],
|
| 68 |
+
"max_position_embeddings": 262144,
|
| 69 |
+
"model_type": "gemma4_text",
|
| 70 |
+
"moe_intermediate_size": 704,
|
| 71 |
+
"num_attention_heads": 16,
|
| 72 |
+
"num_experts": 128,
|
| 73 |
+
"num_global_key_value_heads": 2,
|
| 74 |
+
"num_hidden_layers": 30,
|
| 75 |
+
"num_key_value_heads": 8,
|
| 76 |
+
"num_kv_shared_layers": 0,
|
| 77 |
+
"pad_token_id": 0,
|
| 78 |
+
"rms_norm_eps": 1e-06,
|
| 79 |
+
"rope_parameters": {
|
| 80 |
+
"full_attention": {
|
| 81 |
+
"partial_rotary_factor": 0.25,
|
| 82 |
+
"rope_theta": 1000000.0,
|
| 83 |
+
"rope_type": "proportional"
|
| 84 |
+
},
|
| 85 |
+
"sliding_attention": {
|
| 86 |
+
"rope_theta": 10000.0,
|
| 87 |
+
"rope_type": "default"
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
"sliding_window": 1024,
|
| 91 |
+
"tie_word_embeddings": true,
|
| 92 |
+
"top_k_experts": 8,
|
| 93 |
+
"use_bidirectional_attention": "vision",
|
| 94 |
+
"use_cache": true,
|
| 95 |
+
"use_double_wide_mlp": false,
|
| 96 |
+
"vocab_size": 262144,
|
| 97 |
+
"vocab_size_per_layer_input": 262144
|
| 98 |
+
},
|
| 99 |
+
"tie_word_embeddings": true,
|
| 100 |
+
"transformers_version": "5.6.2",
|
| 101 |
+
"video_token_id": 258884,
|
| 102 |
+
"vision_config": {
|
| 103 |
+
"_name_or_path": "",
|
| 104 |
+
"architectures": null,
|
| 105 |
+
"attention_bias": false,
|
| 106 |
+
"attention_dropout": 0.0,
|
| 107 |
+
"chunk_size_feed_forward": 0,
|
| 108 |
+
"default_output_length": 280,
|
| 109 |
+
"dtype": "bfloat16",
|
| 110 |
+
"global_head_dim": 72,
|
| 111 |
+
"head_dim": 72,
|
| 112 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 113 |
+
"hidden_size": 1152,
|
| 114 |
+
"id2label": {
|
| 115 |
+
"0": "LABEL_0",
|
| 116 |
+
"1": "LABEL_1"
|
| 117 |
+
},
|
| 118 |
+
"initializer_range": 0.02,
|
| 119 |
+
"intermediate_size": 4304,
|
| 120 |
+
"is_encoder_decoder": false,
|
| 121 |
+
"label2id": {
|
| 122 |
+
"LABEL_0": 0,
|
| 123 |
+
"LABEL_1": 1
|
| 124 |
+
},
|
| 125 |
+
"max_position_embeddings": 131072,
|
| 126 |
+
"model_type": "gemma4_vision",
|
| 127 |
+
"num_attention_heads": 16,
|
| 128 |
+
"num_hidden_layers": 27,
|
| 129 |
+
"num_key_value_heads": 16,
|
| 130 |
+
"output_attentions": false,
|
| 131 |
+
"output_hidden_states": false,
|
| 132 |
+
"patch_size": 16,
|
| 133 |
+
"pooling_kernel_size": 3,
|
| 134 |
+
"position_embedding_size": 10240,
|
| 135 |
+
"problem_type": null,
|
| 136 |
+
"return_dict": true,
|
| 137 |
+
"rms_norm_eps": 1e-06,
|
| 138 |
+
"rope_parameters": {
|
| 139 |
+
"rope_theta": 100.0,
|
| 140 |
+
"rope_type": "default"
|
| 141 |
+
},
|
| 142 |
+
"standardize": true,
|
| 143 |
+
"use_clipped_linears": false
|
| 144 |
+
},
|
| 145 |
+
"vision_soft_tokens_per_image": 280
|
| 146 |
+
}
|
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.2"
|
| 14 |
+
}
|
model-00001-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3a61f56ebfb5fb19579f120bbc587289b579e9efc84a76819dc068bff54609a
|
| 3 |
+
size 4739268972
|
model-00002-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab854e612c87cbcc6c8481fd7f159b0e3c2e83b2c04b2a8ef77633aff44e1402
|
| 3 |
+
size 4884578470
|
model-00003-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cbc3f975c9b1157b4907a6cd5299d49c22a7568ad6b4922d09a4d43693678ce5
|
| 3 |
+
size 4913415198
|
model-00004-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a868c0852695fceabeb2305b394c5b4b4e988b3d1a90563eef7ea970d25e232f
|
| 3 |
+
size 4884578494
|
model-00005-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c3a8b6f83ed0b3955aa4d4ba5040914cb623ef1b3e5356cb0564f12aa9ecb15
|
| 3 |
+
size 4913415262
|
model-00006-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c4cfe3b47ca6dccc3afe61741869535d3a08fa467e3030b0bf4f20412a11ad88
|
| 3 |
+
size 4884578534
|
model-00007-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c0e184f731ef88dfedeaf52da2d79b57446c90e04ac72faeb1d3570ee2e8854
|
| 3 |
+
size 4913415262
|
model-00008-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a46e1c90025a64f358a0c5f223bc63c1d72a5052880cf05348b3a057cbaa44e6
|
| 3 |
+
size 4884578534
|
model-00009-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60fd9accca5e3c48a08afb419eb7f99bb9ec2f288d569fb68646e7b462d12c95
|
| 3 |
+
size 4913415262
|
model-00010-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0819d4eea875d63da923e995f32fde738a8df20de4a174a3d1f0a4df0792c5a7
|
| 3 |
+
size 4884578534
|
model-00011-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79cb5494f36fd110674a900afdc7838275d3617500b7754fcf82e333b5a98ade
|
| 3 |
+
size 2796186042
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
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,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|>",
|
| 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": "right",
|
| 46 |
+
"processor_class": "Gemma4Processor",
|
| 47 |
+
"response_schema": {
|
| 48 |
+
"properties": {
|
| 49 |
+
"content": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
+
"role": {
|
| 53 |
+
"const": "assistant"
|
| 54 |
+
},
|
| 55 |
+
"thinking": {
|
| 56 |
+
"type": "string"
|
| 57 |
+
},
|
| 58 |
+
"tool_calls": {
|
| 59 |
+
"items": {
|
| 60 |
+
"properties": {
|
| 61 |
+
"function": {
|
| 62 |
+
"properties": {
|
| 63 |
+
"arguments": {
|
| 64 |
+
"additionalProperties": {},
|
| 65 |
+
"type": "object",
|
| 66 |
+
"x-parser": "gemma4-tool-call"
|
| 67 |
+
},
|
| 68 |
+
"name": {
|
| 69 |
+
"type": "string"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"type": "object",
|
| 73 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 74 |
+
},
|
| 75 |
+
"type": {
|
| 76 |
+
"const": "function"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"type": "object"
|
| 80 |
+
},
|
| 81 |
+
"type": "array",
|
| 82 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 83 |
+
}
|
| 84 |
+
},
|
| 85 |
+
"type": "object",
|
| 86 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 87 |
+
},
|
| 88 |
+
"response_template": {
|
| 89 |
+
"defaults": {
|
| 90 |
+
"role": "assistant"
|
| 91 |
+
},
|
| 92 |
+
"fields": {
|
| 93 |
+
"content": {
|
| 94 |
+
"close": [
|
| 95 |
+
"<turn|>",
|
| 96 |
+
"<|tool_response>",
|
| 97 |
+
"<eos>"
|
| 98 |
+
],
|
| 99 |
+
"content": "text"
|
| 100 |
+
},
|
| 101 |
+
"thinking": {
|
| 102 |
+
"close": "<channel|>",
|
| 103 |
+
"content": "text",
|
| 104 |
+
"open": "<|channel>thought\n"
|
| 105 |
+
},
|
| 106 |
+
"tool_calls": {
|
| 107 |
+
"close": "<tool_call|>",
|
| 108 |
+
"content": "json",
|
| 109 |
+
"content_args": {
|
| 110 |
+
"string_delims": [
|
| 111 |
+
[
|
| 112 |
+
"<|\"|>",
|
| 113 |
+
"<|\"|>"
|
| 114 |
+
]
|
| 115 |
+
],
|
| 116 |
+
"unquoted_keys": true
|
| 117 |
+
},
|
| 118 |
+
"open_pattern": "<\\|tool_call>call:(?P<name>\\w+)",
|
| 119 |
+
"repeats": true,
|
| 120 |
+
"transform": {
|
| 121 |
+
"function": {
|
| 122 |
+
"arguments": "{content}",
|
| 123 |
+
"name": "{name}"
|
| 124 |
+
},
|
| 125 |
+
"type": "function"
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
"start_anchor": [
|
| 130 |
+
"<|turn>model\n",
|
| 131 |
+
"<tool_response|>"
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
"soc_token": "<|channel>",
|
| 135 |
+
"sot_token": "<|turn>",
|
| 136 |
+
"stc_token": "<|tool_call>",
|
| 137 |
+
"std_token": "<|tool>",
|
| 138 |
+
"str_token": "<|tool_response>",
|
| 139 |
+
"think_token": "<|think|>",
|
| 140 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 141 |
+
"unk_token": "<unk>"
|
| 142 |
+
}
|