Stage 1 retrain upload
Browse files- .gitattributes +2 -0
- README.md +59 -0
- checkpoint-18000/README.md +210 -0
- checkpoint-18000/adapter_config.json +53 -0
- checkpoint-18000/adapter_model.safetensors +3 -0
- checkpoint-18000/chat_template.jinja +344 -0
- checkpoint-18000/optimizer.pt +3 -0
- checkpoint-18000/rng_state.pth +3 -0
- checkpoint-18000/scheduler.pt +3 -0
- checkpoint-18000/tokenizer.json +3 -0
- checkpoint-18000/tokenizer_config.json +99 -0
- checkpoint-18000/trainer_state.json +0 -0
- checkpoint-18000/training_args.bin +3 -0
- checkpoint-20000/README.md +210 -0
- checkpoint-20000/adapter_config.json +53 -0
- checkpoint-20000/adapter_model.safetensors +3 -0
- checkpoint-20000/chat_template.jinja +344 -0
- checkpoint-20000/optimizer.pt +3 -0
- checkpoint-20000/rng_state.pth +3 -0
- checkpoint-20000/scheduler.pt +3 -0
- checkpoint-20000/tokenizer.json +3 -0
- checkpoint-20000/tokenizer_config.json +99 -0
- checkpoint-20000/trainer_state.json +0 -0
- checkpoint-20000/training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
checkpoint-18000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
checkpoint-20000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: analist/gemma4-e4b-ewe-multimodal
|
| 3 |
+
library_name: transformers
|
| 4 |
+
model_name: s1_ewe_cpt
|
| 5 |
+
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- trl
|
| 8 |
+
- sft
|
| 9 |
+
- unsloth
|
| 10 |
+
licence: license
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Model Card for s1_ewe_cpt
|
| 14 |
+
|
| 15 |
+
This model is a fine-tuned version of [analist/gemma4-e4b-ewe-multimodal](https://huggingface.co/analist/gemma4-e4b-ewe-multimodal).
|
| 16 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 17 |
+
|
| 18 |
+
## Quick start
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from transformers import pipeline
|
| 22 |
+
|
| 23 |
+
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?"
|
| 24 |
+
generator = pipeline("text-generation", model="None", device="cuda")
|
| 25 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 26 |
+
print(output["generated_text"])
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## Training procedure
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
This model was trained with SFT.
|
| 35 |
+
|
| 36 |
+
### Framework versions
|
| 37 |
+
|
| 38 |
+
- TRL: 0.24.0
|
| 39 |
+
- Transformers: 5.5.0
|
| 40 |
+
- Pytorch: 2.10.0
|
| 41 |
+
- Datasets: 4.3.0
|
| 42 |
+
- Tokenizers: 0.22.2
|
| 43 |
+
|
| 44 |
+
## Citations
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
Cite TRL as:
|
| 49 |
+
|
| 50 |
+
```bibtex
|
| 51 |
+
@misc{vonwerra2022trl,
|
| 52 |
+
title = {{TRL: Transformer Reinforcement Learning}},
|
| 53 |
+
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
|
| 54 |
+
year = 2020,
|
| 55 |
+
journal = {GitHub repository},
|
| 56 |
+
publisher = {GitHub},
|
| 57 |
+
howpublished = {\url{https://github.com/huggingface/trl}}
|
| 58 |
+
}
|
| 59 |
+
```
|
checkpoint-18000/README.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: analist/gemma4-e4b-ewe-multimodal
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:analist/gemma4-e4b-ewe-multimodal
|
| 7 |
+
- lora
|
| 8 |
+
- sft
|
| 9 |
+
- transformers
|
| 10 |
+
- trl
|
| 11 |
+
- unsloth
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Model Card for Model ID
|
| 15 |
+
|
| 16 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
### Model Description
|
| 23 |
+
|
| 24 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
- **Developed by:** [More Information Needed]
|
| 29 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 30 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 31 |
+
- **Model type:** [More Information Needed]
|
| 32 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 33 |
+
- **License:** [More Information Needed]
|
| 34 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
### Model Sources [optional]
|
| 37 |
+
|
| 38 |
+
<!-- Provide the basic links for the model. -->
|
| 39 |
+
|
| 40 |
+
- **Repository:** [More Information Needed]
|
| 41 |
+
- **Paper [optional]:** [More Information Needed]
|
| 42 |
+
- **Demo [optional]:** [More Information Needed]
|
| 43 |
+
|
| 44 |
+
## Uses
|
| 45 |
+
|
| 46 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 47 |
+
|
| 48 |
+
### Direct Use
|
| 49 |
+
|
| 50 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 51 |
+
|
| 52 |
+
[More Information Needed]
|
| 53 |
+
|
| 54 |
+
### Downstream Use [optional]
|
| 55 |
+
|
| 56 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 57 |
+
|
| 58 |
+
[More Information Needed]
|
| 59 |
+
|
| 60 |
+
### Out-of-Scope Use
|
| 61 |
+
|
| 62 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 63 |
+
|
| 64 |
+
[More Information Needed]
|
| 65 |
+
|
| 66 |
+
## Bias, Risks, and Limitations
|
| 67 |
+
|
| 68 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 69 |
+
|
| 70 |
+
[More Information Needed]
|
| 71 |
+
|
| 72 |
+
### Recommendations
|
| 73 |
+
|
| 74 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 75 |
+
|
| 76 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 77 |
+
|
| 78 |
+
## How to Get Started with the Model
|
| 79 |
+
|
| 80 |
+
Use the code below to get started with the model.
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
## Training Details
|
| 85 |
+
|
| 86 |
+
### Training Data
|
| 87 |
+
|
| 88 |
+
<!-- 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. -->
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
### Training Procedure
|
| 93 |
+
|
| 94 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 95 |
+
|
| 96 |
+
#### Preprocessing [optional]
|
| 97 |
+
|
| 98 |
+
[More Information Needed]
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
#### Training Hyperparameters
|
| 102 |
+
|
| 103 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 104 |
+
|
| 105 |
+
#### Speeds, Sizes, Times [optional]
|
| 106 |
+
|
| 107 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 108 |
+
|
| 109 |
+
[More Information Needed]
|
| 110 |
+
|
| 111 |
+
## Evaluation
|
| 112 |
+
|
| 113 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 114 |
+
|
| 115 |
+
### Testing Data, Factors & Metrics
|
| 116 |
+
|
| 117 |
+
#### Testing Data
|
| 118 |
+
|
| 119 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 120 |
+
|
| 121 |
+
[More Information Needed]
|
| 122 |
+
|
| 123 |
+
#### Factors
|
| 124 |
+
|
| 125 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 126 |
+
|
| 127 |
+
[More Information Needed]
|
| 128 |
+
|
| 129 |
+
#### Metrics
|
| 130 |
+
|
| 131 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 132 |
+
|
| 133 |
+
[More Information Needed]
|
| 134 |
+
|
| 135 |
+
### Results
|
| 136 |
+
|
| 137 |
+
[More Information Needed]
|
| 138 |
+
|
| 139 |
+
#### Summary
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
## Model Examination [optional]
|
| 144 |
+
|
| 145 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 146 |
+
|
| 147 |
+
[More Information Needed]
|
| 148 |
+
|
| 149 |
+
## Environmental Impact
|
| 150 |
+
|
| 151 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 152 |
+
|
| 153 |
+
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).
|
| 154 |
+
|
| 155 |
+
- **Hardware Type:** [More Information Needed]
|
| 156 |
+
- **Hours used:** [More Information Needed]
|
| 157 |
+
- **Cloud Provider:** [More Information Needed]
|
| 158 |
+
- **Compute Region:** [More Information Needed]
|
| 159 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 160 |
+
|
| 161 |
+
## Technical Specifications [optional]
|
| 162 |
+
|
| 163 |
+
### Model Architecture and Objective
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
### Compute Infrastructure
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
#### Hardware
|
| 172 |
+
|
| 173 |
+
[More Information Needed]
|
| 174 |
+
|
| 175 |
+
#### Software
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
## Citation [optional]
|
| 180 |
+
|
| 181 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 182 |
+
|
| 183 |
+
**BibTeX:**
|
| 184 |
+
|
| 185 |
+
[More Information Needed]
|
| 186 |
+
|
| 187 |
+
**APA:**
|
| 188 |
+
|
| 189 |
+
[More Information Needed]
|
| 190 |
+
|
| 191 |
+
## Glossary [optional]
|
| 192 |
+
|
| 193 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## More Information [optional]
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
| 200 |
+
|
| 201 |
+
## Model Card Authors [optional]
|
| 202 |
+
|
| 203 |
+
[More Information Needed]
|
| 204 |
+
|
| 205 |
+
## Model Card Contact
|
| 206 |
+
|
| 207 |
+
[More Information Needed]
|
| 208 |
+
### Framework versions
|
| 209 |
+
|
| 210 |
+
- PEFT 0.18.1
|
checkpoint-18000/adapter_config.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Gemma4ForConditionalGeneration",
|
| 7 |
+
"parent_library": "transformers.models.gemma4.modeling_gemma4",
|
| 8 |
+
"unsloth_fixed": true
|
| 9 |
+
},
|
| 10 |
+
"base_model_name_or_path": "analist/gemma4-e4b-ewe-multimodal",
|
| 11 |
+
"bias": "none",
|
| 12 |
+
"corda_config": null,
|
| 13 |
+
"ensure_weight_tying": false,
|
| 14 |
+
"eva_config": null,
|
| 15 |
+
"exclude_modules": null,
|
| 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.0,
|
| 26 |
+
"megatron_config": null,
|
| 27 |
+
"megatron_core": "megatron.core",
|
| 28 |
+
"modules_to_save": [
|
| 29 |
+
"embed_tokens",
|
| 30 |
+
"lm_head"
|
| 31 |
+
],
|
| 32 |
+
"peft_type": "LORA",
|
| 33 |
+
"peft_version": "0.18.1",
|
| 34 |
+
"qalora_group_size": 16,
|
| 35 |
+
"r": 32,
|
| 36 |
+
"rank_pattern": {},
|
| 37 |
+
"revision": null,
|
| 38 |
+
"target_modules": [
|
| 39 |
+
"v_proj",
|
| 40 |
+
"o_proj",
|
| 41 |
+
"up_proj",
|
| 42 |
+
"gate_proj",
|
| 43 |
+
"q_proj",
|
| 44 |
+
"k_proj",
|
| 45 |
+
"down_proj"
|
| 46 |
+
],
|
| 47 |
+
"target_parameters": null,
|
| 48 |
+
"task_type": "CAUSAL_LM",
|
| 49 |
+
"trainable_token_indices": null,
|
| 50 |
+
"use_dora": false,
|
| 51 |
+
"use_qalora": false,
|
| 52 |
+
"use_rslora": false
|
| 53 |
+
}
|
checkpoint-18000/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0738e82c7abd5708249d7d3eba25c83c384cd23f21e7f11b1b16387ab02e03d5
|
| 3 |
+
size 1859442416
|
checkpoint-18000/chat_template.jinja
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro format_parameters(properties, required) -%}
|
| 2 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 3 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 4 |
+
{%- for key, value in properties | dictsort -%}
|
| 5 |
+
{%- set add_comma = false -%}
|
| 6 |
+
{%- if key not in standard_keys -%}
|
| 7 |
+
{%- if ns.found_first %},{% endif -%}
|
| 8 |
+
{%- set ns.found_first = true -%}
|
| 9 |
+
{{ key }}:{
|
| 10 |
+
{%- if value['description'] -%}
|
| 11 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 12 |
+
{%- set add_comma = true -%}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 15 |
+
{%- if value['enum'] -%}
|
| 16 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 17 |
+
enum:{{ format_argument(value['enum']) }}
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 20 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 21 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 22 |
+
items:{
|
| 23 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 24 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 25 |
+
{%- if item_value is not none -%}
|
| 26 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 27 |
+
{%- set ns_items.found_first = true -%}
|
| 28 |
+
{%- if item_key == 'properties' -%}
|
| 29 |
+
properties:{
|
| 30 |
+
{%- if item_value is mapping -%}
|
| 31 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
}
|
| 34 |
+
{%- elif item_key == 'required' -%}
|
| 35 |
+
required:[
|
| 36 |
+
{%- for req_item in item_value -%}
|
| 37 |
+
<|"|>{{- req_item -}}<|"|>
|
| 38 |
+
{%- if not loop.last %},{% endif -%}
|
| 39 |
+
{%- endfor -%}
|
| 40 |
+
]
|
| 41 |
+
{%- elif item_key == 'type' -%}
|
| 42 |
+
{%- if item_value is string -%}
|
| 43 |
+
type:{{ format_argument(item_value | upper) }}
|
| 44 |
+
{%- else -%}
|
| 45 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 46 |
+
{%- endif -%}
|
| 47 |
+
{%- else -%}
|
| 48 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 49 |
+
{%- endif -%}
|
| 50 |
+
{%- endif -%}
|
| 51 |
+
{%- endfor -%}
|
| 52 |
+
}
|
| 53 |
+
{%- endif -%}
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- if value['nullable'] %}
|
| 56 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 57 |
+
nullable:true
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 60 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 61 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 62 |
+
properties:{
|
| 63 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 64 |
+
}
|
| 65 |
+
{%- elif value is mapping -%}
|
| 66 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 67 |
+
properties:{
|
| 68 |
+
{{- format_parameters(value, value['required'] | default([])) -}}
|
| 69 |
+
}
|
| 70 |
+
{%- endif -%}
|
| 71 |
+
{%- if value['required'] -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
required:[
|
| 74 |
+
{%- for item in value['required'] | default([]) -%}
|
| 75 |
+
<|"|>{{- item -}}<|"|>
|
| 76 |
+
{%- if not loop.last %},{% endif -%}
|
| 77 |
+
{%- endfor -%}
|
| 78 |
+
]
|
| 79 |
+
{%- endif -%}
|
| 80 |
+
{%- endif -%}
|
| 81 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 82 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 83 |
+
{%- endif -%}
|
| 84 |
+
{%- endfor -%}
|
| 85 |
+
{%- endmacro -%}
|
| 86 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 87 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 88 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 89 |
+
{%- if params -%}
|
| 90 |
+
,parameters:{
|
| 91 |
+
{%- if params['properties'] -%}
|
| 92 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- if params['required'] -%}
|
| 95 |
+
required:[
|
| 96 |
+
{%- for item in params['required'] -%}
|
| 97 |
+
<|"|>{{- item -}}<|"|>
|
| 98 |
+
{{- ',' if not loop.last -}}
|
| 99 |
+
{%- endfor -%}
|
| 100 |
+
],
|
| 101 |
+
{%- endif -%}
|
| 102 |
+
{%- if params['type'] -%}
|
| 103 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 104 |
+
{%- endif -%}
|
| 105 |
+
{%- endif -%}
|
| 106 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 107 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 108 |
+
,response:{
|
| 109 |
+
{%- if response_declaration['description'] -%}
|
| 110 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 113 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 114 |
+
{%- endif -%}
|
| 115 |
+
{%- endif -%}
|
| 116 |
+
}
|
| 117 |
+
{%- endmacro -%}
|
| 118 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 119 |
+
{%- if argument is string -%}
|
| 120 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 121 |
+
{%- elif argument is boolean -%}
|
| 122 |
+
{{- 'true' if argument else 'false' -}}
|
| 123 |
+
{%- elif argument is mapping -%}
|
| 124 |
+
{{- '{' -}}
|
| 125 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 126 |
+
{%- for key, value in argument | dictsort -%}
|
| 127 |
+
{%- if ns.found_first %},{% endif -%}
|
| 128 |
+
{%- set ns.found_first = true -%}
|
| 129 |
+
{%- if escape_keys -%}
|
| 130 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 131 |
+
{%- else -%}
|
| 132 |
+
{{- key -}}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 135 |
+
{%- endfor -%}
|
| 136 |
+
{{- '}' -}}
|
| 137 |
+
{%- elif argument is sequence -%}
|
| 138 |
+
{{- '[' -}}
|
| 139 |
+
{%- for item in argument -%}
|
| 140 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 141 |
+
{%- if not loop.last %},{% endif -%}
|
| 142 |
+
{%- endfor -%}
|
| 143 |
+
{{- ']' -}}
|
| 144 |
+
{%- else -%}
|
| 145 |
+
{{- argument -}}
|
| 146 |
+
{%- endif -%}
|
| 147 |
+
{%- endmacro -%}
|
| 148 |
+
{%- macro strip_thinking(text) -%}
|
| 149 |
+
{%- set ns = namespace(result='') -%}
|
| 150 |
+
{%- for part in text.split('<channel|>') -%}
|
| 151 |
+
{%- if '<|channel>' in part -%}
|
| 152 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 153 |
+
{%- else -%}
|
| 154 |
+
{%- set ns.result = ns.result + part -%}
|
| 155 |
+
{%- endif -%}
|
| 156 |
+
{%- endfor -%}
|
| 157 |
+
{{- ns.result | trim -}}
|
| 158 |
+
{%- endmacro -%}
|
| 159 |
+
|
| 160 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 161 |
+
{{- '<|tool_response>' -}}
|
| 162 |
+
{%- if response is mapping -%}
|
| 163 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 164 |
+
{%- for key, value in response | dictsort -%}
|
| 165 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 166 |
+
{%- if not loop.last %},{% endif -%}
|
| 167 |
+
{%- endfor -%}
|
| 168 |
+
{{- '}' -}}
|
| 169 |
+
{%- else -%}
|
| 170 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 171 |
+
{%- endif -%}
|
| 172 |
+
{{- '<tool_response|>' -}}
|
| 173 |
+
{%- endmacro -%}
|
| 174 |
+
|
| 175 |
+
{%- set ns = namespace(prev_message_type=None) -%}
|
| 176 |
+
{%- set loop_messages = messages -%}
|
| 177 |
+
{{- bos_token -}}
|
| 178 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 179 |
+
{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
|
| 180 |
+
{{- '<|turn>system\n' -}}
|
| 181 |
+
|
| 182 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 183 |
+
{%- if enable_thinking is defined and enable_thinking -%}
|
| 184 |
+
{{- '<|think|>\n' -}}
|
| 185 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 186 |
+
{%- endif -%}
|
| 187 |
+
|
| 188 |
+
{%- if messages[0]['role'] in ['system', 'developer'] -%}
|
| 189 |
+
{{- messages[0]['content'] | trim -}}
|
| 190 |
+
{%- set loop_messages = messages[1:] -%}
|
| 191 |
+
{%- endif -%}
|
| 192 |
+
|
| 193 |
+
{%- if tools -%}
|
| 194 |
+
{%- for tool in tools %}
|
| 195 |
+
{{- '<|tool>' -}}
|
| 196 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 197 |
+
{{- '<tool|>' -}}
|
| 198 |
+
{%- endfor %}
|
| 199 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 200 |
+
{%- endif -%}
|
| 201 |
+
|
| 202 |
+
{{- '<turn|>\n' -}}
|
| 203 |
+
{%- endif %}
|
| 204 |
+
|
| 205 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 206 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 207 |
+
{%- for i in range(loop_messages | length) -%}
|
| 208 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 209 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 210 |
+
{%- endif -%}
|
| 211 |
+
{%- endfor -%}
|
| 212 |
+
|
| 213 |
+
{#- Loop through messages -#}
|
| 214 |
+
{%- for message in loop_messages -%}
|
| 215 |
+
{%- if message['role'] != 'tool' -%}
|
| 216 |
+
{%- set ns.prev_message_type = None -%}
|
| 217 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 218 |
+
{#- Detect continuation: suppress duplicate <|turn>model when previous non-tool message was also assistant -#}
|
| 219 |
+
{%- set prev_nt = namespace(role=None, found=false) -%}
|
| 220 |
+
{%- if loop.index0 > 0 -%}
|
| 221 |
+
{%- for j in range(loop.index0 - 1, -1, -1) -%}
|
| 222 |
+
{%- if not prev_nt.found -%}
|
| 223 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 224 |
+
{%- set prev_nt.role = loop_messages[j]['role'] -%}
|
| 225 |
+
{%- set prev_nt.found = true -%}
|
| 226 |
+
{%- endif -%}
|
| 227 |
+
{%- endif -%}
|
| 228 |
+
{%- endfor -%}
|
| 229 |
+
{%- endif -%}
|
| 230 |
+
{%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
|
| 231 |
+
{%- if not continue_same_model_turn -%}
|
| 232 |
+
{{- '<|turn>' + role + '\n' }}
|
| 233 |
+
{%- endif -%}
|
| 234 |
+
|
| 235 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 236 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 237 |
+
{%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
|
| 238 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 239 |
+
{%- endif -%}
|
| 240 |
+
|
| 241 |
+
{%- if message['tool_calls'] -%}
|
| 242 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 243 |
+
{%- set function = tool_call['function'] -%}
|
| 244 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 245 |
+
{%- if function['arguments'] is mapping -%}
|
| 246 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 247 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 248 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 249 |
+
{%- set ns_args.found_first = true -%}
|
| 250 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 251 |
+
{%- endfor -%}
|
| 252 |
+
{%- elif function['arguments'] is string -%}
|
| 253 |
+
{{- function['arguments'] -}}
|
| 254 |
+
{%- endif -%}
|
| 255 |
+
{{- '}<tool_call|>' -}}
|
| 256 |
+
{%- endfor -%}
|
| 257 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 258 |
+
{%- endif -%}
|
| 259 |
+
|
| 260 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 261 |
+
{%- if message.get('tool_responses') -%}
|
| 262 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 263 |
+
{%- for tool_response in message['tool_responses'] -%}
|
| 264 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
|
| 265 |
+
{%- set ns_tr_out.flag = true -%}
|
| 266 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 267 |
+
{%- endfor -%}
|
| 268 |
+
{%- elif message.get('tool_calls') -%}
|
| 269 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 270 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 271 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 272 |
+
{%- if ns_tool_scan.stopped -%}
|
| 273 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 274 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 275 |
+
{%- else -%}
|
| 276 |
+
{%- set follow = loop_messages[k] -%}
|
| 277 |
+
{#- Resolve tool_call_id to function name -#}
|
| 278 |
+
{%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
|
| 279 |
+
{%- for tc in message['tool_calls'] -%}
|
| 280 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 281 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 282 |
+
{%- endif -%}
|
| 283 |
+
{%- endfor -%}
|
| 284 |
+
{#- Handle content as string or content-parts array -#}
|
| 285 |
+
{%- set tool_body = follow.get('content') -%}
|
| 286 |
+
{%- if tool_body is string -%}
|
| 287 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 288 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 289 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 290 |
+
{%- for part in tool_body -%}
|
| 291 |
+
{%- if part.get('type') == 'text' -%}
|
| 292 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 293 |
+
{%- endif -%}
|
| 294 |
+
{%- endfor -%}
|
| 295 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 296 |
+
{%- else -%}
|
| 297 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 298 |
+
{%- endif -%}
|
| 299 |
+
{%- set ns_tr_out.flag = true -%}
|
| 300 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 301 |
+
{%- endif -%}
|
| 302 |
+
{%- endfor -%}
|
| 303 |
+
{%- endif -%}
|
| 304 |
+
|
| 305 |
+
{%- if message['content'] is string -%}
|
| 306 |
+
{%- if role == 'model' -%}
|
| 307 |
+
{{- strip_thinking(message['content']) -}}
|
| 308 |
+
{%- else -%}
|
| 309 |
+
{{- message['content'] | trim -}}
|
| 310 |
+
{%- endif -%}
|
| 311 |
+
{%- elif message['content'] is sequence -%}
|
| 312 |
+
{%- for item in message['content'] -%}
|
| 313 |
+
{%- if item['type'] == 'text' -%}
|
| 314 |
+
{%- if role == 'model' -%}
|
| 315 |
+
{{- strip_thinking(item['text']) -}}
|
| 316 |
+
{%- else -%}
|
| 317 |
+
{{- item['text'] | trim -}}
|
| 318 |
+
{%- endif -%}
|
| 319 |
+
{%- elif item['type'] == 'image' -%}
|
| 320 |
+
{{- '<|image|>' -}}
|
| 321 |
+
{%- set ns.prev_message_type = 'image' -%}
|
| 322 |
+
{%- elif item['type'] == 'audio' -%}
|
| 323 |
+
{{- '<|audio|>' -}}
|
| 324 |
+
{%- set ns.prev_message_type = 'audio' -%}
|
| 325 |
+
{%- elif item['type'] == 'video' -%}
|
| 326 |
+
{{- '<|video|>' -}}
|
| 327 |
+
{%- set ns.prev_message_type = 'video' -%}
|
| 328 |
+
{%- endif -%}
|
| 329 |
+
{%- endfor -%}
|
| 330 |
+
{%- endif -%}
|
| 331 |
+
|
| 332 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 333 |
+
{{- '<|tool_response>' -}}
|
| 334 |
+
{%- elif not (ns_tr_out.flag and not message.get('content')) -%}
|
| 335 |
+
{{- '<turn|>\n' -}}
|
| 336 |
+
{%- endif -%}
|
| 337 |
+
{%- endif -%}
|
| 338 |
+
{%- endfor -%}
|
| 339 |
+
|
| 340 |
+
{%- if add_generation_prompt -%}
|
| 341 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 342 |
+
{{- '<|turn>model\n' -}}
|
| 343 |
+
{%- endif -%}
|
| 344 |
+
{%- endif -%}
|
checkpoint-18000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:232e2098484fa62a9126a372edd0503377163f9151dd70d1771e0da6cbd10894
|
| 3 |
+
size 4138731987
|
checkpoint-18000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fcd394af162b14aaadfebe8fb3dc790d8dbacdfba735650d1cb9aea917c75c09
|
| 3 |
+
size 14645
|
checkpoint-18000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52538dae95aacc730ac1ecac35b3f36e4c74ed9be7608f845bae5b54b37d9a9b
|
| 3 |
+
size 1465
|
checkpoint-18000/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec21dc3f868a3a8c7b9f0ff883cb6222f67fbe11df3121534e828ce1dd811306
|
| 3 |
+
size 32170149
|
checkpoint-18000/tokenizer_config.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": "<turn|>",
|
| 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 |
+
"<think>",
|
| 18 |
+
"</think>"
|
| 19 |
+
],
|
| 20 |
+
"image_token": "<|image|>",
|
| 21 |
+
"is_local": false,
|
| 22 |
+
"mask_token": "<mask>",
|
| 23 |
+
"max_length": null,
|
| 24 |
+
"model_max_length": 131072,
|
| 25 |
+
"model_specific_special_tokens": {
|
| 26 |
+
"audio_token": "<|audio|>",
|
| 27 |
+
"boa_token": "<|audio>",
|
| 28 |
+
"boi_token": "<|image>",
|
| 29 |
+
"eoa_token": "<audio|>",
|
| 30 |
+
"eoc_token": "<channel|>",
|
| 31 |
+
"eoi_token": "<image|>",
|
| 32 |
+
"eot_token": "<turn|>",
|
| 33 |
+
"escape_token": "<|\"|>",
|
| 34 |
+
"etc_token": "<tool_call|>",
|
| 35 |
+
"etd_token": "<tool|>",
|
| 36 |
+
"etr_token": "<tool_response|>",
|
| 37 |
+
"image_token": "<|image|>",
|
| 38 |
+
"soc_token": "<|channel>",
|
| 39 |
+
"sot_token": "<|turn>",
|
| 40 |
+
"stc_token": "<|tool_call>",
|
| 41 |
+
"std_token": "<|tool>",
|
| 42 |
+
"str_token": "<|tool_response>",
|
| 43 |
+
"think_token": "<|think|>"
|
| 44 |
+
},
|
| 45 |
+
"pad_to_multiple_of": null,
|
| 46 |
+
"pad_token": "<pad>",
|
| 47 |
+
"pad_token_type_id": 0,
|
| 48 |
+
"padding_side": "right",
|
| 49 |
+
"processor_class": "Gemma4Processor",
|
| 50 |
+
"response_schema": {
|
| 51 |
+
"properties": {
|
| 52 |
+
"content": {
|
| 53 |
+
"type": "string"
|
| 54 |
+
},
|
| 55 |
+
"role": {
|
| 56 |
+
"const": "assistant"
|
| 57 |
+
},
|
| 58 |
+
"thinking": {
|
| 59 |
+
"type": "string"
|
| 60 |
+
},
|
| 61 |
+
"tool_calls": {
|
| 62 |
+
"items": {
|
| 63 |
+
"properties": {
|
| 64 |
+
"function": {
|
| 65 |
+
"properties": {
|
| 66 |
+
"arguments": {
|
| 67 |
+
"additionalProperties": {},
|
| 68 |
+
"type": "object",
|
| 69 |
+
"x-parser": "gemma4-tool-call"
|
| 70 |
+
},
|
| 71 |
+
"name": {
|
| 72 |
+
"type": "string"
|
| 73 |
+
}
|
| 74 |
+
},
|
| 75 |
+
"type": "object",
|
| 76 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 77 |
+
},
|
| 78 |
+
"type": {
|
| 79 |
+
"const": "function"
|
| 80 |
+
}
|
| 81 |
+
},
|
| 82 |
+
"type": "object"
|
| 83 |
+
},
|
| 84 |
+
"type": "array",
|
| 85 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"type": "object",
|
| 89 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 90 |
+
},
|
| 91 |
+
"soc_token": "<|channel>",
|
| 92 |
+
"sot_token": "<|turn>",
|
| 93 |
+
"stc_token": "<|tool_call>",
|
| 94 |
+
"std_token": "<|tool>",
|
| 95 |
+
"str_token": "<|tool_response>",
|
| 96 |
+
"think_token": "<|think|>",
|
| 97 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 98 |
+
"unk_token": "<unk>"
|
| 99 |
+
}
|
checkpoint-18000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
checkpoint-18000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a6590210e831f25bc0ee97238fb4b1782738727f5cded3bfdad71abbf244297
|
| 3 |
+
size 5585
|
checkpoint-20000/README.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: analist/gemma4-e4b-ewe-multimodal
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:analist/gemma4-e4b-ewe-multimodal
|
| 7 |
+
- lora
|
| 8 |
+
- sft
|
| 9 |
+
- transformers
|
| 10 |
+
- trl
|
| 11 |
+
- unsloth
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Model Card for Model ID
|
| 15 |
+
|
| 16 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
### Model Description
|
| 23 |
+
|
| 24 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
- **Developed by:** [More Information Needed]
|
| 29 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 30 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 31 |
+
- **Model type:** [More Information Needed]
|
| 32 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 33 |
+
- **License:** [More Information Needed]
|
| 34 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
### Model Sources [optional]
|
| 37 |
+
|
| 38 |
+
<!-- Provide the basic links for the model. -->
|
| 39 |
+
|
| 40 |
+
- **Repository:** [More Information Needed]
|
| 41 |
+
- **Paper [optional]:** [More Information Needed]
|
| 42 |
+
- **Demo [optional]:** [More Information Needed]
|
| 43 |
+
|
| 44 |
+
## Uses
|
| 45 |
+
|
| 46 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 47 |
+
|
| 48 |
+
### Direct Use
|
| 49 |
+
|
| 50 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 51 |
+
|
| 52 |
+
[More Information Needed]
|
| 53 |
+
|
| 54 |
+
### Downstream Use [optional]
|
| 55 |
+
|
| 56 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 57 |
+
|
| 58 |
+
[More Information Needed]
|
| 59 |
+
|
| 60 |
+
### Out-of-Scope Use
|
| 61 |
+
|
| 62 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 63 |
+
|
| 64 |
+
[More Information Needed]
|
| 65 |
+
|
| 66 |
+
## Bias, Risks, and Limitations
|
| 67 |
+
|
| 68 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 69 |
+
|
| 70 |
+
[More Information Needed]
|
| 71 |
+
|
| 72 |
+
### Recommendations
|
| 73 |
+
|
| 74 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 75 |
+
|
| 76 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 77 |
+
|
| 78 |
+
## How to Get Started with the Model
|
| 79 |
+
|
| 80 |
+
Use the code below to get started with the model.
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
## Training Details
|
| 85 |
+
|
| 86 |
+
### Training Data
|
| 87 |
+
|
| 88 |
+
<!-- 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. -->
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
### Training Procedure
|
| 93 |
+
|
| 94 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 95 |
+
|
| 96 |
+
#### Preprocessing [optional]
|
| 97 |
+
|
| 98 |
+
[More Information Needed]
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
#### Training Hyperparameters
|
| 102 |
+
|
| 103 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 104 |
+
|
| 105 |
+
#### Speeds, Sizes, Times [optional]
|
| 106 |
+
|
| 107 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 108 |
+
|
| 109 |
+
[More Information Needed]
|
| 110 |
+
|
| 111 |
+
## Evaluation
|
| 112 |
+
|
| 113 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 114 |
+
|
| 115 |
+
### Testing Data, Factors & Metrics
|
| 116 |
+
|
| 117 |
+
#### Testing Data
|
| 118 |
+
|
| 119 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 120 |
+
|
| 121 |
+
[More Information Needed]
|
| 122 |
+
|
| 123 |
+
#### Factors
|
| 124 |
+
|
| 125 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 126 |
+
|
| 127 |
+
[More Information Needed]
|
| 128 |
+
|
| 129 |
+
#### Metrics
|
| 130 |
+
|
| 131 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 132 |
+
|
| 133 |
+
[More Information Needed]
|
| 134 |
+
|
| 135 |
+
### Results
|
| 136 |
+
|
| 137 |
+
[More Information Needed]
|
| 138 |
+
|
| 139 |
+
#### Summary
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
## Model Examination [optional]
|
| 144 |
+
|
| 145 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 146 |
+
|
| 147 |
+
[More Information Needed]
|
| 148 |
+
|
| 149 |
+
## Environmental Impact
|
| 150 |
+
|
| 151 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 152 |
+
|
| 153 |
+
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).
|
| 154 |
+
|
| 155 |
+
- **Hardware Type:** [More Information Needed]
|
| 156 |
+
- **Hours used:** [More Information Needed]
|
| 157 |
+
- **Cloud Provider:** [More Information Needed]
|
| 158 |
+
- **Compute Region:** [More Information Needed]
|
| 159 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 160 |
+
|
| 161 |
+
## Technical Specifications [optional]
|
| 162 |
+
|
| 163 |
+
### Model Architecture and Objective
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
### Compute Infrastructure
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
#### Hardware
|
| 172 |
+
|
| 173 |
+
[More Information Needed]
|
| 174 |
+
|
| 175 |
+
#### Software
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
## Citation [optional]
|
| 180 |
+
|
| 181 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 182 |
+
|
| 183 |
+
**BibTeX:**
|
| 184 |
+
|
| 185 |
+
[More Information Needed]
|
| 186 |
+
|
| 187 |
+
**APA:**
|
| 188 |
+
|
| 189 |
+
[More Information Needed]
|
| 190 |
+
|
| 191 |
+
## Glossary [optional]
|
| 192 |
+
|
| 193 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## More Information [optional]
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
| 200 |
+
|
| 201 |
+
## Model Card Authors [optional]
|
| 202 |
+
|
| 203 |
+
[More Information Needed]
|
| 204 |
+
|
| 205 |
+
## Model Card Contact
|
| 206 |
+
|
| 207 |
+
[More Information Needed]
|
| 208 |
+
### Framework versions
|
| 209 |
+
|
| 210 |
+
- PEFT 0.18.1
|
checkpoint-20000/adapter_config.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Gemma4ForConditionalGeneration",
|
| 7 |
+
"parent_library": "transformers.models.gemma4.modeling_gemma4",
|
| 8 |
+
"unsloth_fixed": true
|
| 9 |
+
},
|
| 10 |
+
"base_model_name_or_path": "analist/gemma4-e4b-ewe-multimodal",
|
| 11 |
+
"bias": "none",
|
| 12 |
+
"corda_config": null,
|
| 13 |
+
"ensure_weight_tying": false,
|
| 14 |
+
"eva_config": null,
|
| 15 |
+
"exclude_modules": null,
|
| 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.0,
|
| 26 |
+
"megatron_config": null,
|
| 27 |
+
"megatron_core": "megatron.core",
|
| 28 |
+
"modules_to_save": [
|
| 29 |
+
"embed_tokens",
|
| 30 |
+
"lm_head"
|
| 31 |
+
],
|
| 32 |
+
"peft_type": "LORA",
|
| 33 |
+
"peft_version": "0.18.1",
|
| 34 |
+
"qalora_group_size": 16,
|
| 35 |
+
"r": 32,
|
| 36 |
+
"rank_pattern": {},
|
| 37 |
+
"revision": null,
|
| 38 |
+
"target_modules": [
|
| 39 |
+
"v_proj",
|
| 40 |
+
"o_proj",
|
| 41 |
+
"up_proj",
|
| 42 |
+
"gate_proj",
|
| 43 |
+
"q_proj",
|
| 44 |
+
"k_proj",
|
| 45 |
+
"down_proj"
|
| 46 |
+
],
|
| 47 |
+
"target_parameters": null,
|
| 48 |
+
"task_type": "CAUSAL_LM",
|
| 49 |
+
"trainable_token_indices": null,
|
| 50 |
+
"use_dora": false,
|
| 51 |
+
"use_qalora": false,
|
| 52 |
+
"use_rslora": false
|
| 53 |
+
}
|
checkpoint-20000/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a7a567e15b98816914de06795acbbf9945e9d05960dac0d78ce4eb36c53d3ff
|
| 3 |
+
size 1859442416
|
checkpoint-20000/chat_template.jinja
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro format_parameters(properties, required) -%}
|
| 2 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 3 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 4 |
+
{%- for key, value in properties | dictsort -%}
|
| 5 |
+
{%- set add_comma = false -%}
|
| 6 |
+
{%- if key not in standard_keys -%}
|
| 7 |
+
{%- if ns.found_first %},{% endif -%}
|
| 8 |
+
{%- set ns.found_first = true -%}
|
| 9 |
+
{{ key }}:{
|
| 10 |
+
{%- if value['description'] -%}
|
| 11 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 12 |
+
{%- set add_comma = true -%}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 15 |
+
{%- if value['enum'] -%}
|
| 16 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 17 |
+
enum:{{ format_argument(value['enum']) }}
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 20 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 21 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 22 |
+
items:{
|
| 23 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 24 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 25 |
+
{%- if item_value is not none -%}
|
| 26 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 27 |
+
{%- set ns_items.found_first = true -%}
|
| 28 |
+
{%- if item_key == 'properties' -%}
|
| 29 |
+
properties:{
|
| 30 |
+
{%- if item_value is mapping -%}
|
| 31 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
}
|
| 34 |
+
{%- elif item_key == 'required' -%}
|
| 35 |
+
required:[
|
| 36 |
+
{%- for req_item in item_value -%}
|
| 37 |
+
<|"|>{{- req_item -}}<|"|>
|
| 38 |
+
{%- if not loop.last %},{% endif -%}
|
| 39 |
+
{%- endfor -%}
|
| 40 |
+
]
|
| 41 |
+
{%- elif item_key == 'type' -%}
|
| 42 |
+
{%- if item_value is string -%}
|
| 43 |
+
type:{{ format_argument(item_value | upper) }}
|
| 44 |
+
{%- else -%}
|
| 45 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 46 |
+
{%- endif -%}
|
| 47 |
+
{%- else -%}
|
| 48 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 49 |
+
{%- endif -%}
|
| 50 |
+
{%- endif -%}
|
| 51 |
+
{%- endfor -%}
|
| 52 |
+
}
|
| 53 |
+
{%- endif -%}
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- if value['nullable'] %}
|
| 56 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 57 |
+
nullable:true
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 60 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 61 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 62 |
+
properties:{
|
| 63 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 64 |
+
}
|
| 65 |
+
{%- elif value is mapping -%}
|
| 66 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 67 |
+
properties:{
|
| 68 |
+
{{- format_parameters(value, value['required'] | default([])) -}}
|
| 69 |
+
}
|
| 70 |
+
{%- endif -%}
|
| 71 |
+
{%- if value['required'] -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
required:[
|
| 74 |
+
{%- for item in value['required'] | default([]) -%}
|
| 75 |
+
<|"|>{{- item -}}<|"|>
|
| 76 |
+
{%- if not loop.last %},{% endif -%}
|
| 77 |
+
{%- endfor -%}
|
| 78 |
+
]
|
| 79 |
+
{%- endif -%}
|
| 80 |
+
{%- endif -%}
|
| 81 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 82 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 83 |
+
{%- endif -%}
|
| 84 |
+
{%- endfor -%}
|
| 85 |
+
{%- endmacro -%}
|
| 86 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 87 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 88 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 89 |
+
{%- if params -%}
|
| 90 |
+
,parameters:{
|
| 91 |
+
{%- if params['properties'] -%}
|
| 92 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- if params['required'] -%}
|
| 95 |
+
required:[
|
| 96 |
+
{%- for item in params['required'] -%}
|
| 97 |
+
<|"|>{{- item -}}<|"|>
|
| 98 |
+
{{- ',' if not loop.last -}}
|
| 99 |
+
{%- endfor -%}
|
| 100 |
+
],
|
| 101 |
+
{%- endif -%}
|
| 102 |
+
{%- if params['type'] -%}
|
| 103 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 104 |
+
{%- endif -%}
|
| 105 |
+
{%- endif -%}
|
| 106 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 107 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 108 |
+
,response:{
|
| 109 |
+
{%- if response_declaration['description'] -%}
|
| 110 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 113 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 114 |
+
{%- endif -%}
|
| 115 |
+
{%- endif -%}
|
| 116 |
+
}
|
| 117 |
+
{%- endmacro -%}
|
| 118 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 119 |
+
{%- if argument is string -%}
|
| 120 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 121 |
+
{%- elif argument is boolean -%}
|
| 122 |
+
{{- 'true' if argument else 'false' -}}
|
| 123 |
+
{%- elif argument is mapping -%}
|
| 124 |
+
{{- '{' -}}
|
| 125 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 126 |
+
{%- for key, value in argument | dictsort -%}
|
| 127 |
+
{%- if ns.found_first %},{% endif -%}
|
| 128 |
+
{%- set ns.found_first = true -%}
|
| 129 |
+
{%- if escape_keys -%}
|
| 130 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 131 |
+
{%- else -%}
|
| 132 |
+
{{- key -}}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 135 |
+
{%- endfor -%}
|
| 136 |
+
{{- '}' -}}
|
| 137 |
+
{%- elif argument is sequence -%}
|
| 138 |
+
{{- '[' -}}
|
| 139 |
+
{%- for item in argument -%}
|
| 140 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 141 |
+
{%- if not loop.last %},{% endif -%}
|
| 142 |
+
{%- endfor -%}
|
| 143 |
+
{{- ']' -}}
|
| 144 |
+
{%- else -%}
|
| 145 |
+
{{- argument -}}
|
| 146 |
+
{%- endif -%}
|
| 147 |
+
{%- endmacro -%}
|
| 148 |
+
{%- macro strip_thinking(text) -%}
|
| 149 |
+
{%- set ns = namespace(result='') -%}
|
| 150 |
+
{%- for part in text.split('<channel|>') -%}
|
| 151 |
+
{%- if '<|channel>' in part -%}
|
| 152 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 153 |
+
{%- else -%}
|
| 154 |
+
{%- set ns.result = ns.result + part -%}
|
| 155 |
+
{%- endif -%}
|
| 156 |
+
{%- endfor -%}
|
| 157 |
+
{{- ns.result | trim -}}
|
| 158 |
+
{%- endmacro -%}
|
| 159 |
+
|
| 160 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 161 |
+
{{- '<|tool_response>' -}}
|
| 162 |
+
{%- if response is mapping -%}
|
| 163 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 164 |
+
{%- for key, value in response | dictsort -%}
|
| 165 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 166 |
+
{%- if not loop.last %},{% endif -%}
|
| 167 |
+
{%- endfor -%}
|
| 168 |
+
{{- '}' -}}
|
| 169 |
+
{%- else -%}
|
| 170 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 171 |
+
{%- endif -%}
|
| 172 |
+
{{- '<tool_response|>' -}}
|
| 173 |
+
{%- endmacro -%}
|
| 174 |
+
|
| 175 |
+
{%- set ns = namespace(prev_message_type=None) -%}
|
| 176 |
+
{%- set loop_messages = messages -%}
|
| 177 |
+
{{- bos_token -}}
|
| 178 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 179 |
+
{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
|
| 180 |
+
{{- '<|turn>system\n' -}}
|
| 181 |
+
|
| 182 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 183 |
+
{%- if enable_thinking is defined and enable_thinking -%}
|
| 184 |
+
{{- '<|think|>\n' -}}
|
| 185 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 186 |
+
{%- endif -%}
|
| 187 |
+
|
| 188 |
+
{%- if messages[0]['role'] in ['system', 'developer'] -%}
|
| 189 |
+
{{- messages[0]['content'] | trim -}}
|
| 190 |
+
{%- set loop_messages = messages[1:] -%}
|
| 191 |
+
{%- endif -%}
|
| 192 |
+
|
| 193 |
+
{%- if tools -%}
|
| 194 |
+
{%- for tool in tools %}
|
| 195 |
+
{{- '<|tool>' -}}
|
| 196 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 197 |
+
{{- '<tool|>' -}}
|
| 198 |
+
{%- endfor %}
|
| 199 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 200 |
+
{%- endif -%}
|
| 201 |
+
|
| 202 |
+
{{- '<turn|>\n' -}}
|
| 203 |
+
{%- endif %}
|
| 204 |
+
|
| 205 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 206 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 207 |
+
{%- for i in range(loop_messages | length) -%}
|
| 208 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 209 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 210 |
+
{%- endif -%}
|
| 211 |
+
{%- endfor -%}
|
| 212 |
+
|
| 213 |
+
{#- Loop through messages -#}
|
| 214 |
+
{%- for message in loop_messages -%}
|
| 215 |
+
{%- if message['role'] != 'tool' -%}
|
| 216 |
+
{%- set ns.prev_message_type = None -%}
|
| 217 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 218 |
+
{#- Detect continuation: suppress duplicate <|turn>model when previous non-tool message was also assistant -#}
|
| 219 |
+
{%- set prev_nt = namespace(role=None, found=false) -%}
|
| 220 |
+
{%- if loop.index0 > 0 -%}
|
| 221 |
+
{%- for j in range(loop.index0 - 1, -1, -1) -%}
|
| 222 |
+
{%- if not prev_nt.found -%}
|
| 223 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 224 |
+
{%- set prev_nt.role = loop_messages[j]['role'] -%}
|
| 225 |
+
{%- set prev_nt.found = true -%}
|
| 226 |
+
{%- endif -%}
|
| 227 |
+
{%- endif -%}
|
| 228 |
+
{%- endfor -%}
|
| 229 |
+
{%- endif -%}
|
| 230 |
+
{%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
|
| 231 |
+
{%- if not continue_same_model_turn -%}
|
| 232 |
+
{{- '<|turn>' + role + '\n' }}
|
| 233 |
+
{%- endif -%}
|
| 234 |
+
|
| 235 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 236 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 237 |
+
{%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
|
| 238 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 239 |
+
{%- endif -%}
|
| 240 |
+
|
| 241 |
+
{%- if message['tool_calls'] -%}
|
| 242 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 243 |
+
{%- set function = tool_call['function'] -%}
|
| 244 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 245 |
+
{%- if function['arguments'] is mapping -%}
|
| 246 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 247 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 248 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 249 |
+
{%- set ns_args.found_first = true -%}
|
| 250 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 251 |
+
{%- endfor -%}
|
| 252 |
+
{%- elif function['arguments'] is string -%}
|
| 253 |
+
{{- function['arguments'] -}}
|
| 254 |
+
{%- endif -%}
|
| 255 |
+
{{- '}<tool_call|>' -}}
|
| 256 |
+
{%- endfor -%}
|
| 257 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 258 |
+
{%- endif -%}
|
| 259 |
+
|
| 260 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 261 |
+
{%- if message.get('tool_responses') -%}
|
| 262 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 263 |
+
{%- for tool_response in message['tool_responses'] -%}
|
| 264 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
|
| 265 |
+
{%- set ns_tr_out.flag = true -%}
|
| 266 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 267 |
+
{%- endfor -%}
|
| 268 |
+
{%- elif message.get('tool_calls') -%}
|
| 269 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 270 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 271 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 272 |
+
{%- if ns_tool_scan.stopped -%}
|
| 273 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 274 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 275 |
+
{%- else -%}
|
| 276 |
+
{%- set follow = loop_messages[k] -%}
|
| 277 |
+
{#- Resolve tool_call_id to function name -#}
|
| 278 |
+
{%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
|
| 279 |
+
{%- for tc in message['tool_calls'] -%}
|
| 280 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 281 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 282 |
+
{%- endif -%}
|
| 283 |
+
{%- endfor -%}
|
| 284 |
+
{#- Handle content as string or content-parts array -#}
|
| 285 |
+
{%- set tool_body = follow.get('content') -%}
|
| 286 |
+
{%- if tool_body is string -%}
|
| 287 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 288 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 289 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 290 |
+
{%- for part in tool_body -%}
|
| 291 |
+
{%- if part.get('type') == 'text' -%}
|
| 292 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 293 |
+
{%- endif -%}
|
| 294 |
+
{%- endfor -%}
|
| 295 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 296 |
+
{%- else -%}
|
| 297 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 298 |
+
{%- endif -%}
|
| 299 |
+
{%- set ns_tr_out.flag = true -%}
|
| 300 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 301 |
+
{%- endif -%}
|
| 302 |
+
{%- endfor -%}
|
| 303 |
+
{%- endif -%}
|
| 304 |
+
|
| 305 |
+
{%- if message['content'] is string -%}
|
| 306 |
+
{%- if role == 'model' -%}
|
| 307 |
+
{{- strip_thinking(message['content']) -}}
|
| 308 |
+
{%- else -%}
|
| 309 |
+
{{- message['content'] | trim -}}
|
| 310 |
+
{%- endif -%}
|
| 311 |
+
{%- elif message['content'] is sequence -%}
|
| 312 |
+
{%- for item in message['content'] -%}
|
| 313 |
+
{%- if item['type'] == 'text' -%}
|
| 314 |
+
{%- if role == 'model' -%}
|
| 315 |
+
{{- strip_thinking(item['text']) -}}
|
| 316 |
+
{%- else -%}
|
| 317 |
+
{{- item['text'] | trim -}}
|
| 318 |
+
{%- endif -%}
|
| 319 |
+
{%- elif item['type'] == 'image' -%}
|
| 320 |
+
{{- '<|image|>' -}}
|
| 321 |
+
{%- set ns.prev_message_type = 'image' -%}
|
| 322 |
+
{%- elif item['type'] == 'audio' -%}
|
| 323 |
+
{{- '<|audio|>' -}}
|
| 324 |
+
{%- set ns.prev_message_type = 'audio' -%}
|
| 325 |
+
{%- elif item['type'] == 'video' -%}
|
| 326 |
+
{{- '<|video|>' -}}
|
| 327 |
+
{%- set ns.prev_message_type = 'video' -%}
|
| 328 |
+
{%- endif -%}
|
| 329 |
+
{%- endfor -%}
|
| 330 |
+
{%- endif -%}
|
| 331 |
+
|
| 332 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 333 |
+
{{- '<|tool_response>' -}}
|
| 334 |
+
{%- elif not (ns_tr_out.flag and not message.get('content')) -%}
|
| 335 |
+
{{- '<turn|>\n' -}}
|
| 336 |
+
{%- endif -%}
|
| 337 |
+
{%- endif -%}
|
| 338 |
+
{%- endfor -%}
|
| 339 |
+
|
| 340 |
+
{%- if add_generation_prompt -%}
|
| 341 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 342 |
+
{{- '<|turn>model\n' -}}
|
| 343 |
+
{%- endif -%}
|
| 344 |
+
{%- endif -%}
|
checkpoint-20000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da4e2c08fc7a0187cfb4700de718ad6c24e48a009adbeb0dd502990962db5b47
|
| 3 |
+
size 4138731987
|
checkpoint-20000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a00842913204b6532c324527f2d171cb21a96f210d7d7df85a5df3165a112da6
|
| 3 |
+
size 14645
|
checkpoint-20000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6ec29604e8ff17e78e73df8fc8c219f7896ee4f02c5cbb73a6928e04e9fb86e
|
| 3 |
+
size 1465
|
checkpoint-20000/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec21dc3f868a3a8c7b9f0ff883cb6222f67fbe11df3121534e828ce1dd811306
|
| 3 |
+
size 32170149
|
checkpoint-20000/tokenizer_config.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": "<turn|>",
|
| 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 |
+
"<think>",
|
| 18 |
+
"</think>"
|
| 19 |
+
],
|
| 20 |
+
"image_token": "<|image|>",
|
| 21 |
+
"is_local": false,
|
| 22 |
+
"mask_token": "<mask>",
|
| 23 |
+
"max_length": null,
|
| 24 |
+
"model_max_length": 131072,
|
| 25 |
+
"model_specific_special_tokens": {
|
| 26 |
+
"audio_token": "<|audio|>",
|
| 27 |
+
"boa_token": "<|audio>",
|
| 28 |
+
"boi_token": "<|image>",
|
| 29 |
+
"eoa_token": "<audio|>",
|
| 30 |
+
"eoc_token": "<channel|>",
|
| 31 |
+
"eoi_token": "<image|>",
|
| 32 |
+
"eot_token": "<turn|>",
|
| 33 |
+
"escape_token": "<|\"|>",
|
| 34 |
+
"etc_token": "<tool_call|>",
|
| 35 |
+
"etd_token": "<tool|>",
|
| 36 |
+
"etr_token": "<tool_response|>",
|
| 37 |
+
"image_token": "<|image|>",
|
| 38 |
+
"soc_token": "<|channel>",
|
| 39 |
+
"sot_token": "<|turn>",
|
| 40 |
+
"stc_token": "<|tool_call>",
|
| 41 |
+
"std_token": "<|tool>",
|
| 42 |
+
"str_token": "<|tool_response>",
|
| 43 |
+
"think_token": "<|think|>"
|
| 44 |
+
},
|
| 45 |
+
"pad_to_multiple_of": null,
|
| 46 |
+
"pad_token": "<pad>",
|
| 47 |
+
"pad_token_type_id": 0,
|
| 48 |
+
"padding_side": "right",
|
| 49 |
+
"processor_class": "Gemma4Processor",
|
| 50 |
+
"response_schema": {
|
| 51 |
+
"properties": {
|
| 52 |
+
"content": {
|
| 53 |
+
"type": "string"
|
| 54 |
+
},
|
| 55 |
+
"role": {
|
| 56 |
+
"const": "assistant"
|
| 57 |
+
},
|
| 58 |
+
"thinking": {
|
| 59 |
+
"type": "string"
|
| 60 |
+
},
|
| 61 |
+
"tool_calls": {
|
| 62 |
+
"items": {
|
| 63 |
+
"properties": {
|
| 64 |
+
"function": {
|
| 65 |
+
"properties": {
|
| 66 |
+
"arguments": {
|
| 67 |
+
"additionalProperties": {},
|
| 68 |
+
"type": "object",
|
| 69 |
+
"x-parser": "gemma4-tool-call"
|
| 70 |
+
},
|
| 71 |
+
"name": {
|
| 72 |
+
"type": "string"
|
| 73 |
+
}
|
| 74 |
+
},
|
| 75 |
+
"type": "object",
|
| 76 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 77 |
+
},
|
| 78 |
+
"type": {
|
| 79 |
+
"const": "function"
|
| 80 |
+
}
|
| 81 |
+
},
|
| 82 |
+
"type": "object"
|
| 83 |
+
},
|
| 84 |
+
"type": "array",
|
| 85 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"type": "object",
|
| 89 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 90 |
+
},
|
| 91 |
+
"soc_token": "<|channel>",
|
| 92 |
+
"sot_token": "<|turn>",
|
| 93 |
+
"stc_token": "<|tool_call>",
|
| 94 |
+
"std_token": "<|tool>",
|
| 95 |
+
"str_token": "<|tool_response>",
|
| 96 |
+
"think_token": "<|think|>",
|
| 97 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 98 |
+
"unk_token": "<unk>"
|
| 99 |
+
}
|
checkpoint-20000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
checkpoint-20000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a6590210e831f25bc0ee97238fb4b1782738727f5cded3bfdad71abbf244297
|
| 3 |
+
size 5585
|