shadowlilac commited on
Commit
123360d
·
verified ·
1 Parent(s): 5d707eb

Upload 13 files

Browse files
.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
+ Section1_SP_Tokenizer.spiece filter=lfs diff=lfs merge=lfs -text
LlmMetadataProto.pbtext ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ start_token {
2
+ token_ids {
3
+ ids: 2
4
+ }
5
+ }
6
+ stop_tokens {
7
+ token_ids {
8
+ ids: 1
9
+ }
10
+ }
11
+ stop_tokens {
12
+ token_ids {
13
+ ids: 50
14
+ }
15
+ }
16
+ stop_tokens {
17
+ token_ids {
18
+ ids: 106
19
+ }
20
+ }
21
+ llm_model_type {
22
+ gemma4 {
23
+ start_of_image_token {
24
+ token_str: "<|image>"
25
+ }
26
+ end_of_image_token {
27
+ token_str: "<image|>"
28
+ }
29
+ start_of_audio_token {
30
+ token_str: "<|audio>"
31
+ }
32
+ end_of_audio_token {
33
+ token_str: "<audio|>"
34
+ }
35
+ code_fence_start: "<|tool_call>"
36
+ code_fence_end: "<tool_call|>"
37
+ open_quote: "<|\"|>"
38
+ close_quote: "<|\"|>"
39
+ function_response_start: "<|tool_response>"
40
+ use_template_for_fc_format: true
41
+ patch_width: 16
42
+ patch_height: 16
43
+ max_num_patches: 2520
44
+ }
45
+ }
46
+ jinja_prompt_template: "{%- macro format_parameters(properties, required) -%}\n {%- set standard_keys = [\'description\', \'type\', \'properties\', \'required\', \'nullable\'] -%}\n {%- set ns = namespace(found_first=false) -%}\n {%- for key, value in properties | dictsort -%}\n {%- set add_comma = false -%}\n {%- if key not in standard_keys -%}\n {%- if ns.found_first %},{% endif -%}\n {%- set ns.found_first = true -%}\n {{ key }}:{\n {%- if value[\'description\'] -%}\n description:<|\"|>{{ value[\'description\'] }}<|\"|>\n {%- set add_comma = true -%}\n {%- endif -%}\n {%- if value[\'nullable\'] %}\n {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}\n nullable:true\n {%- endif -%}\n {%- if value[\'type\'] | upper == \'STRING\' -%}\n {%- if value[\'enum\'] -%}\n {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}\n enum:{{ format_argument(value[\'enum\']) }}\n {%- endif -%}\n {%- elif value[\'type\'] | upper == \'OBJECT\' -%}\n ,properties:{\n {%- if value[\'properties\'] is defined and value[\'properties\'] is mapping -%}\n {{- format_parameters(value[\'properties\'], value[\'required\'] | default([])) -}}\n {%- elif value is mapping -%}\n {{- format_parameters(value, value[\'required\'] | default([])) -}}\n {%- endif -%}\n }\n {%- if value[\'required\'] -%}\n ,required:[\n {%- for item in value[\'required\'] | default([]) -%}\n <|\"|>{{- item -}}<|\"|>\n {%- if not loop.last %},{% endif -%}\n {%- endfor -%}\n ]\n {%- endif -%}\n {%- elif value[\'type\'] | upper == \'ARRAY\' -%}\n {%- if value[\'items\'] is mapping and value[\'items\'] -%}\n ,items:{\n {%- set ns_items = namespace(found_first=false) -%}\n {%- for item_key, item_value in value[\'items\'] | dictsort -%}\n {%- if item_value is not none -%}\n {%- if ns_items.found_first %},{% endif -%}\n {%- set ns_items.found_first = true -%}\n {%- if item_key == \'properties\' -%}\n properties:{\n {%- if item_value is mapping -%}\n {{- format_parameters(item_value, value[\'items\'][\'required\'] | default([])) -}}\n {%- endif -%}\n }\n {%- elif item_key == \'required\' -%}\n required:[\n {%- for req_item in item_value -%}\n <|\"|>{{- req_item -}}<|\"|>\n {%- if not loop.last %},{% endif -%}\n {%- endfor -%}\n ]\n {%- elif item_key == \'type\' -%}\n {%- if item_value is string -%}\n type:{{ format_argument(item_value | upper) }}\n {%- else -%}\n type:{{ format_argument(item_value | map(\'upper\') | list) }}\n {%- endif -%}\n {%- else -%}\n {{ item_key }}:{{ format_argument(item_value) }}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n }\n {%- endif -%}\n {%- endif -%}\n {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}\n type:<|\"|>{{ value[\'type\'] | upper }}<|\"|>}\n {%- endif -%}\n {%- endfor -%}\n{%- endmacro -%}\n{%- macro format_function_declaration(tool_data) -%}\n declaration:{{- tool_data[\'function\'][\'name\'] -}}{description:<|\"|>{{- tool_data[\'function\'][\'description\'] -}}<|\"|>\n {%- set params = tool_data[\'function\'][\'parameters\'] -%}\n {%- if params -%}\n ,parameters:{\n {%- if params[\'properties\'] -%}\n properties:{ {{- format_parameters(params[\'properties\'], params[\'required\']) -}} },\n {%- endif -%}\n {%- if params[\'required\'] -%}\n required:[\n {%- for item in params[\'required\'] -%}\n <|\"|>{{- item -}}<|\"|>\n {{- \',\' if not loop.last -}}\n {%- endfor -%}\n ],\n {%- endif -%}\n {%- if params[\'type\'] -%}\n type:<|\"|>{{- params[\'type\'] | upper -}}<|\"|>}\n {%- endif -%}\n {%- endif -%}\n {%- if \'response\' in tool_data[\'function\'] -%}\n {%- set response_declaration = tool_data[\'function\'][\'response\'] -%}\n ,response:{\n {%- if response_declaration[\'description\'] -%}\n description:<|\"|>{{- response_declaration[\'description\'] -}}<|\"|>,\n {%- endif -%}\n {%- if response_declaration[\'type\'] | upper == \'OBJECT\' -%}\n type:<|\"|>{{- response_declaration[\'type\'] | upper -}}<|\"|>}\n {%- endif -%}\n {%- endif -%}\n }\n{%- endmacro -%}\n{%- macro format_argument(argument, escape_keys=True) -%}\n {%- if argument is string -%}\n {{- \'<|\"|>\' + argument + \'<|\"|>\' -}}\n {%- elif argument is boolean -%}\n {{- \'true\' if argument else \'false\' -}}\n {%- elif argument is mapping -%}\n {{- \'{\' -}}\n {%- set ns = namespace(found_first=false) -%}\n {%- for key, value in argument | dictsort -%}\n {%- if ns.found_first %},{% endif -%}\n {%- set ns.found_first = true -%}\n {%- if escape_keys -%}\n {{- \'<|\"|>\' + key + \'<|\"|>\' -}}\n {%- else -%}\n {{- key -}}\n {%- endif -%}\n :{{- format_argument(value, escape_keys=escape_keys) -}}\n {%- endfor -%}\n {{- \'}\' -}}\n {%- elif argument is sequence -%}\n {{- \'[\' -}}\n {%- for item in argument -%}\n {{- format_argument(item, escape_keys=escape_keys) -}}\n {%- if not loop.last %},{% endif -%}\n {%- endfor -%}\n {{- \']\' -}}\n {%- else -%}\n {{- argument -}}\n {%- endif -%}\n{%- endmacro -%}\n{%- macro strip_thinking(text) -%}\n {%- set ns = namespace(result=\'\') -%}\n {%- for part in text.split(\'<channel|>\') -%}\n {%- if \'<|channel>\' in part -%}\n {%- set ns.result = ns.result + part.split(\'<|channel>\')[0] -%}\n {%- else -%}\n {%- set ns.result = ns.result + part -%}\n {%- endif -%}\n {%- endfor -%}\n {{- ns.result | trim -}}\n{%- endmacro -%}\n\n{%- set ns = namespace(prev_message_type=None) -%}\n{%- set loop_messages = messages -%}\n{{ bos_token }}\n{#- Handle System/Tool Definitions Block -#}\n{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0][\'role\'] in [\'system\', \'developer\'] -%}\n {{- \'<|turn>system\\n\' -}}\n\n {#- Inject Thinking token at the very top of the FIRST system turn -#}\n {%- if enable_thinking is defined and enable_thinking -%}\n {{- \'<|think|>\' -}}\n {%- endif -%}\n\n {%- if messages[0][\'role\'] in [\'system\', \'developer\'] -%}\n {%- if messages[0][\'content\'] is string -%}\n {{- messages[0][\'content\'] | trim -}}\n {%- elif messages[0][\'content\'] is sequence -%}\n {%- for item in messages[0][\'content\'] -%}\n {%- if item[\'type\'] == \'text\' -%}\n {{- item[\'text\'] | trim -}}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n {%- endif -%}\n\n {%- if tools -%}\n {{- \'\\n\\n\' -}}\n {%- for tool in tools %}\n {{- \'<|tool>\' -}}\n {{- format_function_declaration(tool) | trim -}}\n {{- \'<tool|>\' -}}\n {%- endfor %}\n {%- endif -%}\n\n {{- \'<turn|>\\n\' -}}\n{%- endif %}\n\n{#- Loop through messages -#}\n{%- for message in loop_messages -%}\n {%- set role = \'model\' if message[\'role\'] == \'assistant\' else message[\'role\'] -%}\n {%- if role != \'tool\' -%}\n {{- \'<|turn>\' + role + \'\\n\' }}\n {%- endif -%}\n\n {%- if message[\'tool_calls\'] -%}\n {%- for tool_call in message[\'tool_calls\'] -%}\n {%- set function = tool_call[\'function\'] -%}\n {{- \'<|tool_call>call:\' + function[\'name\'] + \'{\' -}}\n {%- if function[\'arguments\'] is mapping -%}\n {%- set ns_args = namespace(found_first=false) -%}\n {%- for key, value in function[\'arguments\'] | dictsort -%}\n {%- if ns_args.found_first %},{% endif -%}\n {%- set ns_args.found_first = true -%}\n {{- key -}}:{{- format_argument(value, escape_keys=False) -}}\n {%- endfor -%}\n {%- elif function[\'arguments\'] is string -%}\n {{- function[\'arguments\'] -}}\n {%- endif -%}\n {{- \'}<tool_call|>\' -}}\n {%- endfor -%}\n {%- set ns.prev_message_type = \'tool_call\' -%}\n {%- endif -%}\n\n {%- if role == \'tool\' and message[\'content\'] is sequence -%}\n {#- Tool Response handling -#}\n {%- for item in message[\'content\'] -%}\n {{- \'<|tool_response>\' -}}\n {%- if item[\'response\'] is mapping -%}\n {{- \'response:\' + item[\'name\'] | default(\'unknown\') + \'{\' -}}\n {%- for key, value in item[\'response\'] | dictsort -%}\n {{- key -}}:{{- format_argument(value, escape_keys=False) -}}\n {%- if not loop.last %},{% endif -%}\n {%- endfor -%}\n {{- \'}\' -}}\n {%- else -%}\n {{- \'response:\' + item[\'name\'] | default(\'unknown\') + \'{value:\' + format_argument(item[\'response\'], escape_keys=False) + \'}\' -}}\n {%- endif -%}\n {{- \'<tool_response|>\' -}}\n {%- endfor -%}\n {%- set ns.prev_message_type = \'tool_response\' -%}\n {%- else -%}\n {%- if message[\'content\'] is string -%}\n {%- if role == \'model\' -%}\n {{- strip_thinking(message[\'content\']) -}}\n {%- else -%}\n {{- message[\'content\'] | trim -}}\n {%- endif -%}\n {%- elif message[\'content\'] is sequence -%}\n {%- for item in message[\'content\'] -%}\n {%- if item[\'type\'] == \'text\' -%}\n {%- if role == \'model\' -%}\n {{- strip_thinking(item[\'text\']) -}}\n {%- else -%}\n {{- item[\'text\'] | trim -}}\n {%- endif -%}\n {%- elif item[\'type\'] == \'image\' -%}\n {{- \'\\n\\n<|image|>\\n\\n\' -}}\n {%- elif item[\'type\'] == \'audio\' -%}\n {{- \'<|audio|>\' -}}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- set ns.prev_message_type = None -%} \n {%- endif -%}\n {%- if ns.prev_message_type == None -%}\n {{- \'<turn|>\\n\' -}}\n {%- endif -%}\n{%- endfor -%}\n\n{%- if add_generation_prompt -%}\n {%- if ns.prev_message_type != \'tool_response\' -%}\n {{- \'<|turn>model\\n\' -}}\n {%- endif -%}\n{%- endif -%}"
47
+ channels {
48
+ channel_name: "thought"
49
+ start: "<|channel>thought\n"
50
+ end: "<channel|>"
51
+ }
Section10_TFLiteModel_tf_lite_prefill_decode.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:387aafcb8ef7736e415db56a538fcd2afd198f9899d593d056bc19e5a3eb1700
3
+ size 2260043376
Section11_TFLiteModel_tf_lite_mtp_drafter.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aae393cf6e08d8ca1dcf9094ad47430213d051d97fc264a4d9b5ba235d1c195e
3
+ size 45133128
Section1_SP_Tokenizer.spiece ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e594c8a90eb08d8bda498ff4747977dc827ae0c3c56b5c0d41a605a22d02ef03
3
+ size 4689013
Section2_TFLiteModel_tf_lite_embedder.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94cf45ffd3d0dd7040d27b22e70845cf1054db90613bf31d8ffc1623d23d4a40
3
+ size 170920584
Section3_TFLiteModel_tf_lite_per_layer_embedder.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d35fe41db89fa0128f5da9530886a12581cee715369e1b9ed9a3644e43d16a6a
3
+ size 836778512
Section4_TFLiteModel_tf_lite_audio_encoder_hw.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eca6f5f0eae4997e9f2a74ee120a5eb7f9ee4f687196777e631b650d91a2ccfc
3
+ size 94052280
Section5_TFLiteModel_tf_lite_audio_adapter.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1a189bb55c9d236b80852c3a5d83902667d4873d8bd93d9a5e1c763b7f1de8e
3
+ size 15732700
Section6_TFLiteModel_tf_lite_end_of_audio.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7843908a1ff9b69328c4878bd5f57be43b0ad517216a04fadd81d3ed07c9aeb
3
+ size 10868
Section7_TFLiteModel_tf_lite_vision_encoder.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8734313f722e712a5959d3da866fbbe02b4bcf389911899aca2eb9a69ed08fb
3
+ size 219090120
Section8_TFLiteModel_tf_lite_vision_adapter.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a05861c43361b88ebe8cd8738742a2811be2939e052907c0754076030c9949b7
3
+ size 7872840
Section9_TFLiteModel_tf_lite_end_of_vision.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f872fa2a919f57768dcd7d0729bdfef6f50f56881fe842883d8c405ee96df63b
3
+ size 10868
model.toml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [system_metadata]
2
+ entries = [
3
+ { key = "author", value_type = "String", value = "The ODML Authors" },
4
+ ]
5
+
6
+ [[section]]
7
+ section_type = "LlmMetadata"
8
+ data_path = "LlmMetadataProto.pbtext"
9
+
10
+ [[section]]
11
+ section_type = "SP_Tokenizer"
12
+ data_path = "Section1_SP_Tokenizer.spiece"
13
+
14
+ [[section]]
15
+ model_type = "embedder"
16
+ section_type = "TFLiteModel"
17
+ data_path = "Section2_TFLiteModel_tf_lite_embedder.tflite"
18
+
19
+ [[section]]
20
+ model_type = "per_layer_embedder"
21
+ section_type = "TFLiteModel"
22
+ data_path = "Section3_TFLiteModel_tf_lite_per_layer_embedder.tflite"
23
+
24
+ [[section]]
25
+ model_type = "audio_encoder_hw"
26
+ backend_constraint = "cpu"
27
+ section_type = "TFLiteModel"
28
+ data_path = "Section4_TFLiteModel_tf_lite_audio_encoder_hw.tflite"
29
+
30
+ [[section]]
31
+ model_type = "audio_adapter"
32
+ backend_constraint = "cpu"
33
+ section_type = "TFLiteModel"
34
+ data_path = "Section5_TFLiteModel_tf_lite_audio_adapter.tflite"
35
+
36
+ [[section]]
37
+ model_type = "end_of_audio"
38
+ section_type = "TFLiteModel"
39
+ data_path = "Section6_TFLiteModel_tf_lite_end_of_audio.tflite"
40
+
41
+ [[section]]
42
+ model_type = "vision_encoder"
43
+ section_type = "TFLiteModel"
44
+ data_path = "Section7_TFLiteModel_tf_lite_vision_encoder.tflite"
45
+
46
+ [[section]]
47
+ model_type = "vision_adapter"
48
+ backend_constraint = "cpu"
49
+ section_type = "TFLiteModel"
50
+ data_path = "Section8_TFLiteModel_tf_lite_vision_adapter.tflite"
51
+
52
+ [[section]]
53
+ model_type = "end_of_vision"
54
+ section_type = "TFLiteModel"
55
+ data_path = "Section9_TFLiteModel_tf_lite_end_of_vision.tflite"
56
+
57
+ [[section]]
58
+ model_type = "prefill_decode"
59
+ section_type = "TFLiteModel"
60
+ data_path = "Section10_TFLiteModel_tf_lite_prefill_decode.tflite"
61
+
62
+ [[section]]
63
+ model_type = "mtp_drafter"
64
+ backend_constraint = "cpu"
65
+ section_type = "TFLiteModel"
66
+ data_path = "Section11_TFLiteModel_tf_lite_mtp_drafter.tflite"