Instructions to use DumpingZone/G4-Intermediate-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DumpingZone/G4-Intermediate-SFT with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("DumpingZone/G4-Intermediate-SFT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+6
- README.mdAdded+58
- Writer-SFT/README.mdAdded+208
- Writer-SFT/adapter_config.jsonAdded+46
- Writer-SFT/adapter_model.safetensorsAdded+3
- Writer-SFT/chat_template.jinjaAdded+390
- Writer-SFT/tokenizer.jsonAdded+3
- Writer-SFT/tokenizer_config.jsonAdded+142
- checkpoint-168/README.mdAdded+208
- checkpoint-168/adapter_config.jsonAdded+46
- checkpoint-168/adapter_model.safetensorsAdded+3
- checkpoint-168/chat_template.jinjaAdded+403
- checkpoint-168/optimizer.ptAdded+3
- checkpoint-168/rng_state.pthAdded+3
- checkpoint-168/scheduler.ptAdded+3
- checkpoint-168/tokenizer.jsonAdded+3
- checkpoint-168/tokenizer_config.jsonAdded+142
- checkpoint-168/trainer_state.jsonAdded+1882
- checkpoint-168/training_args.binAdded+3
- checkpoint-336/README.mdAdded+208
- checkpoint-336/adapter_config.jsonAdded+46
- checkpoint-336/adapter_model.safetensorsAdded+3
- checkpoint-336/chat_template.jinjaAdded+403
- checkpoint-336/optimizer.ptAdded+3
- checkpoint-336/rng_state.pthAdded+3
- checkpoint-336/scheduler.ptAdded+3
- checkpoint-336/tokenizer.jsonAdded+3
- checkpoint-336/tokenizer_config.jsonAdded+142
- checkpoint-336/trainer_state.jsonAdded
- checkpoint-336/training_args.binAdded+3
- checkpoint-504/README.mdAdded+208
- checkpoint-504/adapter_config.jsonAdded+46
- checkpoint-504/adapter_model.safetensorsAdded+3
- checkpoint-504/chat_template.jinjaAdded+403
- checkpoint-504/optimizer.ptAdded+3
- checkpoint-504/rng_state.pthAdded+3
- checkpoint-504/scheduler.ptAdded+3
- checkpoint-504/tokenizer.jsonAdded+3
- checkpoint-504/tokenizer_config.jsonAdded+142
- checkpoint-504/trainer_state.jsonAdded
- checkpoint-504/training_args.binAdded+3
- checkpoint-672/README.mdAdded+208
- checkpoint-672/adapter_config.jsonAdded+46
- checkpoint-672/adapter_model.safetensorsAdded+3
- checkpoint-672/chat_template.jinjaAdded+403
- checkpoint-672/optimizer.ptAdded+3
- checkpoint-672/rng_state.pthAdded+3
- checkpoint-672/scheduler.ptAdded+3
- checkpoint-672/tokenizer.jsonAdded+3
- checkpoint-672/tokenizer_config.jsonAdded+142
32 unmodified lines33343536373839404132 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textWriter-SFT/tokenizer.json filter=lfs diff=lfs merge=lfs -textcheckpoint-168/tokenizer.json filter=lfs diff=lfs merge=lfs -textcheckpoint-336/tokenizer.json filter=lfs diff=lfs merge=lfs -textcheckpoint-504/tokenizer.json filter=lfs diff=lfs merge=lfs -textcheckpoint-672/tokenizer.json filter=lfs diff=lfs merge=lfs -textcheckpoint-840/tokenizer.json filter=lfs diff=lfs merge=lfs -text12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758---base_model: google/gemma-4-31B-itlibrary_name: transformersmodel_name: SFTtags:- generated_from_trainer- sft- trllicence: license---
# Model Card for SFT
This model is a fine-tuned version of [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it).It has been trained using [TRL](https://github.com/huggingface/trl).
## Quick start
```pythonfrom transformers import pipeline
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"generator = pipeline("text-generation", model="None", device_map="auto")output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]print(output["generated_text"])```
## Training procedure
This model was trained with SFT.
### Framework versions
- TRL: 1.18.1- Transformers: 5.23.0- Pytorch: 2.13.0+cu129- Datasets: 5.2.0- Tokenizers: 0.23.3
## Citations
Cite TRL as: ```bibtex@software{vonwerra2020trl, title = {{TRL: Transformers Reinforcement Learning}}, author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin and Dirhoussi, Amine}, license = {Apache-2.0}, url = {https://github.com/huggingface/trl}, year = {2020}}```123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208---base_model: google/gemma-4-31B-itlibrary_name: pefttags:- base_model:adapter:google/gemma-4-31B-it- lora- sft- transformers- trl---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** [More Information Needed]- **Funded by [optional]:** [More Information Needed]- **Shared by [optional]:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** [More Information Needed]- **Paper [optional]:** [More Information Needed]- **Demo [optional]:** [More Information Needed]
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
[More Information Needed]
### Downstream Use [optional]
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
[More Information Needed]
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
[More Information Needed]
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
[More Information Needed]
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
## How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
[More Information Needed]
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Preprocessing [optional]
[More Information Needed]
#### Training Hyperparameters
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
#### Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
#### Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
[More Information Needed]
### Results
[More Information Needed]
#### Summary
## Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
[More Information Needed]
## Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]
## Technical Specifications [optional]
### Model Architecture and Objective
[More Information Needed]
### Compute Infrastructure
[More Information Needed]
#### Hardware
[More Information Needed]
#### Software
[More Information Needed]
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
**BibTeX:**
[More Information Needed]
**APA:**
[More Information Needed]
## Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
[More Information Needed]
## More Information [optional]
[More Information Needed]
## Model Card Authors [optional]
[More Information Needed]
## Model Card Contact
[More Information Needed]### Framework versions
- PEFT 0.21.312345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4" }, "base_model_name_or_path": "google/gemma-4-31B-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "kasa_config": null, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 1448, "lora_bias": false, "lora_dropout": 0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "monteclora_config": null, "peft_type": "LORA", "peft_version": "0.21.3", "qalora_group_size": 16, "r": 32, "rank_pattern": {}, "revision": null, "target_modules": ".*\\.language_model.*\\.(q_proj|k_proj|v_proj|gate_proj|up_proj|down_proj|o_proj)", "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false, "velora_config": null}123version https://git-lfs.github.com/spec/v1oid sha256:eb3573b4c7648fae9f54a86bd88e1fc0f16f9ebb69617d8f0b02e09774a56669size 979558760123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390{# Template: Google Gemma 4 Canonical Chat Template Author: Google Gemma Engineering Team Published: 2026-07-09 Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.#}{%- macro format_parameters(properties, required, filter_keys=false) -%} {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%} {%- set ns = namespace(found_first=false) -%} {%- for key, value in properties | dictsort -%} {%- set add_comma = false -%} {%- if not filter_keys or key not in standard_keys -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {{ key }}:{ {%- if value['description'] -%} description:<|"|>{{ value['description'] }}<|"|> {%- set add_comma = true -%} {%- endif -%} {%- if value['type'] | upper == 'STRING' -%} {%- if value['enum'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} enum:{{ format_argument(value['enum']) }} {%- endif -%} {%- elif value['type'] | upper == 'ARRAY' -%} {%- if value['items'] is mapping and value['items'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} items:{ {%- set ns_items = namespace(found_first=false) -%} {%- for item_key, item_value in value['items'] | dictsort -%} {%- if item_value is not none -%} {%- if ns_items.found_first %},{% endif -%} {%- set ns_items.found_first = true -%} {%- if item_key == 'properties' -%} properties:{ {%- if item_value is mapping -%} {{- format_parameters(item_value, value['items']['required'] | default([])) -}} {%- endif -%} } {%- elif item_key == 'required' -%} required:[ {%- for req_item in item_value -%} <|"|>{{- req_item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- elif item_key == 'type' -%} {%- if item_value is string -%} type:{{ format_argument(item_value | upper) }} {%- else -%} type:{{ format_argument(item_value | map('upper') | list) }} {%- endif -%} {%- else -%} {{ item_key }}:{{ format_argument(item_value) }} {%- endif -%} {%- endif -%} {%- endfor -%} } {%- endif -%} {%- endif -%} {%- if value['nullable'] %} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} nullable:true {%- endif -%} {%- if value['type'] | upper == 'OBJECT' -%} {%- if value['properties'] is defined and value['properties'] is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value['properties'], value['required'] | default([])) -}} } {%- elif value is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}} } {%- endif -%} {%- if value['required'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} required:[ {%- for item in value['required'] | default([]) -%} <|"|>{{- item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- endif -%} {%- endif -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} type:<|"|>{{ value['type'] | upper }}<|"|>} {%- endif -%} {%- endfor -%}{%- endmacro -%}{%- macro format_function_declaration(tool_data) -%} declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|> {%- set params = tool_data['function']['parameters'] -%} {%- if params -%} ,parameters:{ {%- if params['properties'] -%} properties:{ {{- format_parameters(params['properties'], params['required']) -}} }, {%- endif -%} {%- if params['required'] -%} required:[ {%- for item in params['required'] -%} <|"|>{{- item -}}<|"|> {{- ',' if not loop.last -}} {%- endfor -%} ], {%- endif -%} {%- if params['type'] -%} type:<|"|>{{- params['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} {%- if 'response' in tool_data['function'] -%} {%- set response_declaration = tool_data['function']['response'] -%} ,response:{ {%- if response_declaration['description'] -%} description:<|"|>{{- response_declaration['description'] -}}<|"|>, {%- endif -%} {%- if response_declaration['type'] | upper == 'OBJECT' -%} type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} }{%- endmacro -%}{%- macro format_argument(argument, escape_keys=True) -%} {%- if argument is none -%} {{- 'null' -}} {%- elif argument is string -%} {{- '<|"|>' + argument + '<|"|>' -}} {%- elif argument is boolean -%} {{- 'true' if argument else 'false' -}} {%- elif argument is mapping -%} {{- '{' -}} {%- set ns = namespace(found_first=false) -%} {%- for key, value in argument | dictsort -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {%- if escape_keys -%} {{- '<|"|>' + key + '<|"|>' -}} {%- else -%} {{- key -}} {%- endif -%} :{{- format_argument(value, escape_keys=escape_keys) -}} {%- endfor -%} {{- '}' -}} {%- elif argument is sequence -%} {{- '[' -}} {%- for item in argument -%} {{- format_argument(item, escape_keys=escape_keys) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- ']' -}} {%- else -%} {{- argument -}} {%- endif -%}{%- endmacro -%}{%- macro strip_thinking(text) -%} {%- set ns = namespace(result='') -%} {%- for part in text.split('<channel|>') -%} {%- if '<|channel>' in part -%} {%- set ns.result = ns.result + part.split('<|channel>')[0] -%} {%- else -%} {%- set ns.result = ns.result + part -%} {%- endif -%} {%- endfor -%} {{- ns.result | trim -}}{%- endmacro -%}
{%- macro format_tool_response_block(tool_name, response) -%} {{- '<|tool_response>' -}} {%- if response is mapping -%} {{- 'response:' + tool_name + '{' -}} {%- for key, value in response | dictsort -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- '}' -}} {%- else -%} {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}} {%- endif -%} {{- '<tool_response|>' -}}{%- endmacro -%}
{#- ===== SETUP ===== -#}{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}{%- set loop_messages = messages -%}{%- set enable_thinking = enable_thinking | default(false) -%}{%- set preserve_thinking = preserve_thinking | default(false) -%}{{- bos_token -}}{#- Handle System/Tool Definitions Block -#}{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%} {{- '<|turn>system\n' -}} {#- Inject Thinking token at the very top of the FIRST system turn -#} {%- if enable_thinking -%} {{- '<|think|>\n' -}} {%- set ns.prev_message_type = 'think' -%} {%- endif -%} {%- if messages and messages[0]['role'] in ['system', 'developer'] -%} {%- if messages[0]['content'] is string -%} {{- messages[0]['content'] | trim -}} {%- elif messages[0]['content'] is sequence -%} {%- for item in messages[0]['content'] -%} {{- item['text'] | trim + ' '-}} {%- endfor -%} {%- endif -%} {%- set loop_messages = messages[1:] -%} {%- endif -%} {%- if tools -%} {%- for tool in tools %} {{- '<|tool>' -}} {{- format_function_declaration(tool) | trim -}} {{- '<tool|>' -}} {%- endfor %} {%- set ns.prev_message_type = 'tool' -%} {%- endif -%} {{- '<turn|>\n' -}}{%- endif %}
{#- Pre-scan: find last user message index for reasoning guard -#}{%- set ns_turn = namespace(last_user_idx=-1) -%}{%- for i in range(loop_messages | length) -%} {%- if loop_messages[i]['role'] == 'user' -%} {%- set ns_turn.last_user_idx = i -%} {%- endif -%}{%- endfor -%}
{#- Loop through messages -#}{%- for message in loop_messages -%} {%- if message['role'] != 'tool' -%} {%- set ns.prev_message_type = None -%} {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%} {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#} {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%} {%- if not continue_same_model_turn -%} {{- '<|turn>' + role + '\n' }}
{%- endif -%}
{#- Render reasoning/reasoning_content as thinking channel -#} {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%} {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%} {%- if thinking_text and thinking_gate -%} {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}} {%- endif -%}
{%- if message.get('tool_calls') -%} {%- for tool_call in message.get('tool_calls') -%} {%- set function = tool_call['function'] -%} {{- '<|tool_call>call:' + function['name'] + '{' -}} {%- if function['arguments'] is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in function['arguments'] | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- elif function['arguments'] is none -%} {%- else -%} {{- raise_exception( "chat_template: tool_calls[].function.arguments must be a " "JSON object (mapping), not a string. Deserialize arguments " "before passing to the template." ) -}} {%- endif -%} {{- '}<tool_call|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_call' -%} {%- endif -%}
{%- set ns_tr_out = namespace(flag=false) -%} {%- if message.get('tool_responses') -%} {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#} {%- for tool_response in message.get('tool_responses') -%} {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endfor -%} {%- elif message.get('tool_calls') -%} {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#} {%- set ns_tool_scan = namespace(stopped=false) -%} {%- for k in range(loop.index0 + 1, loop_messages | length) -%} {%- if ns_tool_scan.stopped -%} {%- elif loop_messages[k]['role'] != 'tool' -%} {%- set ns_tool_scan.stopped = true -%} {%- else -%} {%- set follow = loop_messages[k] -%} {#- Resolve tool_call_id to function name -#} {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%} {%- for tc in message.get('tool_calls') -%} {%- if tc.get('id') == follow.get('tool_call_id') -%} {%- set ns_tname.name = tc['function']['name'] -%} {%- endif -%} {%- endfor -%} {#- Handle content as string or content-parts array -#} {%- set tool_body = follow.get('content') -%} {%- if tool_body is string -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- elif tool_body is sequence and tool_body is not string -%} {%- set ns_txt = namespace(s='') -%} {%- for part in tool_body -%} {%- if part.get('type') == 'text' -%} {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%} {%- endif -%} {%- endfor -%} {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}} {%- for part in tool_body -%} {%- if part.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif part.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif part.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- else -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- endif -%} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endif -%} {%- endfor -%} {%- endif -%}
{%- set captured_content -%} {%- if message.get('content') is string -%} {%- if role == 'model' -%} {{- strip_thinking(message['content']) -}} {%- else -%} {{- message['content'] | trim -}} {%- endif -%} {%- elif message.get('content') is sequence -%} {%- for item in message['content'] -%} {%- if item.get('type') == 'text' -%} {%- if role == 'model' -%} {{- strip_thinking(item['text']) -}} {%- else -%} {{- item['text'] | trim -}} {%- endif -%} {%- elif item.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif item.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif item.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endset -%}
{{- captured_content -}} {%- set has_content = captured_content | trim | length > 0 -%}
{#- Forward-scan: find next non-tool message role for continuation detection -#} {%- set next_nt = namespace(role=None, found=false) -%} {%- for j in range(loop.index0 + 1, loop_messages | length) -%} {%- if not next_nt.found -%} {%- if loop_messages[j]['role'] != 'tool' -%} {%- set next_nt.role = loop_messages[j]['role'] -%} {%- set next_nt.found = true -%} {%- endif -%} {%- endif -%} {%- endfor -%}
{%- set continues_into_next = ( role == 'model' and next_nt.role == 'assistant' and (not message.get('tool_calls') or ns_tr_out.flag) ) -%}
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%} {{- '<|tool_response>' -}} {%- elif continues_into_next -%} {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%} {{- '<turn|>\n' -}} {%- endif -%}
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#} {%- set ns.prev_non_tool_role = message['role'] -%} {%- endif -%}{%- endfor -%}
{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%} {{- '<|turn>model\n' -}} {%- if not enable_thinking -%} {{- '<|channel>thought\n<channel|>' -}} {%- endif -%} {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%} {{- '<|channel>thought\n' -}} {%- endif -%}{%- endif -%}123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|image>", "bos_token": "<bos>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eos_token": "<eos>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "extra_special_tokens": [ "<|video|>" ], "image_token": "<|image|>", "is_local": false, "local_files_only": false, "mask_token": "<mask>", "model_max_length": 1000000000000000019884624838656, "model_specific_special_tokens": { "audio_token": "<|audio|>", "boa_token": "<|audio>", "boi_token": "<|image>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "image_token": "<|image|>", "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>" }, "pad_token": "<pad>", "padding_side": "left", "processor_class": "Gemma4Processor", "response_schema": { "properties": { "content": { "type": "string" }, "role": { "const": "assistant" }, "thinking": { "type": "string" }, "tool_calls": { "items": { "properties": { "function": { "properties": { "arguments": { "additionalProperties": {}, "type": "object", "x-parser": "gemma4-tool-call" }, "name": { "type": "string" } }, "type": "object", "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" }, "type": { "const": "function" } }, "type": "object" }, "type": "array", "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" } }, "type": "object", "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" }, "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": [ "<turn|>", "<|tool_response>", "<eos>" ], "content": "text" }, "thinking": { "close": "<channel|>", "content": "text", "open": "<|channel>thought\n" }, "tool_calls": { "close": "<tool_call|>", "content": "json", "content_args": { "string_delims": [ [ "<|\"|>", "<|\"|>" ] ], "unquoted_keys": true }, "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)", "repeats": true, "transform": { "function": { "arguments": "{content}", "name": "{name}" }, "type": "function" } } }, "start_anchor": [ "<|turn>model\n", "<tool_response|>" ] }, "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>", "tokenizer_class": "GemmaTokenizer", "unk_token": "<unk>"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208---base_model: google/gemma-4-31B-itlibrary_name: pefttags:- base_model:adapter:google/gemma-4-31B-it- lora- sft- transformers- trl---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** [More Information Needed]- **Funded by [optional]:** [More Information Needed]- **Shared by [optional]:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** [More Information Needed]- **Paper [optional]:** [More Information Needed]- **Demo [optional]:** [More Information Needed]
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
[More Information Needed]
### Downstream Use [optional]
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
[More Information Needed]
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
[More Information Needed]
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
[More Information Needed]
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
## How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
[More Information Needed]
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Preprocessing [optional]
[More Information Needed]
#### Training Hyperparameters
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
#### Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
#### Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
[More Information Needed]
### Results
[More Information Needed]
#### Summary
## Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
[More Information Needed]
## Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]
## Technical Specifications [optional]
### Model Architecture and Objective
[More Information Needed]
### Compute Infrastructure
[More Information Needed]
#### Hardware
[More Information Needed]
#### Software
[More Information Needed]
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
**BibTeX:**
[More Information Needed]
**APA:**
[More Information Needed]
## Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
[More Information Needed]
## More Information [optional]
[More Information Needed]
## Model Card Authors [optional]
[More Information Needed]
## Model Card Contact
[More Information Needed]### Framework versions
- PEFT 0.21.312345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4" }, "base_model_name_or_path": "google/gemma-4-31B-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "kasa_config": null, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 1448, "lora_bias": false, "lora_dropout": 0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "monteclora_config": null, "peft_type": "LORA", "peft_version": "0.21.3", "qalora_group_size": 16, "r": 32, "rank_pattern": {}, "revision": null, "target_modules": ".*\\.language_model.*\\.(q_proj|k_proj|v_proj|gate_proj|up_proj|down_proj|o_proj)", "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false, "velora_config": null}123version https://git-lfs.github.com/spec/v1oid sha256:39226ed3bf21484c63a8d3ff189f46bdce08c175dd735ab4a47dd0589498f2b3size 979558760123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403{# Template: Google Gemma 4 Canonical Chat Template Author: Google Gemma Engineering Team Published: 2026-07-09 Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.#}{%- macro format_parameters(properties, required, filter_keys=false) -%} {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%} {%- set ns = namespace(found_first=false) -%} {%- for key, value in properties | dictsort -%} {%- set add_comma = false -%} {%- if not filter_keys or key not in standard_keys -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {{ key }}:{ {%- if value['description'] -%} description:<|"|>{{ value['description'] }}<|"|> {%- set add_comma = true -%} {%- endif -%} {%- if value['type'] | upper == 'STRING' -%} {%- if value['enum'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} enum:{{ format_argument(value['enum']) }} {%- endif -%} {%- elif value['type'] | upper == 'ARRAY' -%} {%- if value['items'] is mapping and value['items'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} items:{ {%- set ns_items = namespace(found_first=false) -%} {%- for item_key, item_value in value['items'] | dictsort -%} {%- if item_value is not none -%} {%- if ns_items.found_first %},{% endif -%} {%- set ns_items.found_first = true -%} {%- if item_key == 'properties' -%} properties:{ {%- if item_value is mapping -%} {{- format_parameters(item_value, value['items']['required'] | default([])) -}} {%- endif -%} } {%- elif item_key == 'required' -%} required:[ {%- for req_item in item_value -%} <|"|>{{- req_item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- elif item_key == 'type' -%} {%- if item_value is string -%} type:{{ format_argument(item_value | upper) }} {%- else -%} type:{{ format_argument(item_value | map('upper') | list) }} {%- endif -%} {%- else -%} {{ item_key }}:{{ format_argument(item_value) }} {%- endif -%} {%- endif -%} {%- endfor -%} } {%- endif -%} {%- endif -%} {%- if value['nullable'] %} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} nullable:true {%- endif -%} {%- if value['type'] | upper == 'OBJECT' -%} {%- if value['properties'] is defined and value['properties'] is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value['properties'], value['required'] | default([])) -}} } {%- elif value is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}} } {%- endif -%} {%- if value['required'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} required:[ {%- for item in value['required'] | default([]) -%} <|"|>{{- item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- endif -%} {%- endif -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} type:<|"|>{{ value['type'] | upper }}<|"|>} {%- endif -%} {%- endfor -%}{%- endmacro -%}{%- macro format_function_declaration(tool_data) -%} declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|> {%- set params = tool_data['function']['parameters'] -%} {%- if params -%} ,parameters:{ {%- if params['properties'] -%} properties:{ {{- format_parameters(params['properties'], params['required']) -}} }, {%- endif -%} {%- if params['required'] -%} required:[ {%- for item in params['required'] -%} <|"|>{{- item -}}<|"|> {{- ',' if not loop.last -}} {%- endfor -%} ], {%- endif -%} {%- if params['type'] -%} type:<|"|>{{- params['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} {%- if 'response' in tool_data['function'] -%} {%- set response_declaration = tool_data['function']['response'] -%} ,response:{ {%- if response_declaration['description'] -%} description:<|"|>{{- response_declaration['description'] -}}<|"|>, {%- endif -%} {%- if response_declaration['type'] | upper == 'OBJECT' -%} type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} }{%- endmacro -%}{%- macro format_argument(argument, escape_keys=True) -%} {%- if argument is none -%} {{- 'null' -}} {%- elif argument is string -%} {{- '<|"|>' + argument + '<|"|>' -}} {%- elif argument is boolean -%} {{- 'true' if argument else 'false' -}} {%- elif argument is mapping -%} {{- '{' -}} {%- set ns = namespace(found_first=false) -%} {%- for key, value in argument | dictsort -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {%- if escape_keys -%} {{- '<|"|>' + key + '<|"|>' -}} {%- else -%} {{- key -}} {%- endif -%} :{{- format_argument(value, escape_keys=escape_keys) -}} {%- endfor -%} {{- '}' -}} {%- elif argument is sequence -%} {{- '[' -}} {%- for item in argument -%} {{- format_argument(item, escape_keys=escape_keys) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- ']' -}} {%- else -%} {{- argument -}} {%- endif -%}{%- endmacro -%}{%- macro strip_thinking(text) -%} {%- set ns = namespace(result='') -%} {%- for part in text.split('<channel|>') -%} {%- if '<|channel>' in part -%} {%- set ns.result = ns.result + part.split('<|channel>')[0] -%} {%- else -%} {%- set ns.result = ns.result + part -%} {%- endif -%} {%- endfor -%} {{- ns.result | trim -}}{%- endmacro -%}
{%- macro format_tool_response_block(tool_name, response) -%} {{- '<|tool_response>' -}} {%- if response is mapping -%} {{- 'response:' + tool_name + '{' -}} {%- for key, value in response | dictsort -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- '}' -}} {%- else -%} {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}} {%- endif -%} {{- '<tool_response|>' -}}{%- endmacro -%}
{#- ===== SETUP ===== -#}{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}{%- set loop_messages = messages -%}{%- set enable_thinking = enable_thinking | default(false) -%}{%- set preserve_thinking = preserve_thinking | default(false) -%}{{- bos_token -}}{#- Handle System/Tool Definitions Block -#}{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%} {{- '<|turn>system' -}} {#- Inject Thinking token at the very top of the FIRST system turn -#} {%- if enable_thinking -%} {{- '<|think|>' -}} {%- set ns.prev_message_type = 'think' -%} {%- endif -%} {%- if messages and messages[0]['role'] in ['system', 'developer'] -%} {%- if messages[0]['content'] is string -%} {{- messages[0]['content'] | trim -}} {%- elif messages[0]['content'] is sequence -%} {%- for item in messages[0]['content'] -%} {{- item['text'] | trim + ' '-}} {%- endfor -%} {%- endif -%} {%- set loop_messages = messages[1:] -%} {%- endif -%} {%- if tools -%} {%- for tool in tools %} {{- '<|tool>' -}} {{- format_function_declaration(tool) | trim -}} {{- '<tool|>' -}} {%- endfor %} {%- set ns.prev_message_type = 'tool' -%} {%- endif -%} {{- '<turn|>' -}}{%- endif %}
{#- Pre-scan: find last user message index for reasoning guard -#}{%- set ns_turn = namespace(last_user_idx=-1) -%}{%- for i in range(loop_messages | length) -%} {%- if loop_messages[i]['role'] == 'user' -%} {%- set ns_turn.last_user_idx = i -%} {%- endif -%}{%- endfor -%}
{#- Loop through messages -#}{%- for message in loop_messages -%} {%- if message['role'] != 'tool' -%} {%- set ns.prev_message_type = None -%} {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%} {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#} {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%} {%- if not continue_same_model_turn -%} {{- '<|turn>' + role + '' }}
{%- endif -%}
{#- Render reasoning/reasoning_content as thinking channel -#} {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%} {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%} {%- if thinking_text and thinking_gate -%} {{- '<|channel>thought' + thinking_text + '<channel|>' -}} {%- elif message['role'] == 'assistant' and loop.last -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%}
{%- if message.get('tool_calls') -%} {%- for tool_call in message.get('tool_calls') -%} {%- set function = tool_call['function'] -%} {{- '<|tool_call>call:' + function['name'] + '{' -}} {%- if function['arguments'] is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in function['arguments'] | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- elif function['arguments'] is none -%} {%- else -%} {{- raise_exception( "chat_template: tool_calls[].function.arguments must be a " "JSON object (mapping), not a string. Deserialize arguments " "before passing to the template." ) -}} {%- endif -%} {{- '}<tool_call|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_call' -%} {%- endif -%}
{%- set ns_tr_out = namespace(flag=false) -%} {%- if message.get('tool_responses') -%} {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#} {%- for tool_response in message.get('tool_responses') -%} {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endfor -%} {%- elif message.get('tool_calls') -%} {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#} {%- set ns_tool_scan = namespace(stopped=false) -%} {%- for k in range(loop.index0 + 1, loop_messages | length) -%} {%- if ns_tool_scan.stopped -%} {%- elif loop_messages[k]['role'] != 'tool' -%} {%- set ns_tool_scan.stopped = true -%} {%- else -%} {%- set follow = loop_messages[k] -%} {#- Resolve tool_call_id to function name -#} {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%} {%- for tc in message.get('tool_calls') -%} {%- if tc.get('id') == follow.get('tool_call_id') -%} {%- set ns_tname.name = tc['function']['name'] -%} {%- endif -%} {%- endfor -%} {#- Handle content as string or content-parts array -#} {%- set tool_body = follow.get('content') -%} {%- if tool_body is string -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- elif tool_body is sequence and tool_body is not string -%} {%- set ns_txt = namespace(s='') -%} {%- for part in tool_body -%} {%- if part.get('type') == 'text' -%} {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%} {%- endif -%} {%- endfor -%} {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}} {%- for part in tool_body -%} {%- if part.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif part.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif part.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- else -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- endif -%} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endif -%} {%- endfor -%} {%- endif -%}
{%- set captured_content -%} {%- if message.get('content') is string -%} {%- if role == 'model' -%} {{- strip_thinking(message['content']) -}} {%- else -%} {{- message['content'] | trim -}} {%- endif -%} {%- elif message.get('content') is sequence -%} {%- for item in message['content'] -%} {%- if item.get('type') == 'text' -%} {%- if role == 'model' -%} {{- strip_thinking(item['text']) -}} {%- else -%} {{- item['text'] | trim -}} {%- endif -%} {%- elif item.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif item.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif item.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endset -%}
{{- captured_content -}} {%- set has_content = captured_content | trim | length > 0 -%}
{#- Forward-scan: find next non-tool message role for continuation detection -#} {%- set next_nt = namespace(role=None, found=false) -%} {%- for j in range(loop.index0 + 1, loop_messages | length) -%} {%- if not next_nt.found -%} {%- if loop_messages[j]['role'] != 'tool' -%} {%- set next_nt.role = loop_messages[j]['role'] -%} {%- set next_nt.found = true -%} {%- endif -%} {%- endif -%} {%- endfor -%}
{%- set continues_into_next = ( role == 'model' and next_nt.role == 'assistant' and (not message.get('tool_calls') or ns_tr_out.flag) ) -%}
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%} {{- '<|tool_response>' -}} {%- elif continues_into_next -%} {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%} {{- '<turn|>' -}} {%- endif -%}
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#} {%- set ns.prev_non_tool_role = message['role'] -%} {%- endif -%}{%- endfor -%}
{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%} {{- '<|turn>model' -}} {%- if not enable_thinking -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%} {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%} {{- '<|channel>thought' -}} {%- endif -%}{%- endif -%}123version https://git-lfs.github.com/spec/v1oid sha256:d6aaaa778a11bbdeae77a7466ec1264210b28d88d4ed95eabf67fb990ec9d107size 500847699123version https://git-lfs.github.com/spec/v1oid sha256:3d2d8215857dacf5a88e6b9669c6314c71f316516d15d260d94e5083f3d23661size 14581123version https://git-lfs.github.com/spec/v1oid sha256:b56f2d7a34dc310d605ea3568fe4396144273e38f59e1327693d775cea246ef5size 2545123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|image>", "bos_token": "<bos>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eos_token": "<eos>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "extra_special_tokens": [ "<|video|>" ], "image_token": "<|image|>", "is_local": false, "local_files_only": false, "mask_token": "<mask>", "model_max_length": 1000000000000000019884624838656, "model_specific_special_tokens": { "audio_token": "<|audio|>", "boa_token": "<|audio>", "boi_token": "<|image>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "image_token": "<|image|>", "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>" }, "pad_token": "<pad>", "padding_side": "left", "processor_class": "Gemma4Processor", "response_schema": { "properties": { "content": { "type": "string" }, "role": { "const": "assistant" }, "thinking": { "type": "string" }, "tool_calls": { "items": { "properties": { "function": { "properties": { "arguments": { "additionalProperties": {}, "type": "object", "x-parser": "gemma4-tool-call" }, "name": { "type": "string" } }, "type": "object", "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" }, "type": { "const": "function" } }, "type": "object" }, "type": "array", "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" } }, "type": "object", "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" }, "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": [ "<turn|>", "<|tool_response>", "<eos>" ], "content": "text" }, "thinking": { "close": "<channel|>", "content": "text", "open": "<|channel>thought\n" }, "tool_calls": { "close": "<tool_call|>", "content": "json", "content_args": { "string_delims": [ [ "<|\"|>", "<|\"|>" ] ], "unquoted_keys": true }, "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)", "repeats": true, "transform": { "function": { "arguments": "{content}", "name": "{name}" }, "type": "function" } } }, "start_anchor": [ "<|turn>model\n", "<tool_response|>" ] }, "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>", "tokenizer_class": "GemmaTokenizer", "unk_token": "<unk>"}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882{ "best_global_step": null, "best_metric": null, "best_model_checkpoint": null, "epoch": 1.0, "eval_steps": 500, "global_step": 168, "is_hyper_param_search": false, "is_local_process_zero": true, "is_world_process_zero": true, "log_history": [ { "ema_loss": 4.654837, "entropy": 0.723590187728405, "epoch": 0.005961251862891207, "grad_norm": 142.7566680908203, "learning_rate": 2.316231530130608e-06, "loss": 4.609317302703857, "mean_token_accuracy": 0.421400498598814, "num_tokens": 8013.0, "step": 1 }, { "ema_loss": 4.653529, "entropy": 0.7862775102257729, "epoch": 0.011922503725782414, "grad_norm": 141.1668243408203, "learning_rate": 2.3174895886768354e-06, "loss": 4.641760349273682, "mean_token_accuracy": 0.4169013239443302, "num_tokens": 16374.0, "step": 2 }, { "ema_loss": 4.59388, "entropy": 0.8800836354494095, "epoch": 0.01788375558867362, "grad_norm": 127.05127716064453, "learning_rate": 2.31781518778007e-06, "loss": 4.057041168212891, "mean_token_accuracy": 0.43124499171972275, "num_tokens": 24825.0, "step": 3 }, { "ema_loss": 4.516952, "entropy": 1.1267420127987862, "epoch": 0.02384500745156483, "grad_norm": 107.27555847167969, "learning_rate": 2.332814347028034e-06, "loss": 3.8245973587036133, "mean_token_accuracy": 0.43692635372281075, "num_tokens": 33579.0, "step": 4 }, { "ema_loss": 4.432823, "entropy": 1.4566637128591537, "epoch": 0.029806259314456036, "grad_norm": 96.3231430053711, "learning_rate": 2.352595402044244e-06, "loss": 3.675666332244873, "mean_token_accuracy": 0.4153880141675472, "num_tokens": 41885.0, "step": 5 }, { "ema_loss": 4.306974, "entropy": 1.6763839274644852, "epoch": 0.03576751117734724, "grad_norm": 65.6293716430664, "learning_rate": 2.374815039729583e-06, "loss": 3.174330949783325, "mean_token_accuracy": 0.44383278489112854, "num_tokens": 49823.0, "step": 6 }, { "ema_loss": 4.195318, "entropy": 2.0858955532312393, "epoch": 0.041728763040238454, "grad_norm": 49.42467498779297, "learning_rate": 2.4092610146908555e-06, "loss": 3.190415143966675, "mean_token_accuracy": 0.4291481710970402, "num_tokens": 58014.0, "step": 7 }, { "ema_loss": 4.075809, "entropy": 2.399156764149666, "epoch": 0.04769001490312966, "grad_norm": 35.73464584350586, "learning_rate": 2.4411110643995926e-06, "loss": 3.0002219676971436, "mean_token_accuracy": 0.4378173314034939, "num_tokens": 66893.0, "step": 8 }, { "ema_loss": 3.966948, "entropy": 2.688164532184601, "epoch": 0.05365126676602087, "grad_norm": 33.650672912597656, "learning_rate": 2.4766411570453783e-06, "loss": 2.9872055053710938, "mean_token_accuracy": 0.4325142428278923, "num_tokens": 75385.0, "step": 9 }, { "ema_loss": 3.864647, "entropy": 3.053536117076874, "epoch": 0.05961251862891207, "grad_norm": 39.37419509887695, "learning_rate": 2.5103929601755226e-06, "loss": 2.9439353942871094, "mean_token_accuracy": 0.4473666623234749, "num_tokens": 83537.0, "step": 10 }, { "ema_loss": 3.778868, "entropy": 3.20744189620018, "epoch": 0.06557377049180328, "grad_norm": 38.15211868286133, "learning_rate": 2.5434023882553447e-06, "loss": 3.0068538188934326, "mean_token_accuracy": 0.429670549929142, "num_tokens": 91990.0, "step": 11 }, { "ema_loss": 3.687196, "entropy": 3.18863508105278, "epoch": 0.07153502235469449, "grad_norm": 39.53639221191406, "learning_rate": 2.5721076326590264e-06, "loss": 2.862150192260742, "mean_token_accuracy": 0.46243131905794144, "num_tokens": 99990.0, "step": 12 }, { "ema_loss": 3.60752, "entropy": 3.2143620550632477, "epoch": 0.07749627421758569, "grad_norm": 34.021514892578125, "learning_rate": 2.603885604912648e-06, "loss": 2.8904387950897217, "mean_token_accuracy": 0.4497467540204525, "num_tokens": 108597.0, "step": 13 }, { "ema_loss": 3.53071, "entropy": 3.120556592941284, "epoch": 0.08345752608047691, "grad_norm": 32.14274597167969, "learning_rate": 2.632483301567845e-06, "loss": 2.83941650390625, "mean_token_accuracy": 0.4369037300348282, "num_tokens": 116839.0, "step": 14 }, { "ema_loss": 3.445922, "entropy": 2.7850230038166046, "epoch": 0.08941877794336811, "grad_norm": 15.929612159729004, "learning_rate": 2.660963900780189e-06, "loss": 2.682828426361084, "mean_token_accuracy": 0.4644138664007187, "num_tokens": 125291.0, "step": 15 }, { "ema_loss": 3.385176, "entropy": 2.7822817265987396, "epoch": 0.09538002980625931, "grad_norm": 82.34152221679688, "learning_rate": 2.693501983230817e-06, "loss": 2.838463306427002, "mean_token_accuracy": 0.44084591418504715, "num_tokens": 134478.0, "step": 16 }, { "ema_loss": 3.322484, "entropy": 2.565845638513565, "epoch": 0.10134128166915052, "grad_norm": 12.14818286895752, "learning_rate": 2.7175615286978427e-06, "loss": 2.7582530975341797, "mean_token_accuracy": 0.45662185177206993, "num_tokens": 142868.0, "step": 17 }, { "ema_loss": 3.270651, "entropy": 2.4774779677391052, "epoch": 0.10730253353204174, "grad_norm": 14.788606643676758, "learning_rate": 2.7430805857875384e-06, "loss": 2.8041563034057617, "mean_token_accuracy": 0.4493153840303421, "num_tokens": 151724.0, "step": 18 }, { "ema_loss": 3.224082, "entropy": 2.4436245262622833, "epoch": 0.11326378539493294, "grad_norm": 17.68517303466797, "learning_rate": 2.764731107163243e-06, "loss": 2.804965019226074, "mean_token_accuracy": 0.44288652390241623, "num_tokens": 160303.0, "step": 19 }, { "ema_loss": 3.179262, "entropy": 2.40089949965477, "epoch": 0.11922503725782414, "grad_norm": 20.13930892944336, "learning_rate": 2.784626303764526e-06, "loss": 2.7758779525756836, "mean_token_accuracy": 0.44312890991568565, "num_tokens": 169392.0, "step": 20 }, { "ema_loss": 3.134016, "entropy": 2.331088602542877, "epoch": 0.12518628912071536, "grad_norm": 20.24051856994629, "learning_rate": 2.80418612419453e-06, "loss": 2.7268059253692627, "mean_token_accuracy": 0.45036281645298004, "num_tokens": 177779.0, "step": 21 }, { "ema_loss": 3.097959, "entropy": 2.4369906187057495, "epoch": 0.13114754098360656, "grad_norm": 18.78559112548828, "learning_rate": 2.824355533448397e-06, "loss": 2.7734389305114746, "mean_token_accuracy": 0.44814911112189293, "num_tokens": 186787.0, "step": 22 }, { "ema_loss": 3.053888, "entropy": 2.4557918310165405, "epoch": 0.13710879284649777, "grad_norm": 17.062637329101562, "learning_rate": 2.8407446279743453e-06, "loss": 2.65725040435791, "mean_token_accuracy": 0.45730944722890854, "num_tokens": 195330.0, "step": 23 }, { "ema_loss": 3.018545, "entropy": 2.580775260925293, "epoch": 0.14307004470938897, "grad_norm": 14.148712158203125, "learning_rate": 2.861168695744709e-06, "loss": 2.7004575729370117, "mean_token_accuracy": 0.45259180665016174, "num_tokens": 203888.0, "step": 24 }, { "ema_loss": 2.9938, "entropy": 2.7781123518943787, "epoch": 0.14903129657228018, "grad_norm": 11.774184226989746, "learning_rate": 2.8778702017007163e-06, "loss": 2.771101713180542, "mean_token_accuracy": 0.4472814314067364, "num_tokens": 212409.0, "step": 25 }, { "ema_loss": 2.960294, "entropy": 2.744678318500519, "epoch": 0.15499254843517138, "grad_norm": 22.996997833251953, "learning_rate": 2.889738652811502e-06, "loss": 2.6587350368499756, "mean_token_accuracy": 0.46377629414200783, "num_tokens": 220920.0, "step": 26 }, { "ema_loss": 2.936577, "entropy": 2.8199593126773834, "epoch": 0.16095380029806258, "grad_norm": 11.087271690368652, "learning_rate": 2.906046574935317e-06, "loss": 2.723127603530884, "mean_token_accuracy": 0.44542065635323524, "num_tokens": 229321.0, "step": 27 }, { "ema_loss": 2.909678, "entropy": 2.7628621757030487, "epoch": 0.16691505216095381, "grad_norm": 13.563375473022461, "learning_rate": 2.917758138210047e-06, "loss": 2.6675877571105957, "mean_token_accuracy": 0.44548795744776726, "num_tokens": 238229.0, "step": 28 }, { "ema_loss": 2.87491, "entropy": 2.7013591527938843, "epoch": 0.17287630402384502, "grad_norm": 12.307969093322754, "learning_rate": 2.931213884949102e-06, "loss": 2.5619945526123047, "mean_token_accuracy": 0.46956518292427063, "num_tokens": 246832.0, "step": 29 }, { "ema_loss": 2.864661, "entropy": 2.815987467765808, "epoch": 0.17883755588673622, "grad_norm": 9.892110824584961, "learning_rate": 2.9488851396308746e-06, "loss": 2.772425651550293, "mean_token_accuracy": 0.4469096250832081, "num_tokens": 255364.0, "step": 30 }, { "ema_loss": 2.851497, "entropy": 2.699074298143387, "epoch": 0.18479880774962743, "grad_norm": 8.402484893798828, "learning_rate": 2.9541554340539733e-06, "loss": 2.7330167293548584, "mean_token_accuracy": 0.4341626390814781, "num_tokens": 263163.0, "step": 31 }, { "ema_loss": 2.830334, "entropy": 2.5350546538829803, "epoch": 0.19076005961251863, "grad_norm": 10.77676773071289, "learning_rate": 2.960966867249226e-06, "loss": 2.63987135887146, "mean_token_accuracy": 0.45750902220606804, "num_tokens": 271489.0, "step": 32 }, { "ema_loss": 2.816943, "entropy": 2.591126024723053, "epoch": 0.19672131147540983, "grad_norm": 10.347773551940918, "learning_rate": 2.9720158636337146e-06, "loss": 2.696418285369873, "mean_token_accuracy": 0.44579920545220375, "num_tokens": 279805.0, "step": 33 }, { "ema_loss": 2.807334, "entropy": 2.5694952607154846, "epoch": 0.20268256333830104, "grad_norm": 11.273138999938965, "learning_rate": 2.979071723530069e-06, "loss": 2.7208526134490967, "mean_token_accuracy": 0.453756857663393, "num_tokens": 288007.0, "step": 34 }, { "ema_loss": 2.798403, "entropy": 2.5459642708301544, "epoch": 0.20864381520119224, "grad_norm": 9.747663497924805, "learning_rate": 2.984165803354699e-06, "loss": 2.7180287837982178, "mean_token_accuracy": 0.44575123488903046, "num_tokens": 296305.0, "step": 35 }, { "ema_loss": 2.783173, "entropy": 2.5328923761844635, "epoch": 0.21460506706408347, "grad_norm": 8.302857398986816, "learning_rate": 2.9889238248870242e-06, "loss": 2.646097183227539, "mean_token_accuracy": 0.4572877325117588, "num_tokens": 304865.0, "step": 36 }, { "ema_loss": 2.766676, "entropy": 2.5811279118061066, "epoch": 0.22056631892697467, "grad_norm": 8.936332702636719, "learning_rate": 2.9970908599352697e-06, "loss": 2.618206262588501, "mean_token_accuracy": 0.4557090811431408, "num_tokens": 313604.0, "step": 37 }, { "ema_loss": 2.739774, "entropy": 2.509188562631607, "epoch": 0.22652757078986588, "grad_norm": 10.369497299194336, "learning_rate": 3.006013002959662e-06, "loss": 2.4976508617401123, "mean_token_accuracy": 0.4738236851990223, "num_tokens": 321957.0, "step": 38 }, { "ema_loss": 2.719345, "entropy": 2.6352953612804413, "epoch": 0.23248882265275708, "grad_norm": 91.63523864746094, "learning_rate": 3.020735221070936e-06, "loss": 2.5354912281036377, "mean_token_accuracy": 0.45129982754588127, "num_tokens": 330359.0, "step": 39 }, { "ema_loss": 2.688102, "entropy": 2.5357236862182617, "epoch": 0.23845007451564829, "grad_norm": 10.912578582763672, "learning_rate": 3.0320602490974125e-06, "loss": 2.4069137573242188, "mean_token_accuracy": 0.47764237597584724, "num_tokens": 337868.0, "step": 40 }, { "ema_loss": 2.678912, "entropy": 2.708358258008957, "epoch": 0.2444113263785395, "grad_norm": 9.745366096496582, "learning_rate": 3.0496296403725864e-06, "loss": 2.596205711364746, "mean_token_accuracy": 0.4580042436718941, "num_tokens": 346627.0, "step": 41 }, { "ema_loss": 2.673158, "entropy": 2.702988415956497, "epoch": 0.2503725782414307, "grad_norm": 9.594890594482422, "learning_rate": 3.054855824302649e-06, "loss": 2.621368408203125, "mean_token_accuracy": 0.44958679750561714, "num_tokens": 355522.0, "step": 42 }, { "ema_loss": 2.660117, "entropy": 2.582668423652649, "epoch": 0.2563338301043219, "grad_norm": 8.452726364135742, "learning_rate": 3.0581422834075056e-06, "loss": 2.5427472591400146, "mean_token_accuracy": 0.4605557210743427, "num_tokens": 364322.0, "step": 43 }, { "ema_loss": 2.647613, "entropy": 2.4741596579551697, "epoch": 0.26229508196721313, "grad_norm": 10.975028991699219, "learning_rate": 3.0656292437925003e-06, "loss": 2.5350756645202637, "mean_token_accuracy": 0.46284377574920654, "num_tokens": 372688.0, "step": 44 }, { "ema_loss": 2.646201, "entropy": 2.5519526600837708, "epoch": 0.26825633383010433, "grad_norm": 8.809127807617188, "learning_rate": 3.072859726671595e-06, "loss": 2.6334948539733887, "mean_token_accuracy": 0.45356035232543945, "num_tokens": 381481.0, "step": 45 }, { "ema_loss": 2.643424, "entropy": 2.5052695870399475, "epoch": 0.27421758569299554, "grad_norm": 9.101727485656738, "learning_rate": 3.073679408771568e-06, "loss": 2.6184329986572266, "mean_token_accuracy": 0.453006386756897, "num_tokens": 389862.0, "step": 46 }, { "ema_loss": 2.632054, "entropy": 2.4626578390598297, "epoch": 0.28017883755588674, "grad_norm": 8.70666790008545, "learning_rate": 3.075293307119864e-06, "loss": 2.5297257900238037, "mean_token_accuracy": 0.4558374918997288, "num_tokens": 398464.0, "step": 47 }, { "ema_loss": 2.636983, "entropy": 2.5101154446601868, "epoch": 0.28614008941877794, "grad_norm": 11.545019149780273, "learning_rate": 3.0819285257166484e-06, "loss": 2.6813437938690186, "mean_token_accuracy": 0.4600731171667576, "num_tokens": 407401.0, "step": 48 }, { "ema_loss": 2.633238, "entropy": 2.570612996816635, "epoch": 0.29210134128166915, "grad_norm": 10.411480903625488, "learning_rate": 3.079046791754081e-06, "loss": 2.59952974319458, "mean_token_accuracy": 0.4594994783401489, "num_tokens": 415984.0, "step": 49 }, { "ema_loss": 2.632737, "entropy": 2.602872520685196, "epoch": 0.29806259314456035, "grad_norm": 7.570036888122559, "learning_rate": 3.081235718127573e-06, "loss": 2.628230571746826, "mean_token_accuracy": 0.4557979330420494, "num_tokens": 425000.0, "step": 50 }, { "ema_loss": 2.62653, "entropy": 2.624847888946533, "epoch": 0.30402384500745155, "grad_norm": 8.35303020477295, "learning_rate": 3.0815288027952192e-06, "loss": 2.5706629753112793, "mean_token_accuracy": 0.4585234932601452, "num_tokens": 433473.0, "step": 51 }, { "ema_loss": 2.612454, "entropy": 2.571897655725479, "epoch": 0.30998509687034276, "grad_norm": 8.889471054077148, "learning_rate": 3.085167918470688e-06, "loss": 2.485772132873535, "mean_token_accuracy": 0.47001905366778374, "num_tokens": 441844.0, "step": 52 }, { "ema_loss": 2.606818, "entropy": 2.6039353907108307, "epoch": 0.31594634873323396, "grad_norm": 11.354921340942383, "learning_rate": 3.0934681944927434e-06, "loss": 2.5560972690582275, "mean_token_accuracy": 0.4637809135019779, "num_tokens": 450323.0, "step": 53 }, { "ema_loss": 2.599179, "entropy": 2.5520995259284973, "epoch": 0.32190760059612517, "grad_norm": 49.87403869628906, "learning_rate": 3.0968103601480834e-06, "loss": 2.5304274559020996, "mean_token_accuracy": 0.4670843929052353, "num_tokens": 458988.0, "step": 54 }, { "ema_loss": 2.596156, "entropy": 2.5922085344791412, "epoch": 0.32786885245901637, "grad_norm": 8.431193351745605, "learning_rate": 3.101357833656948e-06, "loss": 2.5689499378204346, "mean_token_accuracy": 0.44929878786206245, "num_tokens": 467586.0, "step": 55 }, { "ema_loss": 2.581573, "entropy": 2.4782915711402893, "epoch": 0.33383010432190763, "grad_norm": 7.4983649253845215, "learning_rate": 3.103162953266292e-06, "loss": 2.450319290161133, "mean_token_accuracy": 0.47477031126618385, "num_tokens": 476015.0, "step": 56 }, { "ema_loss": 2.574673, "entropy": 2.496985822916031, "epoch": 0.33979135618479883, "grad_norm": 7.947065353393555, "learning_rate": 3.111915702902479e-06, "loss": 2.5125789642333984, "mean_token_accuracy": 0.47190939262509346, "num_tokens": 484831.0, "step": 57 }, { "ema_loss": 2.572132, "entropy": 2.448849529027939, "epoch": 0.34575260804769004, "grad_norm": 46077.54296875, "learning_rate": 3.1160823255049763e-06, "loss": 2.549262762069702, "mean_token_accuracy": 0.4570668935775757, "num_tokens": 493179.0, "step": 58 }, { "ema_loss": 2.573651, "entropy": 2.4568046033382416, "epoch": 0.35171385991058124, "grad_norm": 8.906220436096191, "learning_rate": 3.117621190540376e-06, "loss": 2.587315082550049, "mean_token_accuracy": 0.45903459936380386, "num_tokens": 502066.0, "step": 59 }, { "ema_loss": 2.568385, "entropy": 2.410266101360321, "epoch": 0.35767511177347244, "grad_norm": 9.774627685546875, "learning_rate": 3.1167014640232082e-06, "loss": 2.520993232727051, "mean_token_accuracy": 0.4625953212380409, "num_tokens": 510483.0, "step": 60 }, { "ema_loss": 2.562274, "entropy": 2.4316970705986023, "epoch": 0.36363636363636365, "grad_norm": 8.50571060180664, "learning_rate": 3.119894699921133e-06, "loss": 2.5072717666625977, "mean_token_accuracy": 0.4565528556704521, "num_tokens": 519053.0, "step": 61 }, { "ema_loss": 2.543314, "entropy": 2.375533849000931, "epoch": 0.36959761549925485, "grad_norm": 7.73806619644165, "learning_rate": 3.1236131690093316e-06, "loss": 2.372678518295288, "mean_token_accuracy": 0.4848996661603451, "num_tokens": 527333.0, "step": 62 }, { "ema_loss": 2.545196, "entropy": 2.5722717940807343, "epoch": 0.37555886736214605, "grad_norm": 9.670276641845703, "learning_rate": 3.135234237561235e-06, "loss": 2.562135934829712, "mean_token_accuracy": 0.4600643441081047, "num_tokens": 535909.0, "step": 63 }, { "ema_loss": 2.540182, "entropy": 2.5500266551971436, "epoch": 0.38152011922503726, "grad_norm": 8.680547714233398, "learning_rate": 3.13407485919015e-06, "loss": 2.495049476623535, "mean_token_accuracy": 0.4605592414736748, "num_tokens": 543873.0, "step": 64 }, { "ema_loss": 2.53691, "entropy": 2.537080705165863, "epoch": 0.38748137108792846, "grad_norm": 10.765830039978027, "learning_rate": 3.1371669138025027e-06, "loss": 2.5074622631073, "mean_token_accuracy": 0.4647650197148323, "num_tokens": 552783.0, "step": 65 }, { "ema_loss": 2.542858, "entropy": 2.644845634698868, "epoch": 0.39344262295081966, "grad_norm": 8.654887199401855, "learning_rate": 3.1391891752718948e-06, "loss": 2.5963938236236572, "mean_token_accuracy": 0.4545804411172867, "num_tokens": 561444.0, "step": 66 }, { "ema_loss": 2.551265, "entropy": 2.598461329936981, "epoch": 0.39940387481371087, "grad_norm": 12.216931343078613, "learning_rate": 3.135515271424083e-06, "loss": 2.6269304752349854, "mean_token_accuracy": 0.4561215527355671, "num_tokens": 570057.0, "step": 67 }, { "ema_loss": 2.547216, "entropy": 2.506628066301346, "epoch": 0.40536512667660207, "grad_norm": 10.163846015930176, "learning_rate": 3.130344794044504e-06, "loss": 2.510770082473755, "mean_token_accuracy": 0.45222604647278786, "num_tokens": 578205.0, "step": 68 }, { "ema_loss": 2.533772, "entropy": 2.4157556891441345, "epoch": 0.4113263785394933, "grad_norm": 8.244613647460938, "learning_rate": 3.1328320346801775e-06, "loss": 2.412773847579956, "mean_token_accuracy": 0.4719887785613537, "num_tokens": 586741.0, "step": 69 }, { "ema_loss": 2.536535, "entropy": 2.5160639882087708, "epoch": 0.4172876304023845, "grad_norm": 25.72791290283203, "learning_rate": 3.141132538075908e-06, "loss": 2.5614054203033447, "mean_token_accuracy": 0.45237866416573524, "num_tokens": 595708.0, "step": 70 }, { "ema_loss": 2.535071, "entropy": 2.5046288073062897, "epoch": 0.4232488822652757, "grad_norm": 8.739484786987305, "learning_rate": 3.139421096420847e-06, "loss": 2.521897554397583, "mean_token_accuracy": 0.47044894099235535, "num_tokens": 604109.0, "step": 71 }, { "ema_loss": 2.529726, "entropy": 2.4289923906326294, "epoch": 0.42921013412816694, "grad_norm": 8.832712173461914, "learning_rate": 3.140327180517488e-06, "loss": 2.481614351272583, "mean_token_accuracy": 0.4734353870153427, "num_tokens": 612352.0, "step": 72 }, { "ema_loss": 2.52517, "entropy": 2.450397700071335, "epoch": 0.43517138599105815, "grad_norm": 8.649375915527344, "learning_rate": 3.1436434255738277e-06, "loss": 2.4841716289520264, "mean_token_accuracy": 0.4749993309378624, "num_tokens": 621284.0, "step": 73 }, { "ema_loss": 2.514983, "entropy": 2.44897797703743, "epoch": 0.44113263785394935, "grad_norm": 8.567448616027832, "learning_rate": 3.146477865811903e-06, "loss": 2.4233005046844482, "mean_token_accuracy": 0.47031476348638535, "num_tokens": 629580.0, "step": 74 }, { "ema_loss": 2.508847, "entropy": 2.4610947966575623, "epoch": 0.44709388971684055, "grad_norm": 8.360054969787598, "learning_rate": 3.1528438739769626e-06, "loss": 2.453617811203003, "mean_token_accuracy": 0.48214417323470116, "num_tokens": 638092.0, "step": 75 }, { "ema_loss": 2.519629, "entropy": 2.5930723547935486, "epoch": 0.45305514157973176, "grad_norm": 8.776898384094238, "learning_rate": 3.156697175654699e-06, "loss": 2.616673469543457, "mean_token_accuracy": 0.4626084193587303, "num_tokens": 646532.0, "step": 76 }, { "ema_loss": 2.514668, "entropy": 2.4089425206184387, "epoch": 0.45901639344262296, "grad_norm": 8.722110748291016, "learning_rate": 3.1499355372943683e-06, "loss": 2.4700205326080322, "mean_token_accuracy": 0.4793979935348034, "num_tokens": 655446.0, "step": 77 }, { "ema_loss": 2.517605, "entropy": 2.490296721458435, "epoch": 0.46497764530551416, "grad_norm": 14.231531143188477, "learning_rate": 3.153041006953572e-06, "loss": 2.544036865234375, "mean_token_accuracy": 0.46207963302731514, "num_tokens": 663981.0, "step": 78 }, { "ema_loss": 2.517843, "entropy": 2.503438323736191, "epoch": 0.47093889716840537, "grad_norm": 8.317591667175293, "learning_rate": 3.151201553919236e-06, "loss": 2.519986152648926, "mean_token_accuracy": 0.47161004692316055, "num_tokens": 672798.0, "step": 79 }, { "ema_loss": 2.499327, "entropy": 2.359161078929901, "epoch": 0.47690014903129657, "grad_norm": 8.991280555725098, "learning_rate": 3.1510523967881454e-06, "loss": 2.332679510116577, "mean_token_accuracy": 0.48691751062870026, "num_tokens": 681265.0, "step": 80 }, { "ema_loss": 2.493978, "entropy": 2.4853456616401672, "epoch": 0.4828614008941878, "grad_norm": 9.402073860168457, "learning_rate": 3.162703251291532e-06, "loss": 2.4458365440368652, "mean_token_accuracy": 0.4745400510728359, "num_tokens": 690393.0, "step": 81 }, { "ema_loss": 2.499959, "entropy": 2.513625353574753, "epoch": 0.488822652757079, "grad_norm": 9.803109169006348, "learning_rate": 3.1660931654187152e-06, "loss": 2.5537924766540527, "mean_token_accuracy": 0.46164755523204803, "num_tokens": 698621.0, "step": 82 }, { "ema_loss": 2.509378, "entropy": 2.5659875869750977, "epoch": 0.4947839046199702, "grad_norm": 9.350783348083496, "learning_rate": 3.1623033009964274e-06, "loss": 2.594149589538574, "mean_token_accuracy": 0.46007413417100906, "num_tokens": 707319.0, "step": 83 }, { "ema_loss": 2.507003, "entropy": 2.4749120473861694, "epoch": 0.5007451564828614, "grad_norm": 8.11705493927002, "learning_rate": 3.156362708978122e-06, "loss": 2.485624313354492, "mean_token_accuracy": 0.4719291739165783, "num_tokens": 716373.0, "step": 84 }, { "ema_loss": 2.507149, "entropy": 2.5064623057842255, "epoch": 0.5067064083457526, "grad_norm": 7.872227191925049, "learning_rate": 3.1578576908941614e-06, "loss": 2.508458375930786, "mean_token_accuracy": 0.4669133387506008, "num_tokens": 724801.0, "step": 85 }, { "ema_loss": 2.505285, "entropy": 2.521860271692276, "epoch": 0.5126676602086438, "grad_norm": 10.001176834106445, "learning_rate": 3.1577660593029577e-06, "loss": 2.4885120391845703, "mean_token_accuracy": 0.46342017874121666, "num_tokens": 733036.0, "step": 86 }, { "ema_loss": 2.500573, "entropy": 2.4333623945713043, "epoch": 0.518628912071535, "grad_norm": 10.32410717010498, "learning_rate": 3.158940444336622e-06, "loss": 2.4581680297851562, "mean_token_accuracy": 0.47652553021907806, "num_tokens": 741674.0, "step": 87 }, { "ema_loss": 2.500576, "entropy": 2.4829667806625366, "epoch": 0.5245901639344263, "grad_norm": 7.888266563415527, "learning_rate": 3.161915174132446e-06, "loss": 2.500601291656494, "mean_token_accuracy": 0.4541237838566303, "num_tokens": 750084.0, "step": 88 }, { "ema_loss": 2.505239, "entropy": 2.534710943698883, "epoch": 0.5305514157973175, "grad_norm": 14.291346549987793, "learning_rate": 3.1619133551430423e-06, "loss": 2.5472054481506348, "mean_token_accuracy": 0.46244263276457787, "num_tokens": 759139.0, "step": 89 }, { "ema_loss": 2.493446, "entropy": 2.4175406992435455, "epoch": 0.5365126676602087, "grad_norm": 9.251571655273438, "learning_rate": 3.1589693207934033e-06, "loss": 2.3873138427734375, "mean_token_accuracy": 0.4840426743030548, "num_tokens": 767805.0, "step": 90 }, { "ema_loss": 2.486368, "entropy": 2.4317905604839325, "epoch": 0.5424739195230999, "grad_norm": 10.128194808959961, "learning_rate": 3.166430587953073e-06, "loss": 2.4226622581481934, "mean_token_accuracy": 0.477420661598444, "num_tokens": 776246.0, "step": 91 }, { "ema_loss": 2.493314, "entropy": 2.5107901990413666, "epoch": 0.5484351713859911, "grad_norm": 8.482745170593262, "learning_rate": 3.170934633089928e-06, "loss": 2.5558314323425293, "mean_token_accuracy": 0.45741379633545876, "num_tokens": 784771.0, "step": 92 }, { "ema_loss": 2.494497, "entropy": 2.4786913692951202, "epoch": 0.5543964232488823, "grad_norm": 10.047304153442383, "learning_rate": 3.1665144888393115e-06, "loss": 2.5051379203796387, "mean_token_accuracy": 0.4736161008477211, "num_tokens": 793374.0, "step": 93 }, { "ema_loss": 2.499282, "entropy": 2.504456102848053, "epoch": 0.5603576751117735, "grad_norm": 10.319989204406738, "learning_rate": 3.1657639283366734e-06, "loss": 2.542351007461548, "mean_token_accuracy": 0.4658089019358158, "num_tokens": 801808.0, "step": 94 }, { "ema_loss": 2.491526, "entropy": 2.392134368419647, "epoch": 0.5663189269746647, "grad_norm": 10.805543899536133, "learning_rate": 3.1627316730009625e-06, "loss": 2.421725273132324, "mean_token_accuracy": 0.4783647917211056, "num_tokens": 810369.0, "step": 95 }, { "ema_loss": 2.491652, "entropy": 2.4964487552642822, "epoch": 0.5722801788375559, "grad_norm": 16.524826049804688, "learning_rate": 3.167650447721826e-06, "loss": 2.492780923843384, "mean_token_accuracy": 0.4766409583389759, "num_tokens": 818637.0, "step": 96 }, { "ema_loss": 2.49385, "entropy": 2.5022054314613342, "epoch": 0.5782414307004471, "grad_norm": 11.140637397766113, "learning_rate": 3.1675706395617453e-06, "loss": 2.5136349201202393, "mean_token_accuracy": 0.45694299414753914, "num_tokens": 827324.0, "step": 97 }, { "ema_loss": 2.489377, "entropy": 2.4622524678707123, "epoch": 0.5842026825633383, "grad_norm": 8.259963035583496, "learning_rate": 3.1661743378208485e-06, "loss": 2.4491167068481445, "mean_token_accuracy": 0.4776587150990963, "num_tokens": 835886.0, "step": 98 }, { "ema_loss": 2.488237, "entropy": 2.473651707172394, "epoch": 0.5901639344262295, "grad_norm": 9.729534149169922, "learning_rate": 3.169017645632266e-06, "loss": 2.477982521057129, "mean_token_accuracy": 0.46288613229990005, "num_tokens": 844257.0, "step": 99 }, { "ema_loss": 2.488324, "entropy": 2.4614046812057495, "epoch": 0.5961251862891207, "grad_norm": 10.870255470275879, "learning_rate": 3.1697431950306054e-06, "loss": 2.489107608795166, "mean_token_accuracy": 0.46925194561481476, "num_tokens": 853098.0, "step": 100 }, { "ema_loss": 2.478005, "entropy": 2.432777225971222, "epoch": 0.6020864381520119, "grad_norm": 9.955513954162598, "learning_rate": 3.1696877158537973e-06, "loss": 2.385134220123291, "mean_token_accuracy": 0.47530462220311165, "num_tokens": 861432.0, "step": 101 }, { "ema_loss": 2.4762, "entropy": 2.4765623807907104, "epoch": 0.6080476900149031, "grad_norm": 9.051411628723145, "learning_rate": 3.1762806429469492e-06, "loss": 2.4599549770355225, "mean_token_accuracy": 0.4816667214035988, "num_tokens": 870535.0, "step": 102 }, { "ema_loss": 2.487189, "entropy": 2.556839197874069, "epoch": 0.6140089418777943, "grad_norm": 9.301383972167969, "learning_rate": 3.1774382023286307e-06, "loss": 2.586087465286255, "mean_token_accuracy": 0.45860015228390694, "num_tokens": 878969.0, "step": 103 }, { "ema_loss": 2.492292, "entropy": 2.477188676595688, "epoch": 0.6199701937406855, "grad_norm": 11.706933975219727, "learning_rate": 3.1704112188890576e-06, "loss": 2.5382192134857178, "mean_token_accuracy": 0.45725658908486366, "num_tokens": 886494.0, "step": 104 }, { "ema_loss": 2.49125, "entropy": 2.448609471321106, "epoch": 0.6259314456035767, "grad_norm": 9.13033390045166, "learning_rate": 3.1671638680563774e-06, "loss": 2.481873035430908, "mean_token_accuracy": 0.4714179150760174, "num_tokens": 894247.0, "step": 105 }, { "ema_loss": 2.492709, "entropy": 2.421579748392105, "epoch": 0.6318926974664679, "grad_norm": 9.656438827514648, "learning_rate": 3.167825980199268e-06, "loss": 2.5058372020721436, "mean_token_accuracy": 0.4588251896202564, "num_tokens": 902678.0, "step": 106 }, { "ema_loss": 2.492367, "entropy": 2.5471714437007904, "epoch": 0.6378539493293591, "grad_norm": 12.687307357788086, "learning_rate": 3.166898977724486e-06, "loss": 2.4892921447753906, "mean_token_accuracy": 0.467985175549984, "num_tokens": 910855.0, "step": 107 }, { "ema_loss": 2.497652, "entropy": 2.525157868862152, "epoch": 0.6438152011922503, "grad_norm": 9.408348083496094, "learning_rate": 3.1671161195845343e-06, "loss": 2.5452120304107666, "mean_token_accuracy": 0.4636007212102413, "num_tokens": 919134.0, "step": 108 }, { "ema_loss": 2.492908, "entropy": 2.5188702046871185, "epoch": 0.6497764530551415, "grad_norm": 9.104681015014648, "learning_rate": 3.1637639494874747e-06, "loss": 2.45021653175354, "mean_token_accuracy": 0.47065258026123047, "num_tokens": 927967.0, "step": 109 }, { "ema_loss": 2.480429, "entropy": 2.39021834731102, "epoch": 0.6557377049180327, "grad_norm": 27.89146614074707, "learning_rate": 3.166772330587264e-06, "loss": 2.3681154251098633, "mean_token_accuracy": 0.48315392434597015, "num_tokens": 935828.0, "step": 110 }, { "ema_loss": 2.489247, "entropy": 2.5677508413791656, "epoch": 0.6616989567809239, "grad_norm": 10.855072975158691, "learning_rate": 3.1747285902383737e-06, "loss": 2.5686066150665283, "mean_token_accuracy": 0.4622080475091934, "num_tokens": 944673.0, "step": 111 }, { "ema_loss": 2.490613, "entropy": 2.4450491964817047, "epoch": 0.6676602086438153, "grad_norm": 11.64538860321045, "learning_rate": 3.169100637023803e-06, "loss": 2.502915143966675, "mean_token_accuracy": 0.4636743329465389, "num_tokens": 953628.0, "step": 112 }, { "ema_loss": 2.481624, "entropy": 2.3909108638763428, "epoch": 0.6736214605067065, "grad_norm": 9.75118350982666, "learning_rate": 3.1682309327152325e-06, "loss": 2.4007184505462646, "mean_token_accuracy": 0.4813036844134331, "num_tokens": 962807.0, "step": 113 }, { "ema_loss": 2.486826, "entropy": 2.5513379871845245, "epoch": 0.6795827123695977, "grad_norm": 9.65710163116455, "learning_rate": 3.1739641599415336e-06, "loss": 2.5336451530456543, "mean_token_accuracy": 0.46318120136857033, "num_tokens": 971314.0, "step": 114 }, { "ema_loss": 2.494143, "entropy": 2.499554306268692, "epoch": 0.6855439642324889, "grad_norm": 9.788527488708496, "learning_rate": 3.1706424579169834e-06, "loss": 2.5599939823150635, "mean_token_accuracy": 0.4570281133055687, "num_tokens": 979707.0, "step": 115 }, { "ema_loss": 2.486431, "entropy": 2.3563145995140076, "epoch": 0.6915052160953801, "grad_norm": 9.082870483398438, "learning_rate": 3.1659885735280113e-06, "loss": 2.4170260429382324, "mean_token_accuracy": 0.4776231236755848, "num_tokens": 988535.0, "step": 116 }, { "ema_loss": 2.486379, "entropy": 2.4710371792316437, "epoch": 0.6974664679582713, "grad_norm": 9.17809009552002, "learning_rate": 3.1708943879493745e-06, "loss": 2.4859111309051514, "mean_token_accuracy": 0.46819906309247017, "num_tokens": 997012.0, "step": 117 }, { "ema_loss": 2.48232, "entropy": 2.468187153339386, "epoch": 0.7034277198211625, "grad_norm": 12.131582260131836, "learning_rate": 3.1709275845059892e-06, "loss": 2.445786476135254, "mean_token_accuracy": 0.4712617062032223, "num_tokens": 1005664.0, "step": 118 }, { "ema_loss": 2.484116, "entropy": 2.502743184566498, "epoch": 0.7093889716840537, "grad_norm": 10.60308837890625, "learning_rate": 3.173519189658691e-06, "loss": 2.5002760887145996, "mean_token_accuracy": 0.4747677519917488, "num_tokens": 1014267.0, "step": 119 }, { "ema_loss": 2.479424, "entropy": 2.443909674882889, "epoch": 0.7153502235469449, "grad_norm": 9.63713550567627, "learning_rate": 3.1723718620924046e-06, "loss": 2.4372005462646484, "mean_token_accuracy": 0.476393636316061, "num_tokens": 1023028.0, "step": 120 }, { "ema_loss": 2.476473, "entropy": 2.441799134016037, "epoch": 0.7213114754098361, "grad_norm": 12.006004333496094, "learning_rate": 3.1753718303662026e-06, "loss": 2.44990873336792, "mean_token_accuracy": 0.47247370705008507, "num_tokens": 1031909.0, "step": 121 }, { "ema_loss": 2.467984, "entropy": 2.412250816822052, "epoch": 0.7272727272727273, "grad_norm": 10.485976219177246, "learning_rate": 3.1772635793458903e-06, "loss": 2.391584873199463, "mean_token_accuracy": 0.4787902347743511, "num_tokens": 1040309.0, "step": 122 }, { "ema_loss": 2.471129, "entropy": 2.5132686495780945, "epoch": 0.7332339791356185, "grad_norm": 14.652153968811035, "learning_rate": 3.1827230486669578e-06, "loss": 2.499431848526001, "mean_token_accuracy": 0.4708300344645977, "num_tokens": 1049190.0, "step": 123 }, { "ema_loss": 2.457116, "entropy": 2.3615612983703613, "epoch": 0.7391952309985097, "grad_norm": 10.791399002075195, "learning_rate": 3.1806971492187586e-06, "loss": 2.331005096435547, "mean_token_accuracy": 0.4832313619554043, "num_tokens": 1057791.0, "step": 124 }, { "ema_loss": 2.456835, "entropy": 2.4322995841503143, "epoch": 0.7451564828614009, "grad_norm": 8.731391906738281, "learning_rate": 3.189753670085338e-06, "loss": 2.454306125640869, "mean_token_accuracy": 0.4715655893087387, "num_tokens": 1066508.0, "step": 125 }, { "ema_loss": 2.469299, "entropy": 2.4698216319084167, "epoch": 0.7511177347242921, "grad_norm": 12.659331321716309, "learning_rate": 3.1899360237730434e-06, "loss": 2.5814757347106934, "mean_token_accuracy": 0.4539182633161545, "num_tokens": 1075050.0, "step": 126 }, { "ema_loss": 2.468091, "entropy": 2.4331336617469788, "epoch": 0.7570789865871833, "grad_norm": 8.847606658935547, "learning_rate": 3.18187517223123e-06, "loss": 2.457216262817383, "mean_token_accuracy": 0.4786255583167076, "num_tokens": 1082919.0, "step": 127 }, { "ema_loss": 2.474611, "entropy": 2.489920824766159, "epoch": 0.7630402384500745, "grad_norm": 9.212372779846191, "learning_rate": 3.182653927069623e-06, "loss": 2.5332894325256348, "mean_token_accuracy": 0.4649209901690483, "num_tokens": 1091965.0, "step": 128 }, { "ema_loss": 2.472347, "entropy": 2.4455311000347137, "epoch": 0.7690014903129657, "grad_norm": 8.813133239746094, "learning_rate": 3.1784584280103445e-06, "loss": 2.451972246170044, "mean_token_accuracy": 0.47588760778307915, "num_tokens": 1100403.0, "step": 129 }, { "ema_loss": 2.469701, "entropy": 2.491946190595627, "epoch": 0.7749627421758569, "grad_norm": 11.128362655639648, "learning_rate": 3.1799133921595057e-06, "loss": 2.445887565612793, "mean_token_accuracy": 0.4782499335706234, "num_tokens": 1108342.0, "step": 130 }, { "ema_loss": 2.468909, "entropy": 2.50220388174057, "epoch": 0.7809239940387481, "grad_norm": 8.778305053710938, "learning_rate": 3.1816164209885756e-06, "loss": 2.4617795944213867, "mean_token_accuracy": 0.46836214140057564, "num_tokens": 1117022.0, "step": 131 }, { "ema_loss": 2.467851, "entropy": 2.444972276687622, "epoch": 0.7868852459016393, "grad_norm": 8.718592643737793, "learning_rate": 3.18212664751627e-06, "loss": 2.45833420753479, "mean_token_accuracy": 0.4704691916704178, "num_tokens": 1125333.0, "step": 132 }, { "ema_loss": 2.468837, "entropy": 2.450087457895279, "epoch": 0.7928464977645305, "grad_norm": 10.077498435974121, "learning_rate": 3.182808313795249e-06, "loss": 2.477708101272583, "mean_token_accuracy": 0.4686315059661865, "num_tokens": 1133314.0, "step": 133 }, { "ema_loss": 2.463645, "entropy": 2.457848995923996, "epoch": 0.7988077496274217, "grad_norm": 9.503003120422363, "learning_rate": 3.1821730317460606e-06, "loss": 2.416914224624634, "mean_token_accuracy": 0.4749920628964901, "num_tokens": 1142011.0, "step": 134 }, { "ema_loss": 2.464197, "entropy": 2.5023904740810394, "epoch": 0.8047690014903129, "grad_norm": 9.772120475769043, "learning_rate": 3.185524519722094e-06, "loss": 2.469165086746216, "mean_token_accuracy": 0.4653155617415905, "num_tokens": 1151161.0, "step": 135 }, { "ema_loss": 2.45834, "entropy": 2.38649120926857, "epoch": 0.8107302533532041, "grad_norm": 8.41637897491455, "learning_rate": 3.1851677704253234e-06, "loss": 2.405625104904175, "mean_token_accuracy": 0.47616972774267197, "num_tokens": 1160033.0, "step": 136 }, { "ema_loss": 2.45772, "entropy": 2.3599334061145782, "epoch": 0.8166915052160953, "grad_norm": 9.85244369506836, "learning_rate": 3.1889599085843656e-06, "loss": 2.452146530151367, "mean_token_accuracy": 0.4799215868115425, "num_tokens": 1168138.0, "step": 137 }, { "ema_loss": 2.443765, "entropy": 2.292998105287552, "epoch": 0.8226527570789866, "grad_norm": 9.154830932617188, "learning_rate": 3.189361677868874e-06, "loss": 2.3181679248809814, "mean_token_accuracy": 0.48478927835822105, "num_tokens": 1176948.0, "step": 138 }, { "ema_loss": 2.445251, "entropy": 2.4074034988880157, "epoch": 0.8286140089418778, "grad_norm": 10.852060317993164, "learning_rate": 3.1984552606445504e-06, "loss": 2.458623170852661, "mean_token_accuracy": 0.46587422490119934, "num_tokens": 1185353.0, "step": 139 }, { "ema_loss": 2.436672, "entropy": 2.31598499417305, "epoch": 0.834575260804769, "grad_norm": 11.664974212646484, "learning_rate": 3.1974832381820306e-06, "loss": 2.359466552734375, "mean_token_accuracy": 0.4766411781311035, "num_tokens": 1193568.0, "step": 140 }, { "ema_loss": 2.446731, "entropy": 2.5056651532649994, "epoch": 0.8405365126676602, "grad_norm": 9.474003791809082, "learning_rate": 3.203106871296768e-06, "loss": 2.5372564792633057, "mean_token_accuracy": 0.4660654366016388, "num_tokens": 1202319.0, "step": 141 }, { "ema_loss": 2.448912, "entropy": 2.489292860031128, "epoch": 0.8464977645305514, "grad_norm": 10.952320098876953, "learning_rate": 3.196515990566695e-06, "loss": 2.4685394763946533, "mean_token_accuracy": 0.4775763638317585, "num_tokens": 1211220.0, "step": 142 }, { "ema_loss": 2.458273, "entropy": 2.5898122787475586, "epoch": 0.8524590163934426, "grad_norm": 10.829803466796875, "learning_rate": 3.195092403984745e-06, "loss": 2.542524576187134, "mean_token_accuracy": 0.4659740924835205, "num_tokens": 1219328.0, "step": 143 }, { "ema_loss": 2.441146, "entropy": 2.394240975379944, "epoch": 0.8584202682563339, "grad_norm": 10.64773178100586, "learning_rate": 3.1890031095827e-06, "loss": 2.2870030403137207, "mean_token_accuracy": 0.48136210441589355, "num_tokens": 1227592.0, "step": 144 }, { "ema_loss": 2.447987, "entropy": 2.533678025007248, "epoch": 0.8643815201192251, "grad_norm": 9.229103088378906, "learning_rate": 3.200170567652094e-06, "loss": 2.5095512866973877, "mean_token_accuracy": 0.4723149351775646, "num_tokens": 1236496.0, "step": 145 }, { "ema_loss": 2.444625, "entropy": 2.4223859906196594, "epoch": 0.8703427719821163, "grad_norm": 9.593953132629395, "learning_rate": 3.195696081093047e-06, "loss": 2.414371967315674, "mean_token_accuracy": 0.47336339950561523, "num_tokens": 1245185.0, "step": 146 }, { "ema_loss": 2.453131, "entropy": 2.478481352329254, "epoch": 0.8763040238450075, "grad_norm": 14.706073760986328, "learning_rate": 3.1978925107978284e-06, "loss": 2.529683828353882, "mean_token_accuracy": 0.4620239660143852, "num_tokens": 1253568.0, "step": 147 }, { "ema_loss": 2.44767, "entropy": 2.3135411143302917, "epoch": 0.8822652757078987, "grad_norm": 9.33918571472168, "learning_rate": 3.192343683622312e-06, "loss": 2.39851975440979, "mean_token_accuracy": 0.4821960851550102, "num_tokens": 1262027.0, "step": 148 }, { "ema_loss": 2.447672, "entropy": 2.405791759490967, "epoch": 0.8882265275707899, "grad_norm": 11.515854835510254, "learning_rate": 3.1959029911377e-06, "loss": 2.4476921558380127, "mean_token_accuracy": 0.474007211625576, "num_tokens": 1270470.0, "step": 149 }, { "ema_loss": 2.44237, "entropy": 2.364792674779892, "epoch": 0.8941877794336811, "grad_norm": 10.023574829101562, "learning_rate": 3.195901399521972e-06, "loss": 2.3946516513824463, "mean_token_accuracy": 0.47734876349568367, "num_tokens": 1279312.0, "step": 150 }, { "ema_loss": 2.434898, "entropy": 2.345351606607437, "epoch": 0.9001490312965723, "grad_norm": 9.919730186462402, "learning_rate": 3.1993683933251305e-06, "loss": 2.3676483631134033, "mean_token_accuracy": 0.48006097599864006, "num_tokens": 1287252.0, "step": 151 }, { "ema_loss": 2.437333, "entropy": 2.4682799577713013, "epoch": 0.9061102831594635, "grad_norm": 9.708532333374023, "learning_rate": 3.2042737529991427e-06, "loss": 2.459247350692749, "mean_token_accuracy": 0.482760239392519, "num_tokens": 1295470.0, "step": 152 }, { "ema_loss": 2.432031, "entropy": 2.405406892299652, "epoch": 0.9120715350223547, "grad_norm": 9.599799156188965, "learning_rate": 3.202672814950347e-06, "loss": 2.384316921234131, "mean_token_accuracy": 0.4820447005331516, "num_tokens": 1304013.0, "step": 153 }, { "ema_loss": 2.43306, "entropy": 2.5023592114448547, "epoch": 0.9180327868852459, "grad_norm": 9.433198928833008, "learning_rate": 3.206161636626348e-06, "loss": 2.4423205852508545, "mean_token_accuracy": 0.4827638044953346, "num_tokens": 1312707.0, "step": 154 }, { "ema_loss": 2.438319, "entropy": 2.4730353951454163, "epoch": 0.9239940387481371, "grad_norm": 11.762249946594238, "learning_rate": 3.205483608326176e-06, "loss": 2.4856462478637695, "mean_token_accuracy": 0.47076499834656715, "num_tokens": 1321481.0, "step": 155 }, { "ema_loss": 2.444482, "entropy": 2.453797399997711, "epoch": 0.9299552906110283, "grad_norm": 11.320847511291504, "learning_rate": 3.2020252547226846e-06, "loss": 2.499951124191284, "mean_token_accuracy": 0.4810183197259903, "num_tokens": 1329756.0, "step": 156 }, { "ema_loss": 2.444584, "entropy": 2.438876360654831, "epoch": 0.9359165424739195, "grad_norm": 9.964897155761719, "learning_rate": 3.197986188752111e-06, "loss": 2.4455037117004395, "mean_token_accuracy": 0.47638460248708725, "num_tokens": 1338463.0, "step": 157 }, { "ema_loss": 2.445118, "entropy": 2.446000039577484, "epoch": 0.9418777943368107, "grad_norm": 13.373855590820312, "learning_rate": 3.1979193408915307e-06, "loss": 2.4499268531799316, "mean_token_accuracy": 0.4829609580338001, "num_tokens": 1346619.0, "step": 158 }, { "ema_loss": 2.459903, "entropy": 2.608183979988098, "epoch": 0.9478390461997019, "grad_norm": 8.653999328613281, "learning_rate": 3.1975698675523745e-06, "loss": 2.592966079711914, "mean_token_accuracy": 0.45635176822543144, "num_tokens": 1355353.0, "step": 159 }, { "ema_loss": 2.462413, "entropy": 2.491154819726944, "epoch": 0.9538002980625931, "grad_norm": 8.591419219970703, "learning_rate": 3.1879462767392397e-06, "loss": 2.4850010871887207, "mean_token_accuracy": 0.4685532972216606, "num_tokens": 1364152.0, "step": 160 }, { "ema_loss": 2.458309, "entropy": 2.430310010910034, "epoch": 0.9597615499254843, "grad_norm": 10.238286972045898, "learning_rate": 3.186321237080847e-06, "loss": 2.421370267868042, "mean_token_accuracy": 0.47355296090245247, "num_tokens": 1373174.0, "step": 161 }, { "ema_loss": 2.440605, "entropy": 2.2720790803432465, "epoch": 0.9657228017883756, "grad_norm": 8.271235466003418, "learning_rate": 3.1889799174678046e-06, "loss": 2.2812671661376953, "mean_token_accuracy": 0.5029720067977905, "num_tokens": 1381677.0, "step": 162 }, { "ema_loss": 2.437561, "entropy": 2.3546833097934723, "epoch": 0.9716840536512668, "grad_norm": 9.900911331176758, "learning_rate": 3.200525497959461e-06, "loss": 2.410165548324585, "mean_token_accuracy": 0.4806106947362423, "num_tokens": 1390302.0, "step": 163 }, { "ema_loss": 2.437979, "entropy": 2.4232480227947235, "epoch": 0.977645305514158, "grad_norm": 16.232555389404297, "learning_rate": 3.2025232030719053e-06, "loss": 2.441741466522217, "mean_token_accuracy": 0.4852936938405037, "num_tokens": 1398943.0, "step": 164 }, { "ema_loss": 2.444223, "entropy": 2.4465608298778534, "epoch": 0.9836065573770492, "grad_norm": 13.164146423339844, "learning_rate": 3.20224853567197e-06, "loss": 2.5004208087921143, "mean_token_accuracy": 0.4741458408534527, "num_tokens": 1407830.0, "step": 165 }, { "ema_loss": 2.444812, "entropy": 2.4439519941806793, "epoch": 0.9895678092399404, "grad_norm": 9.724125862121582, "learning_rate": 3.1981555821403163e-06, "loss": 2.4501099586486816, "mean_token_accuracy": 0.4780493304133415, "num_tokens": 1416038.0, "step": 166 }, { "ema_loss": 2.444594, "entropy": 2.4850481748580933, "epoch": 0.9955290611028316, "grad_norm": 9.390581130981445, "learning_rate": 3.1977704111341154e-06, "loss": 2.442631244659424, "mean_token_accuracy": 0.4701741598546505, "num_tokens": 1424524.0, "step": 167 }, { "ema_loss": 2.450283, "entropy": 2.4779295921325684, "epoch": 1.0, "grad_norm": 9.768173217773438, "learning_rate": 3.1979132018022938e-06, "loss": 2.5014877319335938, "mean_token_accuracy": 0.47129519283771515, "num_tokens": 1430899.0, "step": 168 } ], "logging_steps": 1, "max_steps": 840, "num_input_tokens_seen": 0, "num_train_epochs": 5, "save_steps": 500, "stateful_callbacks": { "TrainerControl": { "args": { "should_epoch_stop": false, "should_evaluate": false, "should_log": false, "should_save": true, "should_training_stop": false }, "attributes": {} } }, "total_flos": 2.7947074296340186e+17, "train_batch_size": 2, "trial_name": null, "trial_params": null}123version https://git-lfs.github.com/spec/v1oid sha256:6a570e872d935ba3f72652a178ab568e278c971706fd60b0be421ed73b511e20size 5777123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208---base_model: google/gemma-4-31B-itlibrary_name: pefttags:- base_model:adapter:google/gemma-4-31B-it- lora- sft- transformers- trl---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** [More Information Needed]- **Funded by [optional]:** [More Information Needed]- **Shared by [optional]:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** [More Information Needed]- **Paper [optional]:** [More Information Needed]- **Demo [optional]:** [More Information Needed]
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
[More Information Needed]
### Downstream Use [optional]
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
[More Information Needed]
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
[More Information Needed]
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
[More Information Needed]
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
## How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
[More Information Needed]
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Preprocessing [optional]
[More Information Needed]
#### Training Hyperparameters
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
#### Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
#### Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
[More Information Needed]
### Results
[More Information Needed]
#### Summary
## Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
[More Information Needed]
## Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]
## Technical Specifications [optional]
### Model Architecture and Objective
[More Information Needed]
### Compute Infrastructure
[More Information Needed]
#### Hardware
[More Information Needed]
#### Software
[More Information Needed]
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
**BibTeX:**
[More Information Needed]
**APA:**
[More Information Needed]
## Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
[More Information Needed]
## More Information [optional]
[More Information Needed]
## Model Card Authors [optional]
[More Information Needed]
## Model Card Contact
[More Information Needed]### Framework versions
- PEFT 0.21.312345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4" }, "base_model_name_or_path": "google/gemma-4-31B-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "kasa_config": null, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 1448, "lora_bias": false, "lora_dropout": 0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "monteclora_config": null, "peft_type": "LORA", "peft_version": "0.21.3", "qalora_group_size": 16, "r": 32, "rank_pattern": {}, "revision": null, "target_modules": ".*\\.language_model.*\\.(q_proj|k_proj|v_proj|gate_proj|up_proj|down_proj|o_proj)", "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false, "velora_config": null}123version https://git-lfs.github.com/spec/v1oid sha256:7041408be7f1ae345d6fcf0cddb86665548d45099963bb1ae6a5d66c8125811dsize 979558760123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403{# Template: Google Gemma 4 Canonical Chat Template Author: Google Gemma Engineering Team Published: 2026-07-09 Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.#}{%- macro format_parameters(properties, required, filter_keys=false) -%} {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%} {%- set ns = namespace(found_first=false) -%} {%- for key, value in properties | dictsort -%} {%- set add_comma = false -%} {%- if not filter_keys or key not in standard_keys -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {{ key }}:{ {%- if value['description'] -%} description:<|"|>{{ value['description'] }}<|"|> {%- set add_comma = true -%} {%- endif -%} {%- if value['type'] | upper == 'STRING' -%} {%- if value['enum'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} enum:{{ format_argument(value['enum']) }} {%- endif -%} {%- elif value['type'] | upper == 'ARRAY' -%} {%- if value['items'] is mapping and value['items'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} items:{ {%- set ns_items = namespace(found_first=false) -%} {%- for item_key, item_value in value['items'] | dictsort -%} {%- if item_value is not none -%} {%- if ns_items.found_first %},{% endif -%} {%- set ns_items.found_first = true -%} {%- if item_key == 'properties' -%} properties:{ {%- if item_value is mapping -%} {{- format_parameters(item_value, value['items']['required'] | default([])) -}} {%- endif -%} } {%- elif item_key == 'required' -%} required:[ {%- for req_item in item_value -%} <|"|>{{- req_item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- elif item_key == 'type' -%} {%- if item_value is string -%} type:{{ format_argument(item_value | upper) }} {%- else -%} type:{{ format_argument(item_value | map('upper') | list) }} {%- endif -%} {%- else -%} {{ item_key }}:{{ format_argument(item_value) }} {%- endif -%} {%- endif -%} {%- endfor -%} } {%- endif -%} {%- endif -%} {%- if value['nullable'] %} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} nullable:true {%- endif -%} {%- if value['type'] | upper == 'OBJECT' -%} {%- if value['properties'] is defined and value['properties'] is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value['properties'], value['required'] | default([])) -}} } {%- elif value is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}} } {%- endif -%} {%- if value['required'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} required:[ {%- for item in value['required'] | default([]) -%} <|"|>{{- item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- endif -%} {%- endif -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} type:<|"|>{{ value['type'] | upper }}<|"|>} {%- endif -%} {%- endfor -%}{%- endmacro -%}{%- macro format_function_declaration(tool_data) -%} declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|> {%- set params = tool_data['function']['parameters'] -%} {%- if params -%} ,parameters:{ {%- if params['properties'] -%} properties:{ {{- format_parameters(params['properties'], params['required']) -}} }, {%- endif -%} {%- if params['required'] -%} required:[ {%- for item in params['required'] -%} <|"|>{{- item -}}<|"|> {{- ',' if not loop.last -}} {%- endfor -%} ], {%- endif -%} {%- if params['type'] -%} type:<|"|>{{- params['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} {%- if 'response' in tool_data['function'] -%} {%- set response_declaration = tool_data['function']['response'] -%} ,response:{ {%- if response_declaration['description'] -%} description:<|"|>{{- response_declaration['description'] -}}<|"|>, {%- endif -%} {%- if response_declaration['type'] | upper == 'OBJECT' -%} type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} }{%- endmacro -%}{%- macro format_argument(argument, escape_keys=True) -%} {%- if argument is none -%} {{- 'null' -}} {%- elif argument is string -%} {{- '<|"|>' + argument + '<|"|>' -}} {%- elif argument is boolean -%} {{- 'true' if argument else 'false' -}} {%- elif argument is mapping -%} {{- '{' -}} {%- set ns = namespace(found_first=false) -%} {%- for key, value in argument | dictsort -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {%- if escape_keys -%} {{- '<|"|>' + key + '<|"|>' -}} {%- else -%} {{- key -}} {%- endif -%} :{{- format_argument(value, escape_keys=escape_keys) -}} {%- endfor -%} {{- '}' -}} {%- elif argument is sequence -%} {{- '[' -}} {%- for item in argument -%} {{- format_argument(item, escape_keys=escape_keys) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- ']' -}} {%- else -%} {{- argument -}} {%- endif -%}{%- endmacro -%}{%- macro strip_thinking(text) -%} {%- set ns = namespace(result='') -%} {%- for part in text.split('<channel|>') -%} {%- if '<|channel>' in part -%} {%- set ns.result = ns.result + part.split('<|channel>')[0] -%} {%- else -%} {%- set ns.result = ns.result + part -%} {%- endif -%} {%- endfor -%} {{- ns.result | trim -}}{%- endmacro -%}
{%- macro format_tool_response_block(tool_name, response) -%} {{- '<|tool_response>' -}} {%- if response is mapping -%} {{- 'response:' + tool_name + '{' -}} {%- for key, value in response | dictsort -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- '}' -}} {%- else -%} {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}} {%- endif -%} {{- '<tool_response|>' -}}{%- endmacro -%}
{#- ===== SETUP ===== -#}{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}{%- set loop_messages = messages -%}{%- set enable_thinking = enable_thinking | default(false) -%}{%- set preserve_thinking = preserve_thinking | default(false) -%}{{- bos_token -}}{#- Handle System/Tool Definitions Block -#}{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%} {{- '<|turn>system' -}} {#- Inject Thinking token at the very top of the FIRST system turn -#} {%- if enable_thinking -%} {{- '<|think|>' -}} {%- set ns.prev_message_type = 'think' -%} {%- endif -%} {%- if messages and messages[0]['role'] in ['system', 'developer'] -%} {%- if messages[0]['content'] is string -%} {{- messages[0]['content'] | trim -}} {%- elif messages[0]['content'] is sequence -%} {%- for item in messages[0]['content'] -%} {{- item['text'] | trim + ' '-}} {%- endfor -%} {%- endif -%} {%- set loop_messages = messages[1:] -%} {%- endif -%} {%- if tools -%} {%- for tool in tools %} {{- '<|tool>' -}} {{- format_function_declaration(tool) | trim -}} {{- '<tool|>' -}} {%- endfor %} {%- set ns.prev_message_type = 'tool' -%} {%- endif -%} {{- '<turn|>' -}}{%- endif %}
{#- Pre-scan: find last user message index for reasoning guard -#}{%- set ns_turn = namespace(last_user_idx=-1) -%}{%- for i in range(loop_messages | length) -%} {%- if loop_messages[i]['role'] == 'user' -%} {%- set ns_turn.last_user_idx = i -%} {%- endif -%}{%- endfor -%}
{#- Loop through messages -#}{%- for message in loop_messages -%} {%- if message['role'] != 'tool' -%} {%- set ns.prev_message_type = None -%} {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%} {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#} {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%} {%- if not continue_same_model_turn -%} {{- '<|turn>' + role + '' }}
{%- endif -%}
{#- Render reasoning/reasoning_content as thinking channel -#} {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%} {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%} {%- if thinking_text and thinking_gate -%} {{- '<|channel>thought' + thinking_text + '<channel|>' -}} {%- elif message['role'] == 'assistant' and loop.last -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%}
{%- if message.get('tool_calls') -%} {%- for tool_call in message.get('tool_calls') -%} {%- set function = tool_call['function'] -%} {{- '<|tool_call>call:' + function['name'] + '{' -}} {%- if function['arguments'] is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in function['arguments'] | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- elif function['arguments'] is none -%} {%- else -%} {{- raise_exception( "chat_template: tool_calls[].function.arguments must be a " "JSON object (mapping), not a string. Deserialize arguments " "before passing to the template." ) -}} {%- endif -%} {{- '}<tool_call|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_call' -%} {%- endif -%}
{%- set ns_tr_out = namespace(flag=false) -%} {%- if message.get('tool_responses') -%} {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#} {%- for tool_response in message.get('tool_responses') -%} {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endfor -%} {%- elif message.get('tool_calls') -%} {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#} {%- set ns_tool_scan = namespace(stopped=false) -%} {%- for k in range(loop.index0 + 1, loop_messages | length) -%} {%- if ns_tool_scan.stopped -%} {%- elif loop_messages[k]['role'] != 'tool' -%} {%- set ns_tool_scan.stopped = true -%} {%- else -%} {%- set follow = loop_messages[k] -%} {#- Resolve tool_call_id to function name -#} {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%} {%- for tc in message.get('tool_calls') -%} {%- if tc.get('id') == follow.get('tool_call_id') -%} {%- set ns_tname.name = tc['function']['name'] -%} {%- endif -%} {%- endfor -%} {#- Handle content as string or content-parts array -#} {%- set tool_body = follow.get('content') -%} {%- if tool_body is string -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- elif tool_body is sequence and tool_body is not string -%} {%- set ns_txt = namespace(s='') -%} {%- for part in tool_body -%} {%- if part.get('type') == 'text' -%} {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%} {%- endif -%} {%- endfor -%} {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}} {%- for part in tool_body -%} {%- if part.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif part.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif part.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- else -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- endif -%} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endif -%} {%- endfor -%} {%- endif -%}
{%- set captured_content -%} {%- if message.get('content') is string -%} {%- if role == 'model' -%} {{- strip_thinking(message['content']) -}} {%- else -%} {{- message['content'] | trim -}} {%- endif -%} {%- elif message.get('content') is sequence -%} {%- for item in message['content'] -%} {%- if item.get('type') == 'text' -%} {%- if role == 'model' -%} {{- strip_thinking(item['text']) -}} {%- else -%} {{- item['text'] | trim -}} {%- endif -%} {%- elif item.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif item.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif item.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endset -%}
{{- captured_content -}} {%- set has_content = captured_content | trim | length > 0 -%}
{#- Forward-scan: find next non-tool message role for continuation detection -#} {%- set next_nt = namespace(role=None, found=false) -%} {%- for j in range(loop.index0 + 1, loop_messages | length) -%} {%- if not next_nt.found -%} {%- if loop_messages[j]['role'] != 'tool' -%} {%- set next_nt.role = loop_messages[j]['role'] -%} {%- set next_nt.found = true -%} {%- endif -%} {%- endif -%} {%- endfor -%}
{%- set continues_into_next = ( role == 'model' and next_nt.role == 'assistant' and (not message.get('tool_calls') or ns_tr_out.flag) ) -%}
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%} {{- '<|tool_response>' -}} {%- elif continues_into_next -%} {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%} {{- '<turn|>' -}} {%- endif -%}
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#} {%- set ns.prev_non_tool_role = message['role'] -%} {%- endif -%}{%- endfor -%}
{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%} {{- '<|turn>model' -}} {%- if not enable_thinking -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%} {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%} {{- '<|channel>thought' -}} {%- endif -%}{%- endif -%}123version https://git-lfs.github.com/spec/v1oid sha256:45e685a5233f4b05e6ab528ff15d1c97f27ade1f88328e61ccf728547292bdc6size 500847699123version https://git-lfs.github.com/spec/v1oid sha256:b798fef1a4a3fe78dd37b6330a66ba2d5059bdc98f2d1b20d9bc32a80e57400bsize 14581123version https://git-lfs.github.com/spec/v1oid sha256:a8b0c03ce2ac9ddaa8516dc20fcf9cc25e50c2658bd9fbaf4d9af9f45d389036size 2545123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|image>", "bos_token": "<bos>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eos_token": "<eos>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "extra_special_tokens": [ "<|video|>" ], "image_token": "<|image|>", "is_local": false, "local_files_only": false, "mask_token": "<mask>", "model_max_length": 1000000000000000019884624838656, "model_specific_special_tokens": { "audio_token": "<|audio|>", "boa_token": "<|audio>", "boi_token": "<|image>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "image_token": "<|image|>", "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>" }, "pad_token": "<pad>", "padding_side": "left", "processor_class": "Gemma4Processor", "response_schema": { "properties": { "content": { "type": "string" }, "role": { "const": "assistant" }, "thinking": { "type": "string" }, "tool_calls": { "items": { "properties": { "function": { "properties": { "arguments": { "additionalProperties": {}, "type": "object", "x-parser": "gemma4-tool-call" }, "name": { "type": "string" } }, "type": "object", "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" }, "type": { "const": "function" } }, "type": "object" }, "type": "array", "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" } }, "type": "object", "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" }, "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": [ "<turn|>", "<|tool_response>", "<eos>" ], "content": "text" }, "thinking": { "close": "<channel|>", "content": "text", "open": "<|channel>thought\n" }, "tool_calls": { "close": "<tool_call|>", "content": "json", "content_args": { "string_delims": [ [ "<|\"|>", "<|\"|>" ] ], "unquoted_keys": true }, "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)", "repeats": true, "transform": { "function": { "arguments": "{content}", "name": "{name}" }, "type": "function" } } }, "start_anchor": [ "<|turn>model\n", "<tool_response|>" ] }, "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>", "tokenizer_class": "GemmaTokenizer", "unk_token": "<unk>"}123version https://git-lfs.github.com/spec/v1oid sha256:6a570e872d935ba3f72652a178ab568e278c971706fd60b0be421ed73b511e20size 5777123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208---base_model: google/gemma-4-31B-itlibrary_name: pefttags:- base_model:adapter:google/gemma-4-31B-it- lora- sft- transformers- trl---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** [More Information Needed]- **Funded by [optional]:** [More Information Needed]- **Shared by [optional]:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** [More Information Needed]- **Paper [optional]:** [More Information Needed]- **Demo [optional]:** [More Information Needed]
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
[More Information Needed]
### Downstream Use [optional]
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
[More Information Needed]
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
[More Information Needed]
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
[More Information Needed]
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
## How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
[More Information Needed]
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Preprocessing [optional]
[More Information Needed]
#### Training Hyperparameters
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
#### Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
#### Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
[More Information Needed]
### Results
[More Information Needed]
#### Summary
## Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
[More Information Needed]
## Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]
## Technical Specifications [optional]
### Model Architecture and Objective
[More Information Needed]
### Compute Infrastructure
[More Information Needed]
#### Hardware
[More Information Needed]
#### Software
[More Information Needed]
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
**BibTeX:**
[More Information Needed]
**APA:**
[More Information Needed]
## Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
[More Information Needed]
## More Information [optional]
[More Information Needed]
## Model Card Authors [optional]
[More Information Needed]
## Model Card Contact
[More Information Needed]### Framework versions
- PEFT 0.21.312345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4" }, "base_model_name_or_path": "google/gemma-4-31B-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "kasa_config": null, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 1448, "lora_bias": false, "lora_dropout": 0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "monteclora_config": null, "peft_type": "LORA", "peft_version": "0.21.3", "qalora_group_size": 16, "r": 32, "rank_pattern": {}, "revision": null, "target_modules": ".*\\.language_model.*\\.(q_proj|k_proj|v_proj|gate_proj|up_proj|down_proj|o_proj)", "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false, "velora_config": null}123version https://git-lfs.github.com/spec/v1oid sha256:759004c0f320b23672a0940761e2a465bdeedf8fc6564af222bacc26c694f24dsize 979558760123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403{# Template: Google Gemma 4 Canonical Chat Template Author: Google Gemma Engineering Team Published: 2026-07-09 Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.#}{%- macro format_parameters(properties, required, filter_keys=false) -%} {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%} {%- set ns = namespace(found_first=false) -%} {%- for key, value in properties | dictsort -%} {%- set add_comma = false -%} {%- if not filter_keys or key not in standard_keys -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {{ key }}:{ {%- if value['description'] -%} description:<|"|>{{ value['description'] }}<|"|> {%- set add_comma = true -%} {%- endif -%} {%- if value['type'] | upper == 'STRING' -%} {%- if value['enum'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} enum:{{ format_argument(value['enum']) }} {%- endif -%} {%- elif value['type'] | upper == 'ARRAY' -%} {%- if value['items'] is mapping and value['items'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} items:{ {%- set ns_items = namespace(found_first=false) -%} {%- for item_key, item_value in value['items'] | dictsort -%} {%- if item_value is not none -%} {%- if ns_items.found_first %},{% endif -%} {%- set ns_items.found_first = true -%} {%- if item_key == 'properties' -%} properties:{ {%- if item_value is mapping -%} {{- format_parameters(item_value, value['items']['required'] | default([])) -}} {%- endif -%} } {%- elif item_key == 'required' -%} required:[ {%- for req_item in item_value -%} <|"|>{{- req_item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- elif item_key == 'type' -%} {%- if item_value is string -%} type:{{ format_argument(item_value | upper) }} {%- else -%} type:{{ format_argument(item_value | map('upper') | list) }} {%- endif -%} {%- else -%} {{ item_key }}:{{ format_argument(item_value) }} {%- endif -%} {%- endif -%} {%- endfor -%} } {%- endif -%} {%- endif -%} {%- if value['nullable'] %} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} nullable:true {%- endif -%} {%- if value['type'] | upper == 'OBJECT' -%} {%- if value['properties'] is defined and value['properties'] is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value['properties'], value['required'] | default([])) -}} } {%- elif value is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}} } {%- endif -%} {%- if value['required'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} required:[ {%- for item in value['required'] | default([]) -%} <|"|>{{- item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- endif -%} {%- endif -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} type:<|"|>{{ value['type'] | upper }}<|"|>} {%- endif -%} {%- endfor -%}{%- endmacro -%}{%- macro format_function_declaration(tool_data) -%} declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|> {%- set params = tool_data['function']['parameters'] -%} {%- if params -%} ,parameters:{ {%- if params['properties'] -%} properties:{ {{- format_parameters(params['properties'], params['required']) -}} }, {%- endif -%} {%- if params['required'] -%} required:[ {%- for item in params['required'] -%} <|"|>{{- item -}}<|"|> {{- ',' if not loop.last -}} {%- endfor -%} ], {%- endif -%} {%- if params['type'] -%} type:<|"|>{{- params['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} {%- if 'response' in tool_data['function'] -%} {%- set response_declaration = tool_data['function']['response'] -%} ,response:{ {%- if response_declaration['description'] -%} description:<|"|>{{- response_declaration['description'] -}}<|"|>, {%- endif -%} {%- if response_declaration['type'] | upper == 'OBJECT' -%} type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} }{%- endmacro -%}{%- macro format_argument(argument, escape_keys=True) -%} {%- if argument is none -%} {{- 'null' -}} {%- elif argument is string -%} {{- '<|"|>' + argument + '<|"|>' -}} {%- elif argument is boolean -%} {{- 'true' if argument else 'false' -}} {%- elif argument is mapping -%} {{- '{' -}} {%- set ns = namespace(found_first=false) -%} {%- for key, value in argument | dictsort -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {%- if escape_keys -%} {{- '<|"|>' + key + '<|"|>' -}} {%- else -%} {{- key -}} {%- endif -%} :{{- format_argument(value, escape_keys=escape_keys) -}} {%- endfor -%} {{- '}' -}} {%- elif argument is sequence -%} {{- '[' -}} {%- for item in argument -%} {{- format_argument(item, escape_keys=escape_keys) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- ']' -}} {%- else -%} {{- argument -}} {%- endif -%}{%- endmacro -%}{%- macro strip_thinking(text) -%} {%- set ns = namespace(result='') -%} {%- for part in text.split('<channel|>') -%} {%- if '<|channel>' in part -%} {%- set ns.result = ns.result + part.split('<|channel>')[0] -%} {%- else -%} {%- set ns.result = ns.result + part -%} {%- endif -%} {%- endfor -%} {{- ns.result | trim -}}{%- endmacro -%}
{%- macro format_tool_response_block(tool_name, response) -%} {{- '<|tool_response>' -}} {%- if response is mapping -%} {{- 'response:' + tool_name + '{' -}} {%- for key, value in response | dictsort -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- '}' -}} {%- else -%} {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}} {%- endif -%} {{- '<tool_response|>' -}}{%- endmacro -%}
{#- ===== SETUP ===== -#}{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}{%- set loop_messages = messages -%}{%- set enable_thinking = enable_thinking | default(false) -%}{%- set preserve_thinking = preserve_thinking | default(false) -%}{{- bos_token -}}{#- Handle System/Tool Definitions Block -#}{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%} {{- '<|turn>system' -}} {#- Inject Thinking token at the very top of the FIRST system turn -#} {%- if enable_thinking -%} {{- '<|think|>' -}} {%- set ns.prev_message_type = 'think' -%} {%- endif -%} {%- if messages and messages[0]['role'] in ['system', 'developer'] -%} {%- if messages[0]['content'] is string -%} {{- messages[0]['content'] | trim -}} {%- elif messages[0]['content'] is sequence -%} {%- for item in messages[0]['content'] -%} {{- item['text'] | trim + ' '-}} {%- endfor -%} {%- endif -%} {%- set loop_messages = messages[1:] -%} {%- endif -%} {%- if tools -%} {%- for tool in tools %} {{- '<|tool>' -}} {{- format_function_declaration(tool) | trim -}} {{- '<tool|>' -}} {%- endfor %} {%- set ns.prev_message_type = 'tool' -%} {%- endif -%} {{- '<turn|>' -}}{%- endif %}
{#- Pre-scan: find last user message index for reasoning guard -#}{%- set ns_turn = namespace(last_user_idx=-1) -%}{%- for i in range(loop_messages | length) -%} {%- if loop_messages[i]['role'] == 'user' -%} {%- set ns_turn.last_user_idx = i -%} {%- endif -%}{%- endfor -%}
{#- Loop through messages -#}{%- for message in loop_messages -%} {%- if message['role'] != 'tool' -%} {%- set ns.prev_message_type = None -%} {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%} {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#} {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%} {%- if not continue_same_model_turn -%} {{- '<|turn>' + role + '' }}
{%- endif -%}
{#- Render reasoning/reasoning_content as thinking channel -#} {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%} {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%} {%- if thinking_text and thinking_gate -%} {{- '<|channel>thought' + thinking_text + '<channel|>' -}} {%- elif message['role'] == 'assistant' and loop.last -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%}
{%- if message.get('tool_calls') -%} {%- for tool_call in message.get('tool_calls') -%} {%- set function = tool_call['function'] -%} {{- '<|tool_call>call:' + function['name'] + '{' -}} {%- if function['arguments'] is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in function['arguments'] | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- elif function['arguments'] is none -%} {%- else -%} {{- raise_exception( "chat_template: tool_calls[].function.arguments must be a " "JSON object (mapping), not a string. Deserialize arguments " "before passing to the template." ) -}} {%- endif -%} {{- '}<tool_call|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_call' -%} {%- endif -%}
{%- set ns_tr_out = namespace(flag=false) -%} {%- if message.get('tool_responses') -%} {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#} {%- for tool_response in message.get('tool_responses') -%} {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endfor -%} {%- elif message.get('tool_calls') -%} {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#} {%- set ns_tool_scan = namespace(stopped=false) -%} {%- for k in range(loop.index0 + 1, loop_messages | length) -%} {%- if ns_tool_scan.stopped -%} {%- elif loop_messages[k]['role'] != 'tool' -%} {%- set ns_tool_scan.stopped = true -%} {%- else -%} {%- set follow = loop_messages[k] -%} {#- Resolve tool_call_id to function name -#} {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%} {%- for tc in message.get('tool_calls') -%} {%- if tc.get('id') == follow.get('tool_call_id') -%} {%- set ns_tname.name = tc['function']['name'] -%} {%- endif -%} {%- endfor -%} {#- Handle content as string or content-parts array -#} {%- set tool_body = follow.get('content') -%} {%- if tool_body is string -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- elif tool_body is sequence and tool_body is not string -%} {%- set ns_txt = namespace(s='') -%} {%- for part in tool_body -%} {%- if part.get('type') == 'text' -%} {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%} {%- endif -%} {%- endfor -%} {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}} {%- for part in tool_body -%} {%- if part.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif part.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif part.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- else -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- endif -%} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endif -%} {%- endfor -%} {%- endif -%}
{%- set captured_content -%} {%- if message.get('content') is string -%} {%- if role == 'model' -%} {{- strip_thinking(message['content']) -}} {%- else -%} {{- message['content'] | trim -}} {%- endif -%} {%- elif message.get('content') is sequence -%} {%- for item in message['content'] -%} {%- if item.get('type') == 'text' -%} {%- if role == 'model' -%} {{- strip_thinking(item['text']) -}} {%- else -%} {{- item['text'] | trim -}} {%- endif -%} {%- elif item.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif item.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif item.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endset -%}
{{- captured_content -}} {%- set has_content = captured_content | trim | length > 0 -%}
{#- Forward-scan: find next non-tool message role for continuation detection -#} {%- set next_nt = namespace(role=None, found=false) -%} {%- for j in range(loop.index0 + 1, loop_messages | length) -%} {%- if not next_nt.found -%} {%- if loop_messages[j]['role'] != 'tool' -%} {%- set next_nt.role = loop_messages[j]['role'] -%} {%- set next_nt.found = true -%} {%- endif -%} {%- endif -%} {%- endfor -%}
{%- set continues_into_next = ( role == 'model' and next_nt.role == 'assistant' and (not message.get('tool_calls') or ns_tr_out.flag) ) -%}
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%} {{- '<|tool_response>' -}} {%- elif continues_into_next -%} {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%} {{- '<turn|>' -}} {%- endif -%}
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#} {%- set ns.prev_non_tool_role = message['role'] -%} {%- endif -%}{%- endfor -%}
{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%} {{- '<|turn>model' -}} {%- if not enable_thinking -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%} {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%} {{- '<|channel>thought' -}} {%- endif -%}{%- endif -%}123version https://git-lfs.github.com/spec/v1oid sha256:58e70a05abc4c584eb70284e7b6990b11d9d0aec945a3dd8510bb207bbd26cf8size 500847699123version https://git-lfs.github.com/spec/v1oid sha256:41eed5338f7bc423e26fbb59583b5cf33ade378b38c92d83214eeb0f5c402b25size 14581123version https://git-lfs.github.com/spec/v1oid sha256:3285a3138456da9ec26376d3b3bbc79b70fc7f617e5a0abbad7597e107816d98size 2545123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|image>", "bos_token": "<bos>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eos_token": "<eos>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "extra_special_tokens": [ "<|video|>" ], "image_token": "<|image|>", "is_local": false, "local_files_only": false, "mask_token": "<mask>", "model_max_length": 1000000000000000019884624838656, "model_specific_special_tokens": { "audio_token": "<|audio|>", "boa_token": "<|audio>", "boi_token": "<|image>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "image_token": "<|image|>", "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>" }, "pad_token": "<pad>", "padding_side": "left", "processor_class": "Gemma4Processor", "response_schema": { "properties": { "content": { "type": "string" }, "role": { "const": "assistant" }, "thinking": { "type": "string" }, "tool_calls": { "items": { "properties": { "function": { "properties": { "arguments": { "additionalProperties": {}, "type": "object", "x-parser": "gemma4-tool-call" }, "name": { "type": "string" } }, "type": "object", "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" }, "type": { "const": "function" } }, "type": "object" }, "type": "array", "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" } }, "type": "object", "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" }, "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": [ "<turn|>", "<|tool_response>", "<eos>" ], "content": "text" }, "thinking": { "close": "<channel|>", "content": "text", "open": "<|channel>thought\n" }, "tool_calls": { "close": "<tool_call|>", "content": "json", "content_args": { "string_delims": [ [ "<|\"|>", "<|\"|>" ] ], "unquoted_keys": true }, "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)", "repeats": true, "transform": { "function": { "arguments": "{content}", "name": "{name}" }, "type": "function" } } }, "start_anchor": [ "<|turn>model\n", "<tool_response|>" ] }, "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>", "tokenizer_class": "GemmaTokenizer", "unk_token": "<unk>"}123version https://git-lfs.github.com/spec/v1oid sha256:6a570e872d935ba3f72652a178ab568e278c971706fd60b0be421ed73b511e20size 5777123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208---base_model: google/gemma-4-31B-itlibrary_name: pefttags:- base_model:adapter:google/gemma-4-31B-it- lora- sft- transformers- trl---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** [More Information Needed]- **Funded by [optional]:** [More Information Needed]- **Shared by [optional]:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]
### Model Sources [optional]
<!-- Provide the basic links for the model. -->
- **Repository:** [More Information Needed]- **Paper [optional]:** [More Information Needed]- **Demo [optional]:** [More Information Needed]
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
[More Information Needed]
### Downstream Use [optional]
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
[More Information Needed]
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
[More Information Needed]
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
[More Information Needed]
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
## How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
[More Information Needed]
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Preprocessing [optional]
[More Information Needed]
#### Training Hyperparameters
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
#### Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
#### Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
[More Information Needed]
### Results
[More Information Needed]
#### Summary
## Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
[More Information Needed]
## Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]
## Technical Specifications [optional]
### Model Architecture and Objective
[More Information Needed]
### Compute Infrastructure
[More Information Needed]
#### Hardware
[More Information Needed]
#### Software
[More Information Needed]
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
**BibTeX:**
[More Information Needed]
**APA:**
[More Information Needed]
## Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
[More Information Needed]
## More Information [optional]
[More Information Needed]
## Model Card Authors [optional]
[More Information Needed]
## Model Card Contact
[More Information Needed]### Framework versions
- PEFT 0.21.312345678910111213141516171819202122232425262728293031323334353637383940414243444546{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4" }, "base_model_name_or_path": "google/gemma-4-31B-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "kasa_config": null, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 1448, "lora_bias": false, "lora_dropout": 0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "monteclora_config": null, "peft_type": "LORA", "peft_version": "0.21.3", "qalora_group_size": 16, "r": 32, "rank_pattern": {}, "revision": null, "target_modules": ".*\\.language_model.*\\.(q_proj|k_proj|v_proj|gate_proj|up_proj|down_proj|o_proj)", "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false, "velora_config": null}123version https://git-lfs.github.com/spec/v1oid sha256:964a66e6ee8255ac0554ce03cc31d5cbe4543953946e8b77d75f593d47c39753size 979558760123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403{# Template: Google Gemma 4 Canonical Chat Template Author: Google Gemma Engineering Team Published: 2026-07-09 Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.#}{%- macro format_parameters(properties, required, filter_keys=false) -%} {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%} {%- set ns = namespace(found_first=false) -%} {%- for key, value in properties | dictsort -%} {%- set add_comma = false -%} {%- if not filter_keys or key not in standard_keys -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {{ key }}:{ {%- if value['description'] -%} description:<|"|>{{ value['description'] }}<|"|> {%- set add_comma = true -%} {%- endif -%} {%- if value['type'] | upper == 'STRING' -%} {%- if value['enum'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} enum:{{ format_argument(value['enum']) }} {%- endif -%} {%- elif value['type'] | upper == 'ARRAY' -%} {%- if value['items'] is mapping and value['items'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} items:{ {%- set ns_items = namespace(found_first=false) -%} {%- for item_key, item_value in value['items'] | dictsort -%} {%- if item_value is not none -%} {%- if ns_items.found_first %},{% endif -%} {%- set ns_items.found_first = true -%} {%- if item_key == 'properties' -%} properties:{ {%- if item_value is mapping -%} {{- format_parameters(item_value, value['items']['required'] | default([])) -}} {%- endif -%} } {%- elif item_key == 'required' -%} required:[ {%- for req_item in item_value -%} <|"|>{{- req_item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- elif item_key == 'type' -%} {%- if item_value is string -%} type:{{ format_argument(item_value | upper) }} {%- else -%} type:{{ format_argument(item_value | map('upper') | list) }} {%- endif -%} {%- else -%} {{ item_key }}:{{ format_argument(item_value) }} {%- endif -%} {%- endif -%} {%- endfor -%} } {%- endif -%} {%- endif -%} {%- if value['nullable'] %} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} nullable:true {%- endif -%} {%- if value['type'] | upper == 'OBJECT' -%} {%- if value['properties'] is defined and value['properties'] is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value['properties'], value['required'] | default([])) -}} } {%- elif value is mapping -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} properties:{ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}} } {%- endif -%} {%- if value['required'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} required:[ {%- for item in value['required'] | default([]) -%} <|"|>{{- item -}}<|"|> {%- if not loop.last %},{% endif -%} {%- endfor -%} ] {%- endif -%} {%- endif -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} type:<|"|>{{ value['type'] | upper }}<|"|>} {%- endif -%} {%- endfor -%}{%- endmacro -%}{%- macro format_function_declaration(tool_data) -%} declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|> {%- set params = tool_data['function']['parameters'] -%} {%- if params -%} ,parameters:{ {%- if params['properties'] -%} properties:{ {{- format_parameters(params['properties'], params['required']) -}} }, {%- endif -%} {%- if params['required'] -%} required:[ {%- for item in params['required'] -%} <|"|>{{- item -}}<|"|> {{- ',' if not loop.last -}} {%- endfor -%} ], {%- endif -%} {%- if params['type'] -%} type:<|"|>{{- params['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} {%- if 'response' in tool_data['function'] -%} {%- set response_declaration = tool_data['function']['response'] -%} ,response:{ {%- if response_declaration['description'] -%} description:<|"|>{{- response_declaration['description'] -}}<|"|>, {%- endif -%} {%- if response_declaration['type'] | upper == 'OBJECT' -%} type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} }{%- endmacro -%}{%- macro format_argument(argument, escape_keys=True) -%} {%- if argument is none -%} {{- 'null' -}} {%- elif argument is string -%} {{- '<|"|>' + argument + '<|"|>' -}} {%- elif argument is boolean -%} {{- 'true' if argument else 'false' -}} {%- elif argument is mapping -%} {{- '{' -}} {%- set ns = namespace(found_first=false) -%} {%- for key, value in argument | dictsort -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {%- if escape_keys -%} {{- '<|"|>' + key + '<|"|>' -}} {%- else -%} {{- key -}} {%- endif -%} :{{- format_argument(value, escape_keys=escape_keys) -}} {%- endfor -%} {{- '}' -}} {%- elif argument is sequence -%} {{- '[' -}} {%- for item in argument -%} {{- format_argument(item, escape_keys=escape_keys) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- ']' -}} {%- else -%} {{- argument -}} {%- endif -%}{%- endmacro -%}{%- macro strip_thinking(text) -%} {%- set ns = namespace(result='') -%} {%- for part in text.split('<channel|>') -%} {%- if '<|channel>' in part -%} {%- set ns.result = ns.result + part.split('<|channel>')[0] -%} {%- else -%} {%- set ns.result = ns.result + part -%} {%- endif -%} {%- endfor -%} {{- ns.result | trim -}}{%- endmacro -%}
{%- macro format_tool_response_block(tool_name, response) -%} {{- '<|tool_response>' -}} {%- if response is mapping -%} {{- 'response:' + tool_name + '{' -}} {%- for key, value in response | dictsort -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- '}' -}} {%- else -%} {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}} {%- endif -%} {{- '<tool_response|>' -}}{%- endmacro -%}
{#- ===== SETUP ===== -#}{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}{%- set loop_messages = messages -%}{%- set enable_thinking = enable_thinking | default(false) -%}{%- set preserve_thinking = preserve_thinking | default(false) -%}{{- bos_token -}}{#- Handle System/Tool Definitions Block -#}{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%} {{- '<|turn>system' -}} {#- Inject Thinking token at the very top of the FIRST system turn -#} {%- if enable_thinking -%} {{- '<|think|>' -}} {%- set ns.prev_message_type = 'think' -%} {%- endif -%} {%- if messages and messages[0]['role'] in ['system', 'developer'] -%} {%- if messages[0]['content'] is string -%} {{- messages[0]['content'] | trim -}} {%- elif messages[0]['content'] is sequence -%} {%- for item in messages[0]['content'] -%} {{- item['text'] | trim + ' '-}} {%- endfor -%} {%- endif -%} {%- set loop_messages = messages[1:] -%} {%- endif -%} {%- if tools -%} {%- for tool in tools %} {{- '<|tool>' -}} {{- format_function_declaration(tool) | trim -}} {{- '<tool|>' -}} {%- endfor %} {%- set ns.prev_message_type = 'tool' -%} {%- endif -%} {{- '<turn|>' -}}{%- endif %}
{#- Pre-scan: find last user message index for reasoning guard -#}{%- set ns_turn = namespace(last_user_idx=-1) -%}{%- for i in range(loop_messages | length) -%} {%- if loop_messages[i]['role'] == 'user' -%} {%- set ns_turn.last_user_idx = i -%} {%- endif -%}{%- endfor -%}
{#- Loop through messages -#}{%- for message in loop_messages -%} {%- if message['role'] != 'tool' -%} {%- set ns.prev_message_type = None -%} {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%} {#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#} {%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%} {%- if not continue_same_model_turn -%} {{- '<|turn>' + role + '' }}
{%- endif -%}
{#- Render reasoning/reasoning_content as thinking channel -#} {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%} {%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%} {%- if thinking_text and thinking_gate -%} {{- '<|channel>thought' + thinking_text + '<channel|>' -}} {%- elif message['role'] == 'assistant' and loop.last -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%}
{%- if message.get('tool_calls') -%} {%- for tool_call in message.get('tool_calls') -%} {%- set function = tool_call['function'] -%} {{- '<|tool_call>call:' + function['name'] + '{' -}} {%- if function['arguments'] is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in function['arguments'] | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- elif function['arguments'] is none -%} {%- else -%} {{- raise_exception( "chat_template: tool_calls[].function.arguments must be a " "JSON object (mapping), not a string. Deserialize arguments " "before passing to the template." ) -}} {%- endif -%} {{- '}<tool_call|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_call' -%} {%- endif -%}
{%- set ns_tr_out = namespace(flag=false) -%} {%- if message.get('tool_responses') -%} {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#} {%- for tool_response in message.get('tool_responses') -%} {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endfor -%} {%- elif message.get('tool_calls') -%} {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#} {%- set ns_tool_scan = namespace(stopped=false) -%} {%- for k in range(loop.index0 + 1, loop_messages | length) -%} {%- if ns_tool_scan.stopped -%} {%- elif loop_messages[k]['role'] != 'tool' -%} {%- set ns_tool_scan.stopped = true -%} {%- else -%} {%- set follow = loop_messages[k] -%} {#- Resolve tool_call_id to function name -#} {%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%} {%- for tc in message.get('tool_calls') -%} {%- if tc.get('id') == follow.get('tool_call_id') -%} {%- set ns_tname.name = tc['function']['name'] -%} {%- endif -%} {%- endfor -%} {#- Handle content as string or content-parts array -#} {%- set tool_body = follow.get('content') -%} {%- if tool_body is string -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- elif tool_body is sequence and tool_body is not string -%} {%- set ns_txt = namespace(s='') -%} {%- for part in tool_body -%} {%- if part.get('type') == 'text' -%} {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%} {%- endif -%} {%- endfor -%} {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}} {%- for part in tool_body -%} {%- if part.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif part.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif part.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- else -%} {{- format_tool_response_block(ns_tname.name, tool_body) -}} {%- endif -%} {%- set ns_tr_out.flag = true -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- endif -%} {%- endfor -%} {%- endif -%}
{%- set captured_content -%} {%- if message.get('content') is string -%} {%- if role == 'model' -%} {{- strip_thinking(message['content']) -}} {%- else -%} {{- message['content'] | trim -}} {%- endif -%} {%- elif message.get('content') is sequence -%} {%- for item in message['content'] -%} {%- if item.get('type') == 'text' -%} {%- if role == 'model' -%} {{- strip_thinking(item['text']) -}} {%- else -%} {{- item['text'] | trim -}} {%- endif -%} {%- elif item.get('type') in ['image', 'image_url'] -%} {{- '<|image|>' -}} {%- elif item.get('type') in ['audio', 'input_audio'] -%} {{- '<|audio|>' -}} {%- elif item.get('type') == 'video' -%} {{- '<|video|>' -}} {%- endif -%} {%- endfor -%} {%- endif -%} {%- endset -%}
{{- captured_content -}} {%- set has_content = captured_content | trim | length > 0 -%}
{#- Forward-scan: find next non-tool message role for continuation detection -#} {%- set next_nt = namespace(role=None, found=false) -%} {%- for j in range(loop.index0 + 1, loop_messages | length) -%} {%- if not next_nt.found -%} {%- if loop_messages[j]['role'] != 'tool' -%} {%- set next_nt.role = loop_messages[j]['role'] -%} {%- set next_nt.found = true -%} {%- endif -%} {%- endif -%} {%- endfor -%}
{%- set continues_into_next = ( role == 'model' and next_nt.role == 'assistant' and (not message.get('tool_calls') or ns_tr_out.flag) ) -%}
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%} {{- '<|tool_response>' -}} {%- elif continues_into_next -%} {%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%} {{- '<turn|>' -}} {%- endif -%}
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#} {%- set ns.prev_non_tool_role = message['role'] -%} {%- endif -%}{%- endfor -%}
{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%} {{- '<|turn>model' -}} {%- if not enable_thinking -%} {{- '<|channel>thought<channel|>' -}} {%- endif -%} {%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%} {{- '<|channel>thought' -}} {%- endif -%}{%- endif -%}123version https://git-lfs.github.com/spec/v1oid sha256:f1235f90bf79518497763f4a6ff42473f591b6bdd7c90d7e5bf0beaccafc15b8size 500847699123version https://git-lfs.github.com/spec/v1oid sha256:8c4cac45edf53bfa1c2bd1e20676431ab36f865170c0e904a1bd0451f8f31ea1size 14581123version https://git-lfs.github.com/spec/v1oid sha256:89b199f6538bebbb48068c2a60eae527731acdc8af3ac039d6be3daaf3961a7esize 2545123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|image>", "bos_token": "<bos>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eos_token": "<eos>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "extra_special_tokens": [ "<|video|>" ], "image_token": "<|image|>", "is_local": false, "local_files_only": false, "mask_token": "<mask>", "model_max_length": 1000000000000000019884624838656, "model_specific_special_tokens": { "audio_token": "<|audio|>", "boa_token": "<|audio>", "boi_token": "<|image>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "image_token": "<|image|>", "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>" }, "pad_token": "<pad>", "padding_side": "left", "processor_class": "Gemma4Processor", "response_schema": { "properties": { "content": { "type": "string" }, "role": { "const": "assistant" }, "thinking": { "type": "string" }, "tool_calls": { "items": { "properties": { "function": { "properties": { "arguments": { "additionalProperties": {}, "type": "object", "x-parser": "gemma4-tool-call" }, "name": { "type": "string" } }, "type": "object", "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" }, "type": { "const": "function" } }, "type": "object" }, "type": "array", "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" } }, "type": "object", "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" }, "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": [ "<turn|>", "<|tool_response>", "<eos>" ], "content": "text" }, "thinking": { "close": "<channel|>", "content": "text", "open": "<|channel>thought\n" }, "tool_calls": { "close": "<tool_call|>", "content": "json", "content_args": { "string_delims": [ [ "<|\"|>", "<|\"|>" ] ], "unquoted_keys": true }, "open_pattern": "<\\|tool_call>call:(?P<name>\\w+)", "repeats": true, "transform": { "function": { "arguments": "{content}", "name": "{name}" }, "type": "function" } } }, "start_anchor": [ "<|turn>model\n", "<tool_response|>" ] }, "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>", "tokenizer_class": "GemmaTokenizer", "unk_token": "<unk>"}.gitattributes+6
README.mdAdded+58
Writer-SFT/README.mdAdded+208
Writer-SFT/adapter_config.jsonAdded+46
Writer-SFT/adapter_model.safetensorsAdded+3
Writer-SFT/chat_template.jinjaAdded+390
Writer-SFT/tokenizer.jsonAdded+3
Writer-SFT/tokenizer_config.jsonAdded+142
checkpoint-168/README.mdAdded+208
checkpoint-168/adapter_config.jsonAdded+46
checkpoint-168/adapter_model.safetensorsAdded+3
checkpoint-168/chat_template.jinjaAdded+403
checkpoint-168/optimizer.ptAdded+3
checkpoint-168/rng_state.pthAdded+3
checkpoint-168/scheduler.ptAdded+3
checkpoint-168/tokenizer.jsonAdded+3
checkpoint-168/tokenizer_config.jsonAdded+142
checkpoint-168/trainer_state.jsonAdded+1882
checkpoint-168/training_args.binAdded+3
checkpoint-336/README.mdAdded+208
checkpoint-336/adapter_config.jsonAdded+46
checkpoint-336/adapter_model.safetensorsAdded+3
checkpoint-336/chat_template.jinjaAdded+403
checkpoint-336/optimizer.ptAdded+3
checkpoint-336/rng_state.pthAdded+3
checkpoint-336/scheduler.ptAdded+3
checkpoint-336/tokenizer.jsonAdded+3
checkpoint-336/tokenizer_config.jsonAdded+142
checkpoint-336/trainer_state.jsonAdded
checkpoint-336/training_args.binAdded+3
checkpoint-504/README.mdAdded+208
checkpoint-504/adapter_config.jsonAdded+46
checkpoint-504/adapter_model.safetensorsAdded+3
checkpoint-504/chat_template.jinjaAdded+403
checkpoint-504/optimizer.ptAdded+3
checkpoint-504/rng_state.pthAdded+3
checkpoint-504/scheduler.ptAdded+3
checkpoint-504/tokenizer.jsonAdded+3
checkpoint-504/tokenizer_config.jsonAdded+142
checkpoint-504/trainer_state.jsonAdded
checkpoint-504/training_args.binAdded+3
checkpoint-672/README.mdAdded+208
checkpoint-672/adapter_config.jsonAdded+46
checkpoint-672/adapter_model.safetensorsAdded+3
checkpoint-672/chat_template.jinjaAdded+403
checkpoint-672/optimizer.ptAdded+3
checkpoint-672/rng_state.pthAdded+3
checkpoint-672/scheduler.ptAdded+3
checkpoint-672/tokenizer.jsonAdded+3
checkpoint-672/tokenizer_config.jsonAdded+142