Training in progress, step 30
Browse files- .gitattributes +1 -0
- README.md +58 -0
- adapter_config.json +49 -0
- adapter_model.safetensors +3 -0
- added_tokens.json +4 -0
- chat_template.jinja +279 -0
- special_tokens_map.json +34 -0
- tokenizer.json +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: google/functiongemma-270m-it
|
| 3 |
+
library_name: transformers
|
| 4 |
+
model_name: function-gemma
|
| 5 |
+
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- trl
|
| 8 |
+
- sft
|
| 9 |
+
licence: license
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Model Card for function-gemma
|
| 13 |
+
|
| 14 |
+
This model is a fine-tuned version of [google/functiongemma-270m-it](https://huggingface.co/google/functiongemma-270m-it).
|
| 15 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 16 |
+
|
| 17 |
+
## Quick start
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from transformers import pipeline
|
| 21 |
+
|
| 22 |
+
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?"
|
| 23 |
+
generator = pipeline("text-generation", model="WalisonCruz/function-gemma", device="cuda")
|
| 24 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 25 |
+
print(output["generated_text"])
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Training procedure
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
This model was trained with SFT.
|
| 34 |
+
|
| 35 |
+
### Framework versions
|
| 36 |
+
|
| 37 |
+
- TRL: 0.26.2
|
| 38 |
+
- Transformers: 4.57.3
|
| 39 |
+
- Pytorch: 2.9.0+cu126
|
| 40 |
+
- Datasets: 4.0.0
|
| 41 |
+
- Tokenizers: 0.22.1
|
| 42 |
+
|
| 43 |
+
## Citations
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
Cite TRL as:
|
| 48 |
+
|
| 49 |
+
```bibtex
|
| 50 |
+
@misc{vonwerra2022trl,
|
| 51 |
+
title = {{TRL: Transformer Reinforcement Learning}},
|
| 52 |
+
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},
|
| 53 |
+
year = 2020,
|
| 54 |
+
journal = {GitHub repository},
|
| 55 |
+
publisher = {GitHub},
|
| 56 |
+
howpublished = {\url{https://github.com/huggingface/trl}}
|
| 57 |
+
}
|
| 58 |
+
```
|
adapter_config.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Gemma3ForCausalLM",
|
| 7 |
+
"parent_library": "transformers.models.gemma3.modeling_gemma3"
|
| 8 |
+
},
|
| 9 |
+
"base_model_name_or_path": "google/functiongemma-270m-it",
|
| 10 |
+
"bias": "none",
|
| 11 |
+
"corda_config": null,
|
| 12 |
+
"ensure_weight_tying": false,
|
| 13 |
+
"eva_config": null,
|
| 14 |
+
"exclude_modules": null,
|
| 15 |
+
"fan_in_fan_out": false,
|
| 16 |
+
"inference_mode": true,
|
| 17 |
+
"init_lora_weights": true,
|
| 18 |
+
"layer_replication": null,
|
| 19 |
+
"layers_pattern": null,
|
| 20 |
+
"layers_to_transform": null,
|
| 21 |
+
"loftq_config": {},
|
| 22 |
+
"lora_alpha": 32,
|
| 23 |
+
"lora_bias": false,
|
| 24 |
+
"lora_dropout": 0.0,
|
| 25 |
+
"megatron_config": null,
|
| 26 |
+
"megatron_core": "megatron.core",
|
| 27 |
+
"modules_to_save": null,
|
| 28 |
+
"peft_type": "LORA",
|
| 29 |
+
"peft_version": "0.18.0",
|
| 30 |
+
"qalora_group_size": 16,
|
| 31 |
+
"r": 32,
|
| 32 |
+
"rank_pattern": {},
|
| 33 |
+
"revision": null,
|
| 34 |
+
"target_modules": [
|
| 35 |
+
"o_proj",
|
| 36 |
+
"gate_proj",
|
| 37 |
+
"v_proj",
|
| 38 |
+
"q_proj",
|
| 39 |
+
"down_proj",
|
| 40 |
+
"k_proj",
|
| 41 |
+
"up_proj"
|
| 42 |
+
],
|
| 43 |
+
"target_parameters": null,
|
| 44 |
+
"task_type": null,
|
| 45 |
+
"trainable_token_indices": null,
|
| 46 |
+
"use_dora": false,
|
| 47 |
+
"use_qalora": false,
|
| 48 |
+
"use_rslora": false
|
| 49 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:50ad029305a187a453faa502e9af6947899bfbd9130092201972607fa58c30d5
|
| 3 |
+
size 15221224
|
added_tokens.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<end_of_image>": 262145,
|
| 3 |
+
"<image_soft_token>": 262144
|
| 4 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
{%- if key not in standard_keys -%}
|
| 6 |
+
{%- if ns.found_first %},{% endif -%}
|
| 7 |
+
{%- set ns.found_first = true -%}
|
| 8 |
+
{{- key }}:{description:<escape>{{ value['description'] }}<escape>
|
| 9 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 10 |
+
{%- if value['enum'] -%}
|
| 11 |
+
,enum:{{ format_argument(value['enum']) }}
|
| 12 |
+
{%- endif -%}
|
| 13 |
+
{%- elif value['type'] | upper == 'OBJECT' -%}
|
| 14 |
+
,properties:{
|
| 15 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 16 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 17 |
+
{%- elif value is mapping -%}
|
| 18 |
+
{{- format_parameters(value, value['required'] | default([])) -}}
|
| 19 |
+
{%- endif -%}
|
| 20 |
+
}
|
| 21 |
+
{%- if value['required'] -%}
|
| 22 |
+
,required:[
|
| 23 |
+
{%- for item in value['required'] | default([]) -%}
|
| 24 |
+
<escape>{{- item -}}<escape>
|
| 25 |
+
{%- if not loop.last %},{% endif -%}
|
| 26 |
+
{%- endfor -%}
|
| 27 |
+
]
|
| 28 |
+
{%- endif -%}
|
| 29 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 30 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 31 |
+
,items:{
|
| 32 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 33 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 34 |
+
{%- if item_value is not none -%}
|
| 35 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 36 |
+
{%- set ns_items.found_first = true -%}
|
| 37 |
+
{%- if item_key == 'properties' -%}
|
| 38 |
+
properties:{
|
| 39 |
+
{%- if item_value is mapping -%}
|
| 40 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 41 |
+
{%- endif -%}
|
| 42 |
+
}
|
| 43 |
+
{%- elif item_key == 'required' -%}
|
| 44 |
+
required:[
|
| 45 |
+
{%- for req_item in item_value -%}
|
| 46 |
+
<escape>{{- req_item -}}<escape>
|
| 47 |
+
{%- if not loop.last %},{% endif -%}
|
| 48 |
+
{%- endfor -%}
|
| 49 |
+
]
|
| 50 |
+
{%- elif item_key == 'type' -%}
|
| 51 |
+
{%- if item_value is string -%}
|
| 52 |
+
type:{{ format_argument(item_value | upper) }}
|
| 53 |
+
{%- else -%}
|
| 54 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 55 |
+
{%- endif -%}
|
| 56 |
+
{%- else -%}
|
| 57 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{%- endfor -%}
|
| 61 |
+
}
|
| 62 |
+
{%- endif -%}
|
| 63 |
+
{%- endif -%}
|
| 64 |
+
,type:<escape>{{ value['type'] | upper }}<escape>}
|
| 65 |
+
{%- endif -%}
|
| 66 |
+
{%- endfor -%}
|
| 67 |
+
{%- endmacro -%}
|
| 68 |
+
{% macro format_function_declaration(tool_data) -%}
|
| 69 |
+
declaration:{{- tool_data['function']['name'] -}}
|
| 70 |
+
{description:<escape>{{- tool_data['function']['description'] -}}<escape>
|
| 71 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 72 |
+
{%- if params -%}
|
| 73 |
+
,parameters:{
|
| 74 |
+
{%- if params['properties'] -%}
|
| 75 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 76 |
+
{%- endif -%}
|
| 77 |
+
{%- if params['required'] -%}
|
| 78 |
+
required:[
|
| 79 |
+
{%- for item in params['required'] -%}
|
| 80 |
+
<escape>{{- item -}}<escape>
|
| 81 |
+
{{- ',' if not loop.last -}}
|
| 82 |
+
{%- endfor -%}
|
| 83 |
+
],
|
| 84 |
+
{%- endif -%}
|
| 85 |
+
{%- if params['type'] -%}
|
| 86 |
+
type:<escape>{{- params['type'] | upper -}}<escape>}
|
| 87 |
+
{%- endif -%}
|
| 88 |
+
{%- endif -%}
|
| 89 |
+
}
|
| 90 |
+
{%- endmacro -%}
|
| 91 |
+
{% macro format_argument(argument, escape_keys=True) -%}
|
| 92 |
+
{%- if argument is string -%}
|
| 93 |
+
{{- '<escape>' + argument + '<escape>' -}}
|
| 94 |
+
{%- elif argument is boolean -%}
|
| 95 |
+
{%- if argument -%}
|
| 96 |
+
{{- 'true' -}}
|
| 97 |
+
{%- else -%}
|
| 98 |
+
{{- 'false' -}}
|
| 99 |
+
{%- endif -%}
|
| 100 |
+
{%- elif argument is mapping -%}
|
| 101 |
+
{{- '{' -}}
|
| 102 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 103 |
+
{%- for key, value in argument | dictsort -%}
|
| 104 |
+
{%- if ns.found_first %},{% endif -%}
|
| 105 |
+
{%- set ns.found_first = true -%}
|
| 106 |
+
{%- if escape_keys -%}
|
| 107 |
+
{{- '<escape>' + key + '<escape>' -}}
|
| 108 |
+
{%- else -%}
|
| 109 |
+
{{- key -}}
|
| 110 |
+
{%- endif -%}
|
| 111 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 112 |
+
{%- endfor -%}
|
| 113 |
+
{{- '}' -}}
|
| 114 |
+
{%- elif argument is sequence -%}
|
| 115 |
+
{{- '[' -}}
|
| 116 |
+
{%- for item in argument -%}
|
| 117 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 118 |
+
{%- if not loop.last %},{% endif -%}
|
| 119 |
+
{%- endfor -%}
|
| 120 |
+
{{- ']' -}}
|
| 121 |
+
{%- else -%}
|
| 122 |
+
{{- argument -}}
|
| 123 |
+
{%- endif -%}
|
| 124 |
+
{%- endmacro -%}
|
| 125 |
+
{{ bos_token }}
|
| 126 |
+
{%- set ns = namespace(prev_message_type=None) -%}
|
| 127 |
+
{#- Tool Declarations -#}
|
| 128 |
+
{%- set loop_messages = messages -%}
|
| 129 |
+
{%- if tools or messages[0]['role'] == 'system' or messages[0]['role'] == 'developer' -%}
|
| 130 |
+
{{- '<start_of_turn>developer\n' -}}
|
| 131 |
+
{%- if messages[0]['role'] == 'system' or messages[0]['role'] == 'developer' -%}
|
| 132 |
+
{%- if messages[0]['content'] is string -%}
|
| 133 |
+
{{- messages[0]['content'] | trim -}}
|
| 134 |
+
{%- elif messages[0]['content'] is sequence -%}
|
| 135 |
+
{%- for item in messages[0]['content'] -%}
|
| 136 |
+
{%- if item['type'] == 'text' -%}
|
| 137 |
+
{{- item['text'] | trim -}}
|
| 138 |
+
{%- endif -%}
|
| 139 |
+
{%- endfor -%}
|
| 140 |
+
{%- endif -%}
|
| 141 |
+
{%- set loop_messages = messages[1:] -%}
|
| 142 |
+
{%- endif -%}
|
| 143 |
+
{%- if tools -%}
|
| 144 |
+
{%- for tool in tools %}
|
| 145 |
+
{{- '<start_function_declaration>' -}}
|
| 146 |
+
{{- format_function_declaration(tool) | trim }}
|
| 147 |
+
{{- '<end_function_declaration>' -}}
|
| 148 |
+
{%- endfor %}
|
| 149 |
+
{%- endif -%}
|
| 150 |
+
{{- '<end_of_turn>\n' }}
|
| 151 |
+
{%- endif %}
|
| 152 |
+
{#- Loop through messages. -#}
|
| 153 |
+
{%- for message in loop_messages -%}
|
| 154 |
+
{%- if (message['role'] == 'assistant') -%}
|
| 155 |
+
{#- Rename "assistant" to "model". -#}
|
| 156 |
+
{%- set role = "model" -%}
|
| 157 |
+
{%- else -%}
|
| 158 |
+
{%- set role = message['role'] -%}
|
| 159 |
+
{%- endif -%}
|
| 160 |
+
{%- if role != 'tool' -%}
|
| 161 |
+
{%- if ns.prev_message_type != 'tool_response' -%}
|
| 162 |
+
{{- '<start_of_turn>' + role + '\n' }}
|
| 163 |
+
{%- endif -%}
|
| 164 |
+
{%- set ns.prev_message_type = None -%}
|
| 165 |
+
{%- if 'content' in message and message['content'] is not none -%}
|
| 166 |
+
{%- if message['content'] is string -%}
|
| 167 |
+
{{ message['content'] | trim }}
|
| 168 |
+
{%- elif message['content'] is sequence -%}
|
| 169 |
+
{%- for item in message['content'] -%}
|
| 170 |
+
{%- if item['type'] == 'image' -%}
|
| 171 |
+
{{ '<start_of_image>' }}
|
| 172 |
+
{%- elif item['type'] == 'text' -%}
|
| 173 |
+
{{ item['text'] | trim }}
|
| 174 |
+
{%- endif -%}
|
| 175 |
+
{%- endfor -%}
|
| 176 |
+
{%- else -%}
|
| 177 |
+
{{ raise_exception("Invalid content type in user/assistant message") }}
|
| 178 |
+
{%- endif -%}
|
| 179 |
+
{%- set ns.prev_message_type = 'content' -%}
|
| 180 |
+
{%- endif -%}
|
| 181 |
+
{%- if 'tool_calls' in message and message['tool_calls'] and message['tool_calls'] is iterable -%}
|
| 182 |
+
{#- Tool Calls -#}
|
| 183 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 184 |
+
{% set function = tool_call['function'] %}
|
| 185 |
+
{{- '<start_function_call>call:' + function['name'] + '{' -}}
|
| 186 |
+
{%- if 'arguments' in function -%}
|
| 187 |
+
{%- if function['arguments'] is mapping -%}
|
| 188 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 189 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 190 |
+
{%- if ns.found_first %},{% endif -%}
|
| 191 |
+
{%- set ns.found_first = true -%}
|
| 192 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 193 |
+
{%- endfor -%}
|
| 194 |
+
{%- elif function['arguments'] is string -%}
|
| 195 |
+
{# This handles string-JSON, just in case #}
|
| 196 |
+
{{ function['arguments'] }}
|
| 197 |
+
{%- endif %}
|
| 198 |
+
{%- endif -%}
|
| 199 |
+
{{- '}<end_function_call>' -}}
|
| 200 |
+
{%- endfor -%}
|
| 201 |
+
{%- if loop.last -%}
|
| 202 |
+
{{ '<start_function_response>' }}
|
| 203 |
+
{%- endif -%}
|
| 204 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 205 |
+
{%- endif -%}
|
| 206 |
+
{%- else -%}
|
| 207 |
+
{#- Tool Responses -#}
|
| 208 |
+
{%- if 'content' in message and message['content'] -%}
|
| 209 |
+
{%- if message['content'] is mapping -%}
|
| 210 |
+
{%- if 'name' in message['content'] and 'response' in message['content'] -%}
|
| 211 |
+
{{ '<start_function_response>response:' + message['content']['name'] | trim + '{' }}
|
| 212 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 213 |
+
{%- for key, value in message['content']['response'] | dictsort -%}
|
| 214 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 215 |
+
{%- set response_ns.found_first = true -%}
|
| 216 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 217 |
+
{%- endfor -%}
|
| 218 |
+
{{- '}<end_function_response>' -}}
|
| 219 |
+
{%- elif 'name' in message -%}
|
| 220 |
+
{{ '<start_function_response>response:' + message['name'] | trim + '{' }}
|
| 221 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 222 |
+
{%- for key, value in message['content'] | dictsort -%}
|
| 223 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 224 |
+
{%- set response_ns.found_first = true -%}
|
| 225 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 226 |
+
{%- endfor -%}
|
| 227 |
+
{{- '}<end_function_response>' -}}
|
| 228 |
+
{%- else -%}
|
| 229 |
+
{{ raise_exception("Invalid tool response mapping: must contain 'name' and 'response' keys, or 'name' must be in the message.") }}
|
| 230 |
+
{%- endif -%}
|
| 231 |
+
{%- elif message['content'] is string -%}
|
| 232 |
+
{%- if 'name' in message -%}
|
| 233 |
+
{{ '<start_function_response>response:' + message['name'] | trim + '{value:' + format_argument(message['content'], escape_keys=False) + '}<end_function_response>' }}
|
| 234 |
+
{%- else -%}
|
| 235 |
+
{{ raise_exception("Invalid tool response: 'name' must be provided.") }}
|
| 236 |
+
{%- endif -%}
|
| 237 |
+
{%- elif message['content'] is sequence -%}
|
| 238 |
+
{%- for item in message['content'] -%}
|
| 239 |
+
{%- if item is mapping -%}
|
| 240 |
+
{%- if 'name' in item and 'response' in item -%}
|
| 241 |
+
{{ '<start_function_response>response:' + item['name'] | trim + '{' }}
|
| 242 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 243 |
+
{%- for key, value in item['response'] | dictsort -%}
|
| 244 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 245 |
+
{%- set response_ns.found_first = true -%}
|
| 246 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 247 |
+
{%- endfor -%}
|
| 248 |
+
{{- '}<end_function_response>' -}}
|
| 249 |
+
{%- elif 'name' in message -%}
|
| 250 |
+
{{ '<start_function_response>response:' + message['name'] | trim + '{' }}
|
| 251 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 252 |
+
{%- for key, value in item | dictsort -%}
|
| 253 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 254 |
+
{%- set response_ns.found_first = true -%}
|
| 255 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 256 |
+
{%- endfor -%}
|
| 257 |
+
{{- '}<end_function_response>' -}}
|
| 258 |
+
{%- else -%}
|
| 259 |
+
{{ raise_exception("Invalid tool response mapping: must contain 'name' and 'response' keys, or 'name' must be in the message.") }}
|
| 260 |
+
{%- endif -%}
|
| 261 |
+
{%- else -%}
|
| 262 |
+
{{ raise_exception("Invalid tool response message: multiple responses must all be mappings") }}
|
| 263 |
+
{%- endif -%}
|
| 264 |
+
{%- endfor -%}
|
| 265 |
+
{%- else -%}
|
| 266 |
+
{{ raise_exception("Invalid content type in tool message: must be mapping, sequence of mappings, or string.") }}
|
| 267 |
+
{%- endif -%}
|
| 268 |
+
{%- endif -%}
|
| 269 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 270 |
+
{%- endif -%}
|
| 271 |
+
{%- if ns.prev_message_type not in ['tool_call', 'tool_response'] -%}
|
| 272 |
+
{{ '<end_of_turn>\n' }}
|
| 273 |
+
{%- endif -%}
|
| 274 |
+
{%- endfor -%}
|
| 275 |
+
{%- if add_generation_prompt -%}
|
| 276 |
+
{%- if ns.prev_message_type != 'tool_response' -%}
|
| 277 |
+
{{- '<start_of_turn>model\n' -}}
|
| 278 |
+
{%- endif -%}
|
| 279 |
+
{%- endif -%}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"boi_token": "<start_of_image>",
|
| 3 |
+
"bos_token": {
|
| 4 |
+
"content": "<bos>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false
|
| 9 |
+
},
|
| 10 |
+
"eoi_token": "<end_of_image>",
|
| 11 |
+
"eos_token": {
|
| 12 |
+
"content": "<eos>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false
|
| 17 |
+
},
|
| 18 |
+
"image_token": "<image_soft_token>",
|
| 19 |
+
"pad_token": {
|
| 20 |
+
"content": "<pad>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false
|
| 25 |
+
},
|
| 26 |
+
"sfr_token": "<start_function_response>",
|
| 27 |
+
"unk_token": {
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false
|
| 33 |
+
}
|
| 34 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b6b09a0b4a803ad453063ca4bb49a784540e8120004e2450e025df2b27d41fb2
|
| 3 |
+
size 33384899
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa009fcbc3589a9904d30d04834094fea4653c2ac6d2de2cd1262d4f7a50ceb3
|
| 3 |
+
size 4689144
|
tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2160ee788f7154f21fb81b3d00d2d1a454e281b433b8b363233da432a5f7b795
|
| 3 |
+
size 6225
|