Instructions to use MinatoKun/gemma4-e2b-insurance with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MinatoKun/gemma4-e2b-insurance with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="MinatoKun/gemma4-e2b-insurance") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("MinatoKun/gemma4-e2b-insurance") model = AutoModelForMultimodalLM.from_pretrained("MinatoKun/gemma4-e2b-insurance", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MinatoKun/gemma4-e2b-insurance with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MinatoKun/gemma4-e2b-insurance" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinatoKun/gemma4-e2b-insurance", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/MinatoKun/gemma4-e2b-insurance
- SGLang
How to use MinatoKun/gemma4-e2b-insurance with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MinatoKun/gemma4-e2b-insurance" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinatoKun/gemma4-e2b-insurance", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MinatoKun/gemma4-e2b-insurance" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinatoKun/gemma4-e2b-insurance", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use MinatoKun/gemma4-e2b-insurance with Docker Model Runner:
docker model run hf.co/MinatoKun/gemma4-e2b-insurance
Training in progress, step 250, checkpoint
Browse files- checkpoint-250/README.md +209 -0
- checkpoint-250/adapter_config.json +54 -0
- checkpoint-250/adapter_model.safetensors +3 -0
- checkpoint-250/chat_template.jinja +386 -0
- checkpoint-250/optimizer.pt +3 -0
- checkpoint-250/rng_state.pth +3 -0
- checkpoint-250/scheduler.pt +3 -0
- checkpoint-250/tokenizer.json +3 -0
- checkpoint-250/tokenizer_config.json +142 -0
- checkpoint-250/trainer_state.json +339 -0
- checkpoint-250/training_args.bin +3 -0
checkpoint-250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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: google/gemma-4-E2B-it
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:google/gemma-4-E2B-it
|
| 7 |
+
- lora
|
| 8 |
+
- sft
|
| 9 |
+
- transformers
|
| 10 |
+
- trl
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Model Card for Model ID
|
| 14 |
+
|
| 15 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
## Model Details
|
| 20 |
+
|
| 21 |
+
### Model Description
|
| 22 |
+
|
| 23 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
- **Developed by:** [More Information Needed]
|
| 28 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 29 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 30 |
+
- **Model type:** [More Information Needed]
|
| 31 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 32 |
+
- **License:** [More Information Needed]
|
| 33 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 34 |
+
|
| 35 |
+
### Model Sources [optional]
|
| 36 |
+
|
| 37 |
+
<!-- Provide the basic links for the model. -->
|
| 38 |
+
|
| 39 |
+
- **Repository:** [More Information Needed]
|
| 40 |
+
- **Paper [optional]:** [More Information Needed]
|
| 41 |
+
- **Demo [optional]:** [More Information Needed]
|
| 42 |
+
|
| 43 |
+
## Uses
|
| 44 |
+
|
| 45 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 46 |
+
|
| 47 |
+
### Direct Use
|
| 48 |
+
|
| 49 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 50 |
+
|
| 51 |
+
[More Information Needed]
|
| 52 |
+
|
| 53 |
+
### Downstream Use [optional]
|
| 54 |
+
|
| 55 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 56 |
+
|
| 57 |
+
[More Information Needed]
|
| 58 |
+
|
| 59 |
+
### Out-of-Scope Use
|
| 60 |
+
|
| 61 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 62 |
+
|
| 63 |
+
[More Information Needed]
|
| 64 |
+
|
| 65 |
+
## Bias, Risks, and Limitations
|
| 66 |
+
|
| 67 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 68 |
+
|
| 69 |
+
[More Information Needed]
|
| 70 |
+
|
| 71 |
+
### Recommendations
|
| 72 |
+
|
| 73 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 74 |
+
|
| 75 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 76 |
+
|
| 77 |
+
## How to Get Started with the Model
|
| 78 |
+
|
| 79 |
+
Use the code below to get started with the model.
|
| 80 |
+
|
| 81 |
+
[More Information Needed]
|
| 82 |
+
|
| 83 |
+
## Training Details
|
| 84 |
+
|
| 85 |
+
### Training Data
|
| 86 |
+
|
| 87 |
+
<!-- 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. -->
|
| 88 |
+
|
| 89 |
+
[More Information Needed]
|
| 90 |
+
|
| 91 |
+
### Training Procedure
|
| 92 |
+
|
| 93 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 94 |
+
|
| 95 |
+
#### Preprocessing [optional]
|
| 96 |
+
|
| 97 |
+
[More Information Needed]
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
#### Training Hyperparameters
|
| 101 |
+
|
| 102 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 103 |
+
|
| 104 |
+
#### Speeds, Sizes, Times [optional]
|
| 105 |
+
|
| 106 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 107 |
+
|
| 108 |
+
[More Information Needed]
|
| 109 |
+
|
| 110 |
+
## Evaluation
|
| 111 |
+
|
| 112 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 113 |
+
|
| 114 |
+
### Testing Data, Factors & Metrics
|
| 115 |
+
|
| 116 |
+
#### Testing Data
|
| 117 |
+
|
| 118 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 119 |
+
|
| 120 |
+
[More Information Needed]
|
| 121 |
+
|
| 122 |
+
#### Factors
|
| 123 |
+
|
| 124 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 125 |
+
|
| 126 |
+
[More Information Needed]
|
| 127 |
+
|
| 128 |
+
#### Metrics
|
| 129 |
+
|
| 130 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 131 |
+
|
| 132 |
+
[More Information Needed]
|
| 133 |
+
|
| 134 |
+
### Results
|
| 135 |
+
|
| 136 |
+
[More Information Needed]
|
| 137 |
+
|
| 138 |
+
#### Summary
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
## Model Examination [optional]
|
| 143 |
+
|
| 144 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 145 |
+
|
| 146 |
+
[More Information Needed]
|
| 147 |
+
|
| 148 |
+
## Environmental Impact
|
| 149 |
+
|
| 150 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 151 |
+
|
| 152 |
+
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).
|
| 153 |
+
|
| 154 |
+
- **Hardware Type:** [More Information Needed]
|
| 155 |
+
- **Hours used:** [More Information Needed]
|
| 156 |
+
- **Cloud Provider:** [More Information Needed]
|
| 157 |
+
- **Compute Region:** [More Information Needed]
|
| 158 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 159 |
+
|
| 160 |
+
## Technical Specifications [optional]
|
| 161 |
+
|
| 162 |
+
### Model Architecture and Objective
|
| 163 |
+
|
| 164 |
+
[More Information Needed]
|
| 165 |
+
|
| 166 |
+
### Compute Infrastructure
|
| 167 |
+
|
| 168 |
+
[More Information Needed]
|
| 169 |
+
|
| 170 |
+
#### Hardware
|
| 171 |
+
|
| 172 |
+
[More Information Needed]
|
| 173 |
+
|
| 174 |
+
#### Software
|
| 175 |
+
|
| 176 |
+
[More Information Needed]
|
| 177 |
+
|
| 178 |
+
## Citation [optional]
|
| 179 |
+
|
| 180 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 181 |
+
|
| 182 |
+
**BibTeX:**
|
| 183 |
+
|
| 184 |
+
[More Information Needed]
|
| 185 |
+
|
| 186 |
+
**APA:**
|
| 187 |
+
|
| 188 |
+
[More Information Needed]
|
| 189 |
+
|
| 190 |
+
## Glossary [optional]
|
| 191 |
+
|
| 192 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 193 |
+
|
| 194 |
+
[More Information Needed]
|
| 195 |
+
|
| 196 |
+
## More Information [optional]
|
| 197 |
+
|
| 198 |
+
[More Information Needed]
|
| 199 |
+
|
| 200 |
+
## Model Card Authors [optional]
|
| 201 |
+
|
| 202 |
+
[More Information Needed]
|
| 203 |
+
|
| 204 |
+
## Model Card Contact
|
| 205 |
+
|
| 206 |
+
[More Information Needed]
|
| 207 |
+
### Framework versions
|
| 208 |
+
|
| 209 |
+
- PEFT 0.20.0
|
checkpoint-250/adapter_config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "google/gemma-4-E2B-it",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": [
|
| 12 |
+
"vision_tower",
|
| 13 |
+
"audio_tower",
|
| 14 |
+
"multi_modal_projector"
|
| 15 |
+
],
|
| 16 |
+
"fan_in_fan_out": false,
|
| 17 |
+
"inference_mode": true,
|
| 18 |
+
"init_lora_weights": true,
|
| 19 |
+
"layer_replication": null,
|
| 20 |
+
"layers_pattern": null,
|
| 21 |
+
"layers_to_transform": null,
|
| 22 |
+
"loftq_config": {},
|
| 23 |
+
"lora_alpha": 64,
|
| 24 |
+
"lora_bias": false,
|
| 25 |
+
"lora_dropout": 0.05,
|
| 26 |
+
"lora_ga_config": null,
|
| 27 |
+
"megatron_config": null,
|
| 28 |
+
"megatron_core": "megatron.core",
|
| 29 |
+
"modules_to_save": null,
|
| 30 |
+
"monteclora_config": null,
|
| 31 |
+
"peft_type": "LORA",
|
| 32 |
+
"peft_version": "0.20.0",
|
| 33 |
+
"qalora_group_size": 16,
|
| 34 |
+
"r": 32,
|
| 35 |
+
"rank_pattern": {},
|
| 36 |
+
"revision": null,
|
| 37 |
+
"target_modules": [
|
| 38 |
+
"gate_proj",
|
| 39 |
+
"v_proj",
|
| 40 |
+
"k_proj",
|
| 41 |
+
"up_proj",
|
| 42 |
+
"q_proj",
|
| 43 |
+
"o_proj",
|
| 44 |
+
"down_proj"
|
| 45 |
+
],
|
| 46 |
+
"target_parameters": null,
|
| 47 |
+
"task_type": "CAUSAL_LM",
|
| 48 |
+
"trainable_token_indices": null,
|
| 49 |
+
"use_bdlora": null,
|
| 50 |
+
"use_dora": false,
|
| 51 |
+
"use_qalora": false,
|
| 52 |
+
"use_rslora": false,
|
| 53 |
+
"velora_config": null
|
| 54 |
+
}
|
checkpoint-250/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a5cb1c30dd5d8e2d14e7b350581437b326c4e24c0dbf100d47818240fcd2448
|
| 3 |
+
size 119545752
|
checkpoint-250/chat_template.jinja
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
| 1 |
+
{#
|
| 2 |
+
Template: Google Gemma 4 Canonical Chat Template
|
| 3 |
+
Author: Google Gemma Engineering Team
|
| 4 |
+
Published: 2026-07-09
|
| 5 |
+
Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.
|
| 6 |
+
#}
|
| 7 |
+
{%- macro format_parameters(properties, required, filter_keys=false) -%}
|
| 8 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 9 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 10 |
+
{%- for key, value in properties | dictsort -%}
|
| 11 |
+
{%- set add_comma = false -%}
|
| 12 |
+
{%- if not filter_keys or key not in standard_keys -%}
|
| 13 |
+
{%- if ns.found_first %},{% endif -%}
|
| 14 |
+
{%- set ns.found_first = true -%}
|
| 15 |
+
{{ key }}:{
|
| 16 |
+
{%- if value['description'] -%}
|
| 17 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 18 |
+
{%- set add_comma = true -%}
|
| 19 |
+
{%- endif -%}
|
| 20 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 21 |
+
{%- if value['enum'] -%}
|
| 22 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 23 |
+
enum:{{ format_argument(value['enum']) }}
|
| 24 |
+
{%- endif -%}
|
| 25 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 26 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 27 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 28 |
+
items:{
|
| 29 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 30 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 31 |
+
{%- if item_value is not none -%}
|
| 32 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 33 |
+
{%- set ns_items.found_first = true -%}
|
| 34 |
+
{%- if item_key == 'properties' -%}
|
| 35 |
+
properties:{
|
| 36 |
+
{%- if item_value is mapping -%}
|
| 37 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 38 |
+
{%- endif -%}
|
| 39 |
+
}
|
| 40 |
+
{%- elif item_key == 'required' -%}
|
| 41 |
+
required:[
|
| 42 |
+
{%- for req_item in item_value -%}
|
| 43 |
+
<|"|>{{- req_item -}}<|"|>
|
| 44 |
+
{%- if not loop.last %},{% endif -%}
|
| 45 |
+
{%- endfor -%}
|
| 46 |
+
]
|
| 47 |
+
{%- elif item_key == 'type' -%}
|
| 48 |
+
{%- if item_value is string -%}
|
| 49 |
+
type:{{ format_argument(item_value | upper) }}
|
| 50 |
+
{%- else -%}
|
| 51 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 52 |
+
{%- endif -%}
|
| 53 |
+
{%- else -%}
|
| 54 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 55 |
+
{%- endif -%}
|
| 56 |
+
{%- endif -%}
|
| 57 |
+
{%- endfor -%}
|
| 58 |
+
}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{%- endif -%}
|
| 61 |
+
{%- if value['nullable'] %}
|
| 62 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 63 |
+
nullable:true
|
| 64 |
+
{%- endif -%}
|
| 65 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 66 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 67 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 68 |
+
properties:{
|
| 69 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 70 |
+
}
|
| 71 |
+
{%- elif value is mapping -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
properties:{
|
| 74 |
+
{{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
|
| 75 |
+
}
|
| 76 |
+
{%- endif -%}
|
| 77 |
+
{%- if value['required'] -%}
|
| 78 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 79 |
+
required:[
|
| 80 |
+
{%- for item in value['required'] | default([]) -%}
|
| 81 |
+
<|"|>{{- item -}}<|"|>
|
| 82 |
+
{%- if not loop.last %},{% endif -%}
|
| 83 |
+
{%- endfor -%}
|
| 84 |
+
]
|
| 85 |
+
{%- endif -%}
|
| 86 |
+
{%- endif -%}
|
| 87 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 88 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 89 |
+
{%- endif -%}
|
| 90 |
+
{%- endfor -%}
|
| 91 |
+
{%- endmacro -%}
|
| 92 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 93 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 94 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 95 |
+
{%- if params -%}
|
| 96 |
+
,parameters:{
|
| 97 |
+
{%- if params['properties'] -%}
|
| 98 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 99 |
+
{%- endif -%}
|
| 100 |
+
{%- if params['required'] -%}
|
| 101 |
+
required:[
|
| 102 |
+
{%- for item in params['required'] -%}
|
| 103 |
+
<|"|>{{- item -}}<|"|>
|
| 104 |
+
{{- ',' if not loop.last -}}
|
| 105 |
+
{%- endfor -%}
|
| 106 |
+
],
|
| 107 |
+
{%- endif -%}
|
| 108 |
+
{%- if params['type'] -%}
|
| 109 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 110 |
+
{%- endif -%}
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 113 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 114 |
+
,response:{
|
| 115 |
+
{%- if response_declaration['description'] -%}
|
| 116 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 117 |
+
{%- endif -%}
|
| 118 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 119 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 120 |
+
{%- endif -%}
|
| 121 |
+
{%- endif -%}
|
| 122 |
+
}
|
| 123 |
+
{%- endmacro -%}
|
| 124 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 125 |
+
{%- if argument is none -%}
|
| 126 |
+
{{- 'null' -}}
|
| 127 |
+
{%- elif argument is string -%}
|
| 128 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 129 |
+
{%- elif argument is boolean -%}
|
| 130 |
+
{{- 'true' if argument else 'false' -}}
|
| 131 |
+
{%- elif argument is mapping -%}
|
| 132 |
+
{{- '{' -}}
|
| 133 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 134 |
+
{%- for key, value in argument | dictsort -%}
|
| 135 |
+
{%- if ns.found_first %},{% endif -%}
|
| 136 |
+
{%- set ns.found_first = true -%}
|
| 137 |
+
{%- if escape_keys -%}
|
| 138 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 139 |
+
{%- else -%}
|
| 140 |
+
{{- key -}}
|
| 141 |
+
{%- endif -%}
|
| 142 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 143 |
+
{%- endfor -%}
|
| 144 |
+
{{- '}' -}}
|
| 145 |
+
{%- elif argument is sequence -%}
|
| 146 |
+
{{- '[' -}}
|
| 147 |
+
{%- for item in argument -%}
|
| 148 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 149 |
+
{%- if not loop.last %},{% endif -%}
|
| 150 |
+
{%- endfor -%}
|
| 151 |
+
{{- ']' -}}
|
| 152 |
+
{%- else -%}
|
| 153 |
+
{{- argument -}}
|
| 154 |
+
{%- endif -%}
|
| 155 |
+
{%- endmacro -%}
|
| 156 |
+
{%- macro strip_thinking(text) -%}
|
| 157 |
+
{%- set ns = namespace(result='') -%}
|
| 158 |
+
{%- for part in text.split('<channel|>') -%}
|
| 159 |
+
{%- if '<|channel>' in part -%}
|
| 160 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 161 |
+
{%- else -%}
|
| 162 |
+
{%- set ns.result = ns.result + part -%}
|
| 163 |
+
{%- endif -%}
|
| 164 |
+
{%- endfor -%}
|
| 165 |
+
{{- ns.result | trim -}}
|
| 166 |
+
{%- endmacro -%}
|
| 167 |
+
|
| 168 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 169 |
+
{{- '<|tool_response>' -}}
|
| 170 |
+
{%- if response is mapping -%}
|
| 171 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 172 |
+
{%- for key, value in response | dictsort -%}
|
| 173 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 174 |
+
{%- if not loop.last %},{% endif -%}
|
| 175 |
+
{%- endfor -%}
|
| 176 |
+
{{- '}' -}}
|
| 177 |
+
{%- else -%}
|
| 178 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 179 |
+
{%- endif -%}
|
| 180 |
+
{{- '<tool_response|>' -}}
|
| 181 |
+
{%- endmacro -%}
|
| 182 |
+
|
| 183 |
+
{#- ===== SETUP ===== -#}
|
| 184 |
+
{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
|
| 185 |
+
{%- set loop_messages = messages -%}
|
| 186 |
+
{%- set enable_thinking = enable_thinking | default(false) -%}
|
| 187 |
+
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 188 |
+
{{- bos_token -}}
|
| 189 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 190 |
+
{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
|
| 191 |
+
{{- '<|turn>system\n' -}}
|
| 192 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 193 |
+
{%- if enable_thinking -%}
|
| 194 |
+
{{- '<|think|>\n' -}}
|
| 195 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 196 |
+
{%- endif -%}
|
| 197 |
+
{%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
|
| 198 |
+
{%- if messages[0]['content'] is string -%}
|
| 199 |
+
{{- messages[0]['content'] | trim -}}
|
| 200 |
+
{%- elif messages[0]['content'] is sequence -%}
|
| 201 |
+
{%- for item in messages[0]['content'] -%}
|
| 202 |
+
{{- item['text'] | trim + ' '-}}
|
| 203 |
+
{%- endfor -%}
|
| 204 |
+
{%- endif -%}
|
| 205 |
+
{%- set loop_messages = messages[1:] -%}
|
| 206 |
+
{%- endif -%}
|
| 207 |
+
{%- if tools -%}
|
| 208 |
+
{%- for tool in tools %}
|
| 209 |
+
{{- '<|tool>' -}}
|
| 210 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 211 |
+
{{- '<tool|>' -}}
|
| 212 |
+
{%- endfor %}
|
| 213 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 214 |
+
{%- endif -%}
|
| 215 |
+
{{- '<turn|>\n' -}}
|
| 216 |
+
{%- endif %}
|
| 217 |
+
|
| 218 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 219 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 220 |
+
{%- for i in range(loop_messages | length) -%}
|
| 221 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 222 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 223 |
+
{%- endif -%}
|
| 224 |
+
{%- endfor -%}
|
| 225 |
+
|
| 226 |
+
{#- Loop through messages -#}
|
| 227 |
+
{%- for message in loop_messages -%}
|
| 228 |
+
{%- if message['role'] != 'tool' -%}
|
| 229 |
+
{%- set ns.prev_message_type = None -%}
|
| 230 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 231 |
+
{#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
|
| 232 |
+
{%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
|
| 233 |
+
{%- if not continue_same_model_turn -%}
|
| 234 |
+
{{- '<|turn>' + role + '\n' }}
|
| 235 |
+
{%- endif -%}
|
| 236 |
+
|
| 237 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 238 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 239 |
+
{%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
|
| 240 |
+
{%- if thinking_text and thinking_gate -%}
|
| 241 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 242 |
+
{%- endif -%}
|
| 243 |
+
|
| 244 |
+
{%- if message.get('tool_calls') -%}
|
| 245 |
+
{%- for tool_call in message.get('tool_calls') -%}
|
| 246 |
+
{%- set function = tool_call['function'] -%}
|
| 247 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 248 |
+
{%- if function['arguments'] is mapping -%}
|
| 249 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 250 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 251 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 252 |
+
{%- set ns_args.found_first = true -%}
|
| 253 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 254 |
+
{%- endfor -%}
|
| 255 |
+
{%- elif function['arguments'] is none -%}
|
| 256 |
+
{%- else -%}
|
| 257 |
+
{{- raise_exception(
|
| 258 |
+
"chat_template: tool_calls[].function.arguments must be a "
|
| 259 |
+
"JSON object (mapping), not a string. Deserialize arguments "
|
| 260 |
+
"before passing to the template."
|
| 261 |
+
) -}}
|
| 262 |
+
{%- endif -%}
|
| 263 |
+
{{- '}<tool_call|>' -}}
|
| 264 |
+
{%- endfor -%}
|
| 265 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 266 |
+
{%- endif -%}
|
| 267 |
+
|
| 268 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 269 |
+
{%- if message.get('tool_responses') -%}
|
| 270 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 271 |
+
{%- for tool_response in message.get('tool_responses') -%}
|
| 272 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
|
| 273 |
+
{%- set ns_tr_out.flag = true -%}
|
| 274 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 275 |
+
{%- endfor -%}
|
| 276 |
+
{%- elif message.get('tool_calls') -%}
|
| 277 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 278 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 279 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 280 |
+
{%- if ns_tool_scan.stopped -%}
|
| 281 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 282 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 283 |
+
{%- else -%}
|
| 284 |
+
{%- set follow = loop_messages[k] -%}
|
| 285 |
+
{#- Resolve tool_call_id to function name -#}
|
| 286 |
+
{%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
|
| 287 |
+
{%- for tc in message.get('tool_calls') -%}
|
| 288 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 289 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 290 |
+
{%- endif -%}
|
| 291 |
+
{%- endfor -%}
|
| 292 |
+
{#- Handle content as string or content-parts array -#}
|
| 293 |
+
{%- set tool_body = follow.get('content') -%}
|
| 294 |
+
{%- if tool_body is string -%}
|
| 295 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 296 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 297 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 298 |
+
{%- for part in tool_body -%}
|
| 299 |
+
{%- if part.get('type') == 'text' -%}
|
| 300 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 301 |
+
{%- endif -%}
|
| 302 |
+
{%- endfor -%}
|
| 303 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 304 |
+
{%- for part in tool_body -%}
|
| 305 |
+
{%- if part.get('type') in ['image', 'image_url'] -%}
|
| 306 |
+
{{- '<|image|>' -}}
|
| 307 |
+
{%- elif part.get('type') in ['audio', 'input_audio'] -%}
|
| 308 |
+
{{- '<|audio|>' -}}
|
| 309 |
+
{%- elif part.get('type') == 'video' -%}
|
| 310 |
+
{{- '<|video|>' -}}
|
| 311 |
+
{%- endif -%}
|
| 312 |
+
{%- endfor -%}
|
| 313 |
+
{%- else -%}
|
| 314 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 315 |
+
{%- endif -%}
|
| 316 |
+
{%- set ns_tr_out.flag = true -%}
|
| 317 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 318 |
+
{%- endif -%}
|
| 319 |
+
{%- endfor -%}
|
| 320 |
+
{%- endif -%}
|
| 321 |
+
|
| 322 |
+
{%- set captured_content -%}
|
| 323 |
+
{%- if message.get('content') is string -%}
|
| 324 |
+
{%- if role == 'model' -%}
|
| 325 |
+
{{- strip_thinking(message['content']) -}}
|
| 326 |
+
{%- else -%}
|
| 327 |
+
{{- message['content'] | trim -}}
|
| 328 |
+
{%- endif -%}
|
| 329 |
+
{%- elif message.get('content') is sequence -%}
|
| 330 |
+
{%- for item in message['content'] -%}
|
| 331 |
+
{%- if item.get('type') == 'text' -%}
|
| 332 |
+
{%- if role == 'model' -%}
|
| 333 |
+
{{- strip_thinking(item['text']) -}}
|
| 334 |
+
{%- else -%}
|
| 335 |
+
{{- item['text'] | trim -}}
|
| 336 |
+
{%- endif -%}
|
| 337 |
+
{%- elif item.get('type') in ['image', 'image_url'] -%}
|
| 338 |
+
{{- '<|image|>' -}}
|
| 339 |
+
{%- elif item.get('type') in ['audio', 'input_audio'] -%}
|
| 340 |
+
{{- '<|audio|>' -}}
|
| 341 |
+
{%- elif item.get('type') == 'video' -%}
|
| 342 |
+
{{- '<|video|>' -}}
|
| 343 |
+
{%- endif -%}
|
| 344 |
+
{%- endfor -%}
|
| 345 |
+
{%- endif -%}
|
| 346 |
+
{%- endset -%}
|
| 347 |
+
|
| 348 |
+
{{- captured_content -}}
|
| 349 |
+
{%- set has_content = captured_content | trim | length > 0 -%}
|
| 350 |
+
|
| 351 |
+
{#- Forward-scan: find next non-tool message role for continuation detection -#}
|
| 352 |
+
{%- set next_nt = namespace(role=None, found=false) -%}
|
| 353 |
+
{%- for j in range(loop.index0 + 1, loop_messages | length) -%}
|
| 354 |
+
{%- if not next_nt.found -%}
|
| 355 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 356 |
+
{%- set next_nt.role = loop_messages[j]['role'] -%}
|
| 357 |
+
{%- set next_nt.found = true -%}
|
| 358 |
+
{%- endif -%}
|
| 359 |
+
{%- endif -%}
|
| 360 |
+
{%- endfor -%}
|
| 361 |
+
|
| 362 |
+
{%- set continues_into_next = (
|
| 363 |
+
role == 'model'
|
| 364 |
+
and next_nt.role == 'assistant'
|
| 365 |
+
and (not message.get('tool_calls') or ns_tr_out.flag)
|
| 366 |
+
) -%}
|
| 367 |
+
|
| 368 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 369 |
+
{{- '<|tool_response>' -}}
|
| 370 |
+
{%- elif continues_into_next -%}
|
| 371 |
+
{%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
|
| 372 |
+
{{- '<turn|>\n' -}}
|
| 373 |
+
{%- endif -%}
|
| 374 |
+
|
| 375 |
+
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
|
| 376 |
+
{%- set ns.prev_non_tool_role = message['role'] -%}
|
| 377 |
+
{%- endif -%}
|
| 378 |
+
{%- endfor -%}
|
| 379 |
+
|
| 380 |
+
{%- if add_generation_prompt -%}
|
| 381 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 382 |
+
{{- '<|turn>model\n' -}}
|
| 383 |
+
{%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
|
| 384 |
+
{{- '<|channel>thought\n' -}}
|
| 385 |
+
{%- endif -%}
|
| 386 |
+
{%- endif -%}
|
checkpoint-250/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95e5b48bb701326b4720c6644eddc307c99d125c05fa1badfac903b30c0045dc
|
| 3 |
+
size 98635341
|
checkpoint-250/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b43968218bce499dbcab43c58dbb095ae0fd894d5156fd10c2a892a95b49a8b
|
| 3 |
+
size 14645
|
checkpoint-250/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:00f439b3bbbaf893aa89ab85b53f2e1f7d537de5eeeea6d27e16aba519e7b34d
|
| 3 |
+
size 1465
|
checkpoint-250/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
|
| 3 |
+
size 32169626
|
checkpoint-250/tokenizer_config.json
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_token": "<|audio|>",
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"boa_token": "<|audio>",
|
| 5 |
+
"boi_token": "<|image>",
|
| 6 |
+
"bos_token": "<bos>",
|
| 7 |
+
"eoa_token": "<audio|>",
|
| 8 |
+
"eoc_token": "<channel|>",
|
| 9 |
+
"eoi_token": "<image|>",
|
| 10 |
+
"eos_token": "<eos>",
|
| 11 |
+
"eot_token": "<turn|>",
|
| 12 |
+
"escape_token": "<|\"|>",
|
| 13 |
+
"etc_token": "<tool_call|>",
|
| 14 |
+
"etd_token": "<tool|>",
|
| 15 |
+
"etr_token": "<tool_response|>",
|
| 16 |
+
"extra_special_tokens": [
|
| 17 |
+
"<|video|>"
|
| 18 |
+
],
|
| 19 |
+
"image_token": "<|image|>",
|
| 20 |
+
"is_local": false,
|
| 21 |
+
"local_files_only": false,
|
| 22 |
+
"mask_token": "<mask>",
|
| 23 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 24 |
+
"model_specific_special_tokens": {
|
| 25 |
+
"audio_token": "<|audio|>",
|
| 26 |
+
"boa_token": "<|audio>",
|
| 27 |
+
"boi_token": "<|image>",
|
| 28 |
+
"eoa_token": "<audio|>",
|
| 29 |
+
"eoc_token": "<channel|>",
|
| 30 |
+
"eoi_token": "<image|>",
|
| 31 |
+
"eot_token": "<turn|>",
|
| 32 |
+
"escape_token": "<|\"|>",
|
| 33 |
+
"etc_token": "<tool_call|>",
|
| 34 |
+
"etd_token": "<tool|>",
|
| 35 |
+
"etr_token": "<tool_response|>",
|
| 36 |
+
"image_token": "<|image|>",
|
| 37 |
+
"soc_token": "<|channel>",
|
| 38 |
+
"sot_token": "<|turn>",
|
| 39 |
+
"stc_token": "<|tool_call>",
|
| 40 |
+
"std_token": "<|tool>",
|
| 41 |
+
"str_token": "<|tool_response>",
|
| 42 |
+
"think_token": "<|think|>"
|
| 43 |
+
},
|
| 44 |
+
"pad_token": "<eos>",
|
| 45 |
+
"padding_side": "right",
|
| 46 |
+
"processor_class": "Gemma4Processor",
|
| 47 |
+
"response_schema": {
|
| 48 |
+
"properties": {
|
| 49 |
+
"content": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
+
"role": {
|
| 53 |
+
"const": "assistant"
|
| 54 |
+
},
|
| 55 |
+
"thinking": {
|
| 56 |
+
"type": "string"
|
| 57 |
+
},
|
| 58 |
+
"tool_calls": {
|
| 59 |
+
"items": {
|
| 60 |
+
"properties": {
|
| 61 |
+
"function": {
|
| 62 |
+
"properties": {
|
| 63 |
+
"arguments": {
|
| 64 |
+
"additionalProperties": {},
|
| 65 |
+
"type": "object",
|
| 66 |
+
"x-parser": "gemma4-tool-call"
|
| 67 |
+
},
|
| 68 |
+
"name": {
|
| 69 |
+
"type": "string"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"type": "object",
|
| 73 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 74 |
+
},
|
| 75 |
+
"type": {
|
| 76 |
+
"const": "function"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"type": "object"
|
| 80 |
+
},
|
| 81 |
+
"type": "array",
|
| 82 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 83 |
+
}
|
| 84 |
+
},
|
| 85 |
+
"type": "object",
|
| 86 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 87 |
+
},
|
| 88 |
+
"response_template": {
|
| 89 |
+
"defaults": {
|
| 90 |
+
"role": "assistant"
|
| 91 |
+
},
|
| 92 |
+
"fields": {
|
| 93 |
+
"content": {
|
| 94 |
+
"close": [
|
| 95 |
+
"<turn|>",
|
| 96 |
+
"<|tool_response>",
|
| 97 |
+
"<eos>"
|
| 98 |
+
],
|
| 99 |
+
"content": "text"
|
| 100 |
+
},
|
| 101 |
+
"thinking": {
|
| 102 |
+
"close": "<channel|>",
|
| 103 |
+
"content": "text",
|
| 104 |
+
"open": "<|channel>thought\n"
|
| 105 |
+
},
|
| 106 |
+
"tool_calls": {
|
| 107 |
+
"close": "<tool_call|>",
|
| 108 |
+
"content": "json",
|
| 109 |
+
"content_args": {
|
| 110 |
+
"string_delims": [
|
| 111 |
+
[
|
| 112 |
+
"<|\"|>",
|
| 113 |
+
"<|\"|>"
|
| 114 |
+
]
|
| 115 |
+
],
|
| 116 |
+
"unquoted_keys": true
|
| 117 |
+
},
|
| 118 |
+
"open_pattern": "<\\|tool_call>call:(?P<name>\\w+)",
|
| 119 |
+
"repeats": true,
|
| 120 |
+
"transform": {
|
| 121 |
+
"function": {
|
| 122 |
+
"arguments": "{content}",
|
| 123 |
+
"name": "{name}"
|
| 124 |
+
},
|
| 125 |
+
"type": "function"
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
"start_anchor": [
|
| 130 |
+
"<|turn>model\n",
|
| 131 |
+
"<tool_response|>"
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
"soc_token": "<|channel>",
|
| 135 |
+
"sot_token": "<|turn>",
|
| 136 |
+
"stc_token": "<|tool_call>",
|
| 137 |
+
"std_token": "<|tool>",
|
| 138 |
+
"str_token": "<|tool_response>",
|
| 139 |
+
"think_token": "<|think|>",
|
| 140 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 141 |
+
"unk_token": "<unk>"
|
| 142 |
+
}
|
checkpoint-250/trainer_state.json
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_global_step": 200,
|
| 3 |
+
"best_metric": 0.024746960029006004,
|
| 4 |
+
"best_model_checkpoint": "/kaggle/working/gemma4_e2b_outputs/checkpoint-200",
|
| 5 |
+
"epoch": 0.8424599831508003,
|
| 6 |
+
"eval_steps": 50,
|
| 7 |
+
"global_step": 250,
|
| 8 |
+
"is_hyper_param_search": false,
|
| 9 |
+
"is_local_process_zero": true,
|
| 10 |
+
"is_world_process_zero": true,
|
| 11 |
+
"log_history": [
|
| 12 |
+
{
|
| 13 |
+
"entropy": 0.03442627163240104,
|
| 14 |
+
"epoch": 0.03369839932603201,
|
| 15 |
+
"grad_norm": 0.57421875,
|
| 16 |
+
"learning_rate": 4.6285714285714284e-05,
|
| 17 |
+
"loss": 0.30414247512817383,
|
| 18 |
+
"mean_token_accuracy": 0.9633298896253109,
|
| 19 |
+
"num_tokens": 50202.0,
|
| 20 |
+
"step": 10
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"entropy": 0.036702575445815455,
|
| 24 |
+
"epoch": 0.06739679865206402,
|
| 25 |
+
"grad_norm": 0.1357421875,
|
| 26 |
+
"learning_rate": 9.771428571428572e-05,
|
| 27 |
+
"loss": 0.02679154872894287,
|
| 28 |
+
"mean_token_accuracy": 0.9942228332161903,
|
| 29 |
+
"num_tokens": 99730.0,
|
| 30 |
+
"step": 20
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"entropy": 0.023526186634990155,
|
| 34 |
+
"epoch": 0.10109519797809605,
|
| 35 |
+
"grad_norm": 0.189453125,
|
| 36 |
+
"learning_rate": 0.00014914285714285716,
|
| 37 |
+
"loss": 0.03063507378101349,
|
| 38 |
+
"mean_token_accuracy": 0.9914997152984142,
|
| 39 |
+
"num_tokens": 150097.0,
|
| 40 |
+
"step": 30
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"entropy": 0.034747927097487266,
|
| 44 |
+
"epoch": 0.13479359730412804,
|
| 45 |
+
"grad_norm": 0.25390625,
|
| 46 |
+
"learning_rate": 0.00017997726000648073,
|
| 47 |
+
"loss": 0.0251019150018692,
|
| 48 |
+
"mean_token_accuracy": 0.9931103173643351,
|
| 49 |
+
"num_tokens": 198701.0,
|
| 50 |
+
"step": 40
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"entropy": 0.016794490450593003,
|
| 54 |
+
"epoch": 0.16849199663016007,
|
| 55 |
+
"grad_norm": 0.208984375,
|
| 56 |
+
"learning_rate": 0.0001797215670311433,
|
| 57 |
+
"loss": 0.027158683538436888,
|
| 58 |
+
"mean_token_accuracy": 0.9932276383042336,
|
| 59 |
+
"num_tokens": 251032.0,
|
| 60 |
+
"step": 50
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"epoch": 0.16849199663016007,
|
| 64 |
+
"eval_entropy": 0.022378485068695636,
|
| 65 |
+
"eval_loss": 0.031730424612760544,
|
| 66 |
+
"eval_mean_token_accuracy": 0.9921912817470178,
|
| 67 |
+
"eval_num_tokens": 251032.0,
|
| 68 |
+
"eval_runtime": 1126.4408,
|
| 69 |
+
"eval_samples_per_second": 1.799,
|
| 70 |
+
"eval_steps_per_second": 0.899,
|
| 71 |
+
"step": 50
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"entropy": 0.02238693693652749,
|
| 75 |
+
"epoch": 0.2021903959561921,
|
| 76 |
+
"grad_norm": 0.185546875,
|
| 77 |
+
"learning_rate": 0.00017918256616680084,
|
| 78 |
+
"loss": 0.022676032781600953,
|
| 79 |
+
"mean_token_accuracy": 0.9933203727006912,
|
| 80 |
+
"num_tokens": 301297.0,
|
| 81 |
+
"step": 60
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"entropy": 0.02536057697416254,
|
| 85 |
+
"epoch": 0.2358887952822241,
|
| 86 |
+
"grad_norm": 0.1953125,
|
| 87 |
+
"learning_rate": 0.00017836195938101938,
|
| 88 |
+
"loss": 0.02103605568408966,
|
| 89 |
+
"mean_token_accuracy": 0.9937991909682751,
|
| 90 |
+
"num_tokens": 349637.0,
|
| 91 |
+
"step": 70
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"entropy": 0.024386808862982435,
|
| 95 |
+
"epoch": 0.2695871946082561,
|
| 96 |
+
"grad_norm": 0.2314453125,
|
| 97 |
+
"learning_rate": 0.00017726233784985462,
|
| 98 |
+
"loss": 0.024811160564422608,
|
| 99 |
+
"mean_token_accuracy": 0.9928908865898848,
|
| 100 |
+
"num_tokens": 399870.0,
|
| 101 |
+
"step": 80
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"entropy": 0.02778970852796192,
|
| 105 |
+
"epoch": 0.3032855939342881,
|
| 106 |
+
"grad_norm": 0.2578125,
|
| 107 |
+
"learning_rate": 0.00017588717377586623,
|
| 108 |
+
"loss": 0.03330623209476471,
|
| 109 |
+
"mean_token_accuracy": 0.9904133033007383,
|
| 110 |
+
"num_tokens": 449477.0,
|
| 111 |
+
"step": 90
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"entropy": 0.023341893833276117,
|
| 115 |
+
"epoch": 0.33698399326032014,
|
| 116 |
+
"grad_norm": 0.1884765625,
|
| 117 |
+
"learning_rate": 0.00017424080942417207,
|
| 118 |
+
"loss": 0.025586703419685365,
|
| 119 |
+
"mean_token_accuracy": 0.9928323667496443,
|
| 120 |
+
"num_tokens": 498229.0,
|
| 121 |
+
"step": 100
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"epoch": 0.33698399326032014,
|
| 125 |
+
"eval_entropy": 0.0210638620780726,
|
| 126 |
+
"eval_loss": 0.03126470372080803,
|
| 127 |
+
"eval_mean_token_accuracy": 0.9927122755323675,
|
| 128 |
+
"eval_num_tokens": 498229.0,
|
| 129 |
+
"eval_runtime": 1124.2212,
|
| 130 |
+
"eval_samples_per_second": 1.802,
|
| 131 |
+
"eval_steps_per_second": 0.901,
|
| 132 |
+
"step": 100
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"entropy": 0.022127612936856167,
|
| 136 |
+
"epoch": 0.37068239258635216,
|
| 137 |
+
"grad_norm": 0.1572265625,
|
| 138 |
+
"learning_rate": 0.0001723284434111633,
|
| 139 |
+
"loss": 0.025175514817237853,
|
| 140 |
+
"mean_token_accuracy": 0.9937295001000166,
|
| 141 |
+
"num_tokens": 553163.0,
|
| 142 |
+
"step": 110
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"entropy": 0.025844440628861775,
|
| 146 |
+
"epoch": 0.4043807919123842,
|
| 147 |
+
"grad_norm": 0.107421875,
|
| 148 |
+
"learning_rate": 0.00017015611428917556,
|
| 149 |
+
"loss": 0.02075621634721756,
|
| 150 |
+
"mean_token_accuracy": 0.994851179793477,
|
| 151 |
+
"num_tokens": 602833.0,
|
| 152 |
+
"step": 120
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"entropy": 0.017262498397030868,
|
| 156 |
+
"epoch": 0.43807919123841615,
|
| 157 |
+
"grad_norm": 0.224609375,
|
| 158 |
+
"learning_rate": 0.00016773068147894944,
|
| 159 |
+
"loss": 0.02128828167915344,
|
| 160 |
+
"mean_token_accuracy": 0.9945652581751346,
|
| 161 |
+
"num_tokens": 650313.0,
|
| 162 |
+
"step": 130
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"entropy": 0.02044138053424831,
|
| 166 |
+
"epoch": 0.4717775905644482,
|
| 167 |
+
"grad_norm": 0.357421875,
|
| 168 |
+
"learning_rate": 0.00016505980361008902,
|
| 169 |
+
"loss": 0.018230150640010833,
|
| 170 |
+
"mean_token_accuracy": 0.9947165582329035,
|
| 171 |
+
"num_tokens": 697785.0,
|
| 172 |
+
"step": 140
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"entropy": 0.016532328606263035,
|
| 176 |
+
"epoch": 0.5054759898904801,
|
| 177 |
+
"grad_norm": 0.228515625,
|
| 178 |
+
"learning_rate": 0.00016215191433791105,
|
| 179 |
+
"loss": 0.02196011245250702,
|
| 180 |
+
"mean_token_accuracy": 0.9940924983471632,
|
| 181 |
+
"num_tokens": 746296.0,
|
| 182 |
+
"step": 150
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"epoch": 0.5054759898904801,
|
| 186 |
+
"eval_entropy": 0.021309930168988408,
|
| 187 |
+
"eval_loss": 0.02765325829386711,
|
| 188 |
+
"eval_mean_token_accuracy": 0.9929286667531005,
|
| 189 |
+
"eval_num_tokens": 746296.0,
|
| 190 |
+
"eval_runtime": 1125.2103,
|
| 191 |
+
"eval_samples_per_second": 1.801,
|
| 192 |
+
"eval_steps_per_second": 0.9,
|
| 193 |
+
"step": 150
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"entropy": 0.02324409563480003,
|
| 197 |
+
"epoch": 0.5391743892165122,
|
| 198 |
+
"grad_norm": 0.36328125,
|
| 199 |
+
"learning_rate": 0.00015901619571304635,
|
| 200 |
+
"loss": 0.024296788871288298,
|
| 201 |
+
"mean_token_accuracy": 0.9937251776456832,
|
| 202 |
+
"num_tokens": 795578.0,
|
| 203 |
+
"step": 160
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"entropy": 0.02200790760543896,
|
| 207 |
+
"epoch": 0.5728727885425442,
|
| 208 |
+
"grad_norm": 0.0732421875,
|
| 209 |
+
"learning_rate": 0.00015566254918788285,
|
| 210 |
+
"loss": 0.020977529883384704,
|
| 211 |
+
"mean_token_accuracy": 0.994451267644763,
|
| 212 |
+
"num_tokens": 845253.0,
|
| 213 |
+
"step": 170
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"entropy": 0.017312285865955346,
|
| 217 |
+
"epoch": 0.6065711878685762,
|
| 218 |
+
"grad_norm": 0.1611328125,
|
| 219 |
+
"learning_rate": 0.00015210156435140063,
|
| 220 |
+
"loss": 0.01916155368089676,
|
| 221 |
+
"mean_token_accuracy": 0.9945312373340129,
|
| 222 |
+
"num_tokens": 895137.0,
|
| 223 |
+
"step": 180
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"entropy": 0.01355354385341343,
|
| 227 |
+
"epoch": 0.6402695871946082,
|
| 228 |
+
"grad_norm": 0.10205078125,
|
| 229 |
+
"learning_rate": 0.00014834448549112372,
|
| 230 |
+
"loss": 0.016632051765918733,
|
| 231 |
+
"mean_token_accuracy": 0.9952114578336477,
|
| 232 |
+
"num_tokens": 945391.0,
|
| 233 |
+
"step": 190
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"entropy": 0.01753964945983171,
|
| 237 |
+
"epoch": 0.6739679865206403,
|
| 238 |
+
"grad_norm": 0.1630859375,
|
| 239 |
+
"learning_rate": 0.0001444031760877731,
|
| 240 |
+
"loss": 0.016346196830272674,
|
| 241 |
+
"mean_token_accuracy": 0.9948002852499485,
|
| 242 |
+
"num_tokens": 994601.0,
|
| 243 |
+
"step": 200
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"epoch": 0.6739679865206403,
|
| 247 |
+
"eval_entropy": 0.02103348611687381,
|
| 248 |
+
"eval_loss": 0.024746960029006004,
|
| 249 |
+
"eval_mean_token_accuracy": 0.9939268553833618,
|
| 250 |
+
"eval_num_tokens": 994601.0,
|
| 251 |
+
"eval_runtime": 1126.1962,
|
| 252 |
+
"eval_samples_per_second": 1.799,
|
| 253 |
+
"eval_steps_per_second": 0.899,
|
| 254 |
+
"step": 200
|
| 255 |
+
},
|
| 256 |
+
{
|
| 257 |
+
"entropy": 0.020208403906508465,
|
| 258 |
+
"epoch": 0.7076663858466723,
|
| 259 |
+
"grad_norm": 0.51953125,
|
| 260 |
+
"learning_rate": 0.0001402900813547342,
|
| 261 |
+
"loss": 0.023702555894851686,
|
| 262 |
+
"mean_token_accuracy": 0.9935556031763554,
|
| 263 |
+
"num_tokens": 1042508.0,
|
| 264 |
+
"step": 210
|
| 265 |
+
},
|
| 266 |
+
{
|
| 267 |
+
"entropy": 0.02361248063043604,
|
| 268 |
+
"epoch": 0.7413647851727043,
|
| 269 |
+
"grad_norm": 0.1337890625,
|
| 270 |
+
"learning_rate": 0.00013601818894062547,
|
| 271 |
+
"loss": 0.02297559231519699,
|
| 272 |
+
"mean_token_accuracy": 0.9938195463269949,
|
| 273 |
+
"num_tokens": 1094683.0,
|
| 274 |
+
"step": 220
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"entropy": 0.02179833457048517,
|
| 278 |
+
"epoch": 0.7750631844987363,
|
| 279 |
+
"grad_norm": 0.1591796875,
|
| 280 |
+
"learning_rate": 0.00013160098791905475,
|
| 281 |
+
"loss": 0.02227169871330261,
|
| 282 |
+
"mean_token_accuracy": 0.9937427151948214,
|
| 283 |
+
"num_tokens": 1143379.0,
|
| 284 |
+
"step": 230
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
"entropy": 0.02089707843479118,
|
| 288 |
+
"epoch": 0.8087615838247684,
|
| 289 |
+
"grad_norm": 0.1142578125,
|
| 290 |
+
"learning_rate": 0.0001270524261950592,
|
| 291 |
+
"loss": 0.0160829097032547,
|
| 292 |
+
"mean_token_accuracy": 0.9948678724467754,
|
| 293 |
+
"num_tokens": 1191313.0,
|
| 294 |
+
"step": 240
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"entropy": 0.012493419923021064,
|
| 298 |
+
"epoch": 0.8424599831508003,
|
| 299 |
+
"grad_norm": 0.154296875,
|
| 300 |
+
"learning_rate": 0.00012238686646272312,
|
| 301 |
+
"loss": 0.016340985894203186,
|
| 302 |
+
"mean_token_accuracy": 0.9960907097905874,
|
| 303 |
+
"num_tokens": 1240950.0,
|
| 304 |
+
"step": 250
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"epoch": 0.8424599831508003,
|
| 308 |
+
"eval_entropy": 0.014308816084650821,
|
| 309 |
+
"eval_loss": 0.025563491508364677,
|
| 310 |
+
"eval_mean_token_accuracy": 0.9939537474339477,
|
| 311 |
+
"eval_num_tokens": 1240950.0,
|
| 312 |
+
"eval_runtime": 1125.9371,
|
| 313 |
+
"eval_samples_per_second": 1.799,
|
| 314 |
+
"eval_steps_per_second": 0.9,
|
| 315 |
+
"step": 250
|
| 316 |
+
}
|
| 317 |
+
],
|
| 318 |
+
"logging_steps": 10,
|
| 319 |
+
"max_steps": 594,
|
| 320 |
+
"num_input_tokens_seen": 0,
|
| 321 |
+
"num_train_epochs": 2,
|
| 322 |
+
"save_steps": 50,
|
| 323 |
+
"stateful_callbacks": {
|
| 324 |
+
"TrainerControl": {
|
| 325 |
+
"args": {
|
| 326 |
+
"should_epoch_stop": false,
|
| 327 |
+
"should_evaluate": false,
|
| 328 |
+
"should_log": false,
|
| 329 |
+
"should_save": true,
|
| 330 |
+
"should_training_stop": false
|
| 331 |
+
},
|
| 332 |
+
"attributes": {}
|
| 333 |
+
}
|
| 334 |
+
},
|
| 335 |
+
"total_flos": 2.29682838124032e+16,
|
| 336 |
+
"train_batch_size": 2,
|
| 337 |
+
"trial_name": null,
|
| 338 |
+
"trial_params": null
|
| 339 |
+
}
|
checkpoint-250/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:545d9e9114a70c72a1e35f789611908870e987f7b59e7bebee5bd7f7fe1286d8
|
| 3 |
+
size 5777
|