Upload model
Browse files- .gitattributes +11 -0
- Home-FunctionGemma-270m.bf16.gguf +3 -0
- Home-FunctionGemma-270m.iq4_nl.gguf +3 -0
- Home-FunctionGemma-270m.iq4_xs.gguf +3 -0
- Home-FunctionGemma-270m.q3_k_m.gguf +3 -0
- Home-FunctionGemma-270m.q4_0.gguf +3 -0
- Home-FunctionGemma-270m.q4_1.gguf +3 -0
- Home-FunctionGemma-270m.q5_k_m.gguf +3 -0
- Home-FunctionGemma-270m.q6_k.gguf +3 -0
- Home-FunctionGemma-270m.q8_0.gguf +3 -0
- README.md +46 -0
- added_tokens.json +4 -0
- chat_template.jinja +290 -0
- config.json +54 -0
- generation_config.json +14 -0
- imatrix.gguf +3 -0
- model.safetensors +3 -0
- special_tokens_map.json +34 -0
- tokenizer.json +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,14 @@ 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 |
+
Home-FunctionGemma-270m.bf16.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
Home-FunctionGemma-270m.iq4_nl.gguf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
Home-FunctionGemma-270m.iq4_xs.gguf filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
Home-FunctionGemma-270m.q3_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
Home-FunctionGemma-270m.q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
Home-FunctionGemma-270m.q4_1.gguf filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
Home-FunctionGemma-270m.q5_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
Home-FunctionGemma-270m.q6_k.gguf filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
Home-FunctionGemma-270m.q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
imatrix.gguf filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
Home-FunctionGemma-270m.bf16.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f63c1fb04bbbb61f96ef28034f50f71aa73502c9f25c6ada8c20fc29d947b18a
|
| 3 |
+
size 542850976
|
Home-FunctionGemma-270m.iq4_nl.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8fdb90a4c5c46b62565b53a30bc95d1fc49db24d806c6e5d8e42a82ed0232d9b
|
| 3 |
+
size 241978368
|
Home-FunctionGemma-270m.iq4_xs.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ed852cbd2f59d3cc8e9504676f706cab38d84edbdf9d1207817f4d9400876aa0
|
| 3 |
+
size 240872448
|
Home-FunctionGemma-270m.q3_k_m.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd98a0d77a314ea7b1438604abd9cd2dc234aaf37964b93c81faf2658fc62c37
|
| 3 |
+
size 241978368
|
Home-FunctionGemma-270m.q4_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b18fef2295452485e911ecf49ee8540d72dbb60b5e4ae4d22dc022b5c6e4eb91
|
| 3 |
+
size 241589248
|
Home-FunctionGemma-270m.q4_1.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd438407782fe3f02f07b4d8c4ade17ab282820edb3144358b1dc38f3979fde4
|
| 3 |
+
size 247692288
|
Home-FunctionGemma-270m.q5_k_m.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5a878803b2ca0fb03b03833481a021688fc55d11b57c36e781966e38bb15719
|
| 3 |
+
size 260041728
|
Home-FunctionGemma-270m.q6_k.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f55412e96e914bb284fd62cf9a05c32920256eea3cc12d6ee7064f56ad80116
|
| 3 |
+
size 282989568
|
Home-FunctionGemma-270m.q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a07d6d29e28508782d6d6bff871fe8240a98e371af0951573b737683706ed2fc
|
| 3 |
+
size 291560448
|
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: google/functiongemma-270m-it
|
| 4 |
+
datasets:
|
| 5 |
+
- acon96/Home-Assistant-Requests-V2
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
- de
|
| 9 |
+
- es
|
| 10 |
+
- fr
|
| 11 |
+
tags:
|
| 12 |
+
- automation
|
| 13 |
+
- home
|
| 14 |
+
- assistant
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
# Home-FunctionGemma-270m
|
| 18 |
+
The "Home" model is a fine tuning of the FunctionGemma model from Google. The model is able to control devices in the user's house via the "Assist" API, as well as perform basic question answering about the provided home's state.
|
| 19 |
+
|
| 20 |
+
The model is quantized using Lama.cpp in order to enable running the model in super low resource environments that are common with Home Assistant installations such as Rapsberry Pis.
|
| 21 |
+
|
| 22 |
+
## Training
|
| 23 |
+
[<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/axolotl-ai-cloud/axolotl)
|
| 24 |
+
|
| 25 |
+
### Datasets
|
| 26 |
+
Home Assistant Requests V2 - https://huggingface.co/datasets/acon96/Home-Assistant-Requests-V2
|
| 27 |
+
|
| 28 |
+
### Training hyperparameters
|
| 29 |
+
The following hyperparameters were used during training:
|
| 30 |
+
- learning_rate: 0.0002
|
| 31 |
+
- train_batch_size: 1
|
| 32 |
+
- eval_batch_size: 1
|
| 33 |
+
- seed: 42
|
| 34 |
+
- distributed_type: multi-GPU
|
| 35 |
+
- num_devices: 2
|
| 36 |
+
- gradient_accumulation_steps: 16
|
| 37 |
+
- total_train_batch_size: 32
|
| 38 |
+
- total_eval_batch_size: 2
|
| 39 |
+
- optimizer: Use OptimizerNames.ADAMW_BNB with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 40 |
+
- lr_scheduler_type: cosine
|
| 41 |
+
- lr_scheduler_warmup_steps: 59
|
| 42 |
+
- training_steps: 597
|
| 43 |
+
|
| 44 |
+
## License
|
| 45 |
+
The model is licensed under the Gemma license as it is a fine-tuning of the FunctionGemma model.
|
| 46 |
+
|
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,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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'].items() -%}
|
| 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.items() -%}
|
| 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 iterable -%}
|
| 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 |
+
{#- extract system prompt for merging with user role -#}
|
| 128 |
+
{%- set loop_messages = messages -%}
|
| 129 |
+
{%- set system_message_content = '' %}
|
| 130 |
+
{%- if messages[0]['role'] == 'system' or messages[0]['role'] == 'developer' -%}
|
| 131 |
+
{%- set system_message_content = messages[0]['content'] -%}
|
| 132 |
+
{%- set loop_messages = messages[1:] -%}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
{#- 'static' system prompt. -#}
|
| 135 |
+
{%- if tools -%}
|
| 136 |
+
{{- '<start_of_turn>developer\nYou are a model that can do function calling with the following functions' -}}
|
| 137 |
+
{%- for tool in tools %}
|
| 138 |
+
{{- '<start_function_declaration>' -}}
|
| 139 |
+
{{- format_function_declaration(tool) | trim }}
|
| 140 |
+
{{- '<end_function_declaration>' -}}
|
| 141 |
+
{%- endfor %}
|
| 142 |
+
{{- '<end_of_turn>\n' -}}
|
| 143 |
+
{%- else -%}
|
| 144 |
+
{{- '<start_of_turn>developer\nNo tools have been provided. Only respond with answers that do not require tool usage.<end_of_turn>\n' -}}
|
| 145 |
+
{%- endif -%}
|
| 146 |
+
{#- Loop through messages. -#}
|
| 147 |
+
{%- for message in loop_messages -%}
|
| 148 |
+
{%- if (message['role'] == 'assistant') -%}
|
| 149 |
+
{#- Rename "assistant" to "model". -#}
|
| 150 |
+
{%- set role = "model" -%}
|
| 151 |
+
{%- else -%}
|
| 152 |
+
{%- set role = message['role'] -%}
|
| 153 |
+
{%- endif -%}
|
| 154 |
+
{%- if role != 'tool' -%}
|
| 155 |
+
{%- if ns.prev_message_type != 'tool_response' -%}
|
| 156 |
+
{{- '<start_of_turn>' + role + '\n' }}
|
| 157 |
+
{%- endif -%}
|
| 158 |
+
{%- set ns.prev_message_type = None -%}
|
| 159 |
+
{%- if loop.first and system_message_content -%}
|
| 160 |
+
{%- if system_message_content is string -%}
|
| 161 |
+
{{ system_message_content | trim }}
|
| 162 |
+
{%- elif system_message_content is iterable -%}
|
| 163 |
+
{%- for item in system_message_content -%}
|
| 164 |
+
{%- if item['type'] == 'image' -%}
|
| 165 |
+
{{ raise_exception("Invalid content type 'image' in system message") }}
|
| 166 |
+
{%- elif item['type'] == 'text' -%}
|
| 167 |
+
{{ item['text'] | trim }}
|
| 168 |
+
{%- endif -%}
|
| 169 |
+
{%- endfor -%}
|
| 170 |
+
{%- else -%}
|
| 171 |
+
{{ raise_exception("Invalid content type in system message") }}
|
| 172 |
+
{%- endif -%}
|
| 173 |
+
{{- '\n' -}}
|
| 174 |
+
{%- endif -%}
|
| 175 |
+
{#- User/Assistant Messages -#}
|
| 176 |
+
{%- if 'content' in message and message['content'] is not none -%}
|
| 177 |
+
{%- if message['content'] is string -%}
|
| 178 |
+
{{ message['content'] | trim }}
|
| 179 |
+
{%- elif message['content'] is iterable -%}
|
| 180 |
+
{%- for item in message['content'] -%}
|
| 181 |
+
{%- if item['type'] == 'image' -%}
|
| 182 |
+
{{ '<start_of_image>' }}
|
| 183 |
+
{%- elif item['type'] == 'text' -%}
|
| 184 |
+
{{ item['text'] | trim }}
|
| 185 |
+
{%- endif -%}
|
| 186 |
+
{%- endfor -%}
|
| 187 |
+
{%- else -%}
|
| 188 |
+
{{ raise_exception("Invalid content type in user/assistant message") }}
|
| 189 |
+
{%- endif -%}
|
| 190 |
+
{%- set ns.prev_message_type = 'content' -%}
|
| 191 |
+
{%- endif -%}
|
| 192 |
+
{%- if 'tool_calls' in message and message['tool_calls'] and message['tool_calls'] is iterable -%}
|
| 193 |
+
{#- Tool Calls -#}
|
| 194 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 195 |
+
{% set function = tool_call['function'] %}
|
| 196 |
+
{{- '<start_function_call>call:' + function['name'] + '{' -}}
|
| 197 |
+
{%- if 'arguments' in function -%}
|
| 198 |
+
{%- if function['arguments'] is mapping -%}
|
| 199 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 200 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 201 |
+
{%- if ns.found_first %},{% endif -%}
|
| 202 |
+
{%- set ns.found_first = true -%}
|
| 203 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 204 |
+
{%- endfor -%}
|
| 205 |
+
{%- elif function['arguments'] is string -%}
|
| 206 |
+
{# This handles string-JSON, just in case #}
|
| 207 |
+
{{ function['arguments'] }}
|
| 208 |
+
{%- endif %}
|
| 209 |
+
{%- endif -%}
|
| 210 |
+
{{- '}<end_function_call>' -}}
|
| 211 |
+
{%- endfor -%}
|
| 212 |
+
{%- if loop.last -%}
|
| 213 |
+
{{ '<start_function_response>' }}
|
| 214 |
+
{%- endif -%}
|
| 215 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 216 |
+
{%- endif -%}
|
| 217 |
+
{%- else -%}
|
| 218 |
+
{#- Tool Responses -#}
|
| 219 |
+
{%- if 'content' in message and message['content'] -%}
|
| 220 |
+
{%- if message['content'] is mapping -%}
|
| 221 |
+
{%- if 'name' in message['content'] and 'response' in message['content'] -%}
|
| 222 |
+
{{ '<start_function_response>response:' + message['content']['name'] | trim + '{' }}
|
| 223 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 224 |
+
{%- for key, value in message['content']['response'] | dictsort -%}
|
| 225 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 226 |
+
{%- set response_ns.found_first = true -%}
|
| 227 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 228 |
+
{%- endfor -%}
|
| 229 |
+
{{- '}<end_function_response>' -}}
|
| 230 |
+
{%- elif 'name' in message -%}
|
| 231 |
+
{{ '<start_function_response>response:' + message['name'] | trim + '{' }}
|
| 232 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 233 |
+
{%- for key, value in message['content'].items() -%}
|
| 234 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 235 |
+
{%- set response_ns.found_first = true -%}
|
| 236 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 237 |
+
{%- endfor -%}
|
| 238 |
+
{{- '}<end_function_response>' -}}
|
| 239 |
+
{%- else -%}
|
| 240 |
+
{{ raise_exception("Invalid tool response mapping: must contain 'name' and 'response' keys, or 'name' must be in the message.") }}
|
| 241 |
+
{%- endif -%}
|
| 242 |
+
{%- elif message['content'] is string -%}
|
| 243 |
+
{%- if 'name' in message -%}
|
| 244 |
+
{{ '<start_function_response>response:' + message['name'] | trim + '{value:' + format_argument(message['content'], escape_keys=False) + '}<end_function_response>' }}
|
| 245 |
+
{%- else -%}
|
| 246 |
+
{{ raise_exception("Invalid tool response: 'name' must be provided.") }}
|
| 247 |
+
{%- endif -%}
|
| 248 |
+
{%- elif message['content'] is iterable -%}
|
| 249 |
+
{%- for item in message['content'] -%}
|
| 250 |
+
{%- if item is mapping -%}
|
| 251 |
+
{%- if 'name' in item and 'response' in item -%}
|
| 252 |
+
{{ '<start_function_response>response:' + item['name'] | trim + '{' }}
|
| 253 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 254 |
+
{%- for key, value in item['response'].items() -%}
|
| 255 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 256 |
+
{%- set response_ns.found_first = true -%}
|
| 257 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 258 |
+
{%- endfor -%}
|
| 259 |
+
{{- '}<end_function_response>' -}}
|
| 260 |
+
{%- elif 'name' in message -%}
|
| 261 |
+
{{ '<start_function_response>response:' + message['name'] | trim + '{' }}
|
| 262 |
+
{%- set response_ns = namespace(found_first=false) -%}
|
| 263 |
+
{%- for key, value in item.items() -%}
|
| 264 |
+
{%- if response_ns.found_first %},{% endif -%}
|
| 265 |
+
{%- set response_ns.found_first = true -%}
|
| 266 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 267 |
+
{%- endfor -%}
|
| 268 |
+
{{- '}<end_function_response>' -}}
|
| 269 |
+
{%- else -%}
|
| 270 |
+
{{ raise_exception("Invalid tool response mapping: must contain 'name' and 'response' keys, or 'name' must be in the message.") }}
|
| 271 |
+
{%- endif -%}
|
| 272 |
+
{%- else -%}
|
| 273 |
+
{{ raise_exception("Invalid tool response message: multiple responses must all be mappings") }}
|
| 274 |
+
{%- endif -%}
|
| 275 |
+
{%- endfor -%}
|
| 276 |
+
{%- else -%}
|
| 277 |
+
{{ raise_exception("Invalid content type in tool message: must be mapping, iterable of mappings, or string.") }}
|
| 278 |
+
{%- endif -%}
|
| 279 |
+
{%- endif -%}
|
| 280 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 281 |
+
{%- endif -%}
|
| 282 |
+
{%- if ns.prev_message_type not in ['tool_call', 'tool_response'] -%}
|
| 283 |
+
{{ '<end_of_turn>\n' }}
|
| 284 |
+
{%- endif -%}
|
| 285 |
+
{%- endfor -%}
|
| 286 |
+
{%- if add_generation_prompt -%}
|
| 287 |
+
{%- if ns.prev_message_type != 'tool_response' -%}
|
| 288 |
+
{{- '<start_of_turn>model\n' -}}
|
| 289 |
+
{%- endif -%}
|
| 290 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_sliding_window_pattern": 6,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Gemma3ForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"attn_logit_softcapping": null,
|
| 9 |
+
"bos_token_id": 2,
|
| 10 |
+
"dtype": "bfloat16",
|
| 11 |
+
"eos_token_id": 106,
|
| 12 |
+
"final_logit_softcapping": null,
|
| 13 |
+
"head_dim": 256,
|
| 14 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 15 |
+
"hidden_size": 640,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 2048,
|
| 18 |
+
"layer_types": [
|
| 19 |
+
"sliding_attention",
|
| 20 |
+
"sliding_attention",
|
| 21 |
+
"sliding_attention",
|
| 22 |
+
"sliding_attention",
|
| 23 |
+
"sliding_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"sliding_attention",
|
| 26 |
+
"sliding_attention",
|
| 27 |
+
"sliding_attention",
|
| 28 |
+
"sliding_attention",
|
| 29 |
+
"sliding_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"sliding_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"full_attention"
|
| 37 |
+
],
|
| 38 |
+
"max_position_embeddings": 32768,
|
| 39 |
+
"model_type": "gemma3_text",
|
| 40 |
+
"num_attention_heads": 4,
|
| 41 |
+
"num_hidden_layers": 18,
|
| 42 |
+
"num_key_value_heads": 1,
|
| 43 |
+
"pad_token_id": 0,
|
| 44 |
+
"query_pre_attn_scalar": 256,
|
| 45 |
+
"rms_norm_eps": 1e-06,
|
| 46 |
+
"rope_local_base_freq": 10000.0,
|
| 47 |
+
"rope_scaling": null,
|
| 48 |
+
"rope_theta": 1000000.0,
|
| 49 |
+
"sliding_window": 512,
|
| 50 |
+
"transformers_version": "4.57.1",
|
| 51 |
+
"use_bidirectional_attention": false,
|
| 52 |
+
"use_cache": false,
|
| 53 |
+
"vocab_size": 262146
|
| 54 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 2,
|
| 3 |
+
"cache_implementation": "hybrid",
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
+
50,
|
| 8 |
+
106
|
| 9 |
+
],
|
| 10 |
+
"pad_token_id": 0,
|
| 11 |
+
"top_k": 64,
|
| 12 |
+
"top_p": 0.95,
|
| 13 |
+
"transformers_version": "4.57.1"
|
| 14 |
+
}
|
imatrix.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf2d7b0ab8a931ab8444152850099acedc8bd3b6f4ea592f0f8069fcc96d0df5
|
| 3 |
+
size 471008
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a4183596bcb1747d52c3aa55861d07324afd58c6791a6d135f85c4ec5459262
|
| 3 |
+
size 536225616
|
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": "<end_of_turn>",
|
| 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
|
|
|