Upload optimized ONNX model

#1
by Xenova HF Staff - opened
.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
+ onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
37
+ onnx/model_fp16.onnx_data filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set tools_system_message_prefix = 'You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>' %}
2
+ {%- set tools_system_message_suffix = '\n</tools>\n\nFor each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.' %}
3
+ {%- set documents_system_message_prefix = 'You are a helpful assistant with access to the following documents. You may use one or more documents to assist with the user query.\n\nYou are given a list of documents within <documents></documents> XML tags:\n<documents>' %}
4
+ {%- set documents_system_message_suffix = '\n</documents>\n\nWrite the response to the user\'s input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data.' %}
5
+ {%- if available_tools is defined and available_tools %}
6
+ {%- set tools = available_tools %}
7
+ {%- endif %}
8
+ {%- set ns = namespace(tools_system_message=tools_system_message_prefix,
9
+ documents_system_message=documents_system_message_prefix,
10
+ system_message=''
11
+ ) %}
12
+ {%- if tools %}
13
+ {%- for tool in tools %}
14
+ {%- set ns.tools_system_message = ns.tools_system_message + '\n' + (tool | tojson) %}
15
+ {%- endfor %}
16
+ {%- set ns.tools_system_message = ns.tools_system_message + tools_system_message_suffix %}
17
+ {%- else %}
18
+ {%- set ns.tools_system_message = '' %}
19
+ {%- endif %}
20
+ {%- if documents %}
21
+ {%- for document in documents %}
22
+ {%- set ns.documents_system_message = ns.documents_system_message + '\n' + (document | tojson) %}
23
+ {%- endfor %}
24
+ {%- set ns.documents_system_message = ns.documents_system_message + documents_system_message_suffix %}
25
+ {%- else %}
26
+ {%- set ns.documents_system_message = '' %}
27
+ {%- endif %}
28
+ {%- if messages[0].role == 'system' %}
29
+ {%- if messages[0].content is string %}
30
+ {%- set ns.system_message = messages[0].content %}
31
+ {%- elif messages[0].content is iterable %}
32
+ {%- for entry in messages[0].content %}
33
+ {%- if entry.type== 'text' %}
34
+ {%- if ns.system_message != '' %}
35
+ {%- set ns.system_message = ns.system_message + '\n' %}
36
+ {%- endif %}
37
+ {%- set ns.system_message = ns.system_message + entry.text %}
38
+ {%- endif %}
39
+ {%- endfor %}
40
+ {%- endif %}
41
+ {%- if tools and documents %}
42
+ {%- set ns.system_message = ns.system_message + '\n\n' + ns.tools_system_message + '\n\n' + ns.documents_system_message %}
43
+ {%- elif tools %}
44
+ {%- set ns.system_message = ns.system_message + '\n\n' + ns.tools_system_message %}
45
+ {%- elif documents %}
46
+ {%- set ns.system_message = ns.system_message + '\n\n' + ns.documents_system_message %}
47
+ {%- endif %}
48
+ {%- else %}
49
+ {%- if tools and documents %}
50
+ {%- set ns.system_message = ns.tools_system_message + '\n\n' + ns.documents_system_message %}
51
+ {%- elif tools %}
52
+ {%- set ns.system_message = ns.tools_system_message %}
53
+ {%- elif documents %}
54
+ {%- set ns.system_message = ns.documents_system_message %}
55
+ {%- endif %}
56
+ {%- endif %}
57
+ {%- if ns.system_message %}
58
+ {{- '<|start_of_role|>system<|end_of_role|>' + ns.system_message + '<|end_of_text|>\n' }}
59
+ {%- endif %}
60
+ {%- for message in messages %}
61
+ {%- set content = namespace(val='') %}
62
+ {%- if message.content is string %}
63
+ {%- set content.val = message.content %}
64
+ {%- else %}
65
+ {%- if message.content is iterable %}
66
+ {%- for entry in message.content %}
67
+ {%- if entry.type== 'text' %}
68
+ {%- if content.val != '' %}
69
+ {%- set content.val = content.val + '\n' %}
70
+ {%- endif %}
71
+ {%- set content.val = content.val + entry.text %}
72
+ {%- endif %}
73
+ {%- endfor %}
74
+ {%- endif %}
75
+ {%- endif %}
76
+ {%- if (message.role == 'user') or (message.role == 'system' and not loop.first) %}
77
+ {{- '<|start_of_role|>' + message.role + '<|end_of_role|>' + content.val + '<|end_of_text|>\n' }}
78
+ {%- elif message.role == 'assistant' %}
79
+ {{- '<|start_of_role|>' + message.role + '<|end_of_role|>' + content.val }}
80
+ {%- if message.tool_calls %}
81
+ {%- for tool_call in message.tool_calls %}
82
+ {%- if (loop.first and content.val) or (not loop.first) %}
83
+ {{- '\n' }}
84
+ {%- endif %}
85
+ {%- if tool_call.function %}
86
+ {%- set tool_call = tool_call.function %}
87
+ {%- endif %}
88
+ {{- '<tool_call>\n{"name": "' }}
89
+ {{- tool_call.name }}
90
+ {{- '", "arguments": ' }}
91
+ {%- if tool_call.arguments is string %}
92
+ {{- tool_call.arguments }}
93
+ {%- else %}
94
+ {{- tool_call.arguments | tojson }}
95
+ {%- endif %}
96
+ {{- '}\n</tool_call>' }}
97
+ {%- endfor %}
98
+ {%- endif %}
99
+ {{- '<|end_of_text|>\n' }}
100
+ {%- elif message.role == 'tool' %}
101
+ {%- if loop.first or (messages[loop.index0 - 1].role != 'tool') %}
102
+ {{- '<|start_of_role|>user<|end_of_role|>' }}
103
+ {%- endif %}
104
+ {{- '\n<tool_response>\n' }}
105
+ {{- content.val }}
106
+ {{- '\n</tool_response>' }}
107
+ {%- if loop.last or (messages[loop.index0 + 1].role != 'tool') %}
108
+ {{- '<|end_of_text|>\n' }}
109
+ {%- endif %}
110
+ {%- endif %}
111
+ {%- endfor %}
112
+ {%- if add_generation_prompt %}
113
+ {{- '<|start_of_role|>assistant<|end_of_role|>' }}
114
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "GraniteMoeHybridForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attention_multiplier": 0.0078125,
8
+ "bos_token_id": 100257,
9
+ "dtype": "bfloat16",
10
+ "embedding_multiplier": 12,
11
+ "eos_token_id": 100257,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 32,
14
+ "initializer_range": 0.1,
15
+ "intermediate_size": 128,
16
+ "layer_types": [
17
+ "mamba",
18
+ "attention"
19
+ ],
20
+ "logits_scaling": 16,
21
+ "mamba_chunk_size": 256,
22
+ "mamba_conv_bias": true,
23
+ "mamba_d_conv": 4,
24
+ "mamba_d_head": 64,
25
+ "mamba_d_state": 128,
26
+ "mamba_expand": 256,
27
+ "mamba_n_groups": 1,
28
+ "mamba_n_heads": 128,
29
+ "mamba_proj_bias": false,
30
+ "max_position_embeddings": 131072,
31
+ "model_type": "granitemoehybrid",
32
+ "normalization_function": "rmsnorm",
33
+ "num_attention_heads": 2,
34
+ "num_experts_per_tok": 10,
35
+ "num_hidden_layers": 2,
36
+ "num_key_value_heads": 2,
37
+ "num_local_experts": 72,
38
+ "output_router_logits": false,
39
+ "pad_token_id": 100256,
40
+ "position_embedding_type": "nope",
41
+ "residual_multiplier": 0.22,
42
+ "rms_norm_eps": 1e-05,
43
+ "rope_parameters": {
44
+ "rope_theta": 10000,
45
+ "rope_type": "default"
46
+ },
47
+ "router_aux_loss_coef": 0.0,
48
+ "shared_intermediate_size": 128,
49
+ "tie_word_embeddings": true,
50
+ "time_step_limit": [
51
+ 0.0,
52
+ {
53
+ "__float__": "Infinity"
54
+ }
55
+ ],
56
+ "time_step_max": 0.1,
57
+ "time_step_min": 0.001,
58
+ "transformers_version": "5.3.0.dev0",
59
+ "use_cache": true,
60
+ "vocab_size": 100352,
61
+ "transformers.js_config": {
62
+ "use_external_data_format": {
63
+ "model.onnx": 1,
64
+ "model_fp16.onnx": 1
65
+ },
66
+ "kv_cache_dtype": {
67
+ "q4f16": "float16",
68
+ "fp16": "float16"
69
+ }
70
+ }
71
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 100257,
4
+ "eos_token_id": 100257,
5
+ "pad_token_id": 100256,
6
+ "transformers_version": "5.3.0.dev0"
7
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc3d0ff11b0ec8ee42adaf8552b23a07d092b04a757d88c4eef4665e1a7a101f
3
+ size 80780
onnx/model.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eaa07b99c17848938eadf1ab2ed8e760694cf60534bc71c7f6f47df76f61270c
3
+ size 27847680
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb59ad58d5aac2cb6959c6dba466aaa1a8764ea8dd4392aa49b93189e2ca8781
3
+ size 82408
onnx/model_fp16.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78f9a44205109c5e19be03f1724bcae562f7884292f24c9c1d06f99683ce1390
3
+ size 13940224
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|end_of_text|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|end_of_text|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "model_max_length": 1000000000000000019884624838656,
10
+ "pad_token": "<|pad|>",
11
+ "padding_side": "left",
12
+ "tokenizer_class": "GPT2Tokenizer",
13
+ "unk_token": "<|unk|>",
14
+ "chat_template": "{%- set tools_system_message_prefix = 'You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>' %}\n{%- set tools_system_message_suffix = '\\n</tools>\\n\\nFor each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.' %}\n{%- set documents_system_message_prefix = 'You are a helpful assistant with access to the following documents. You may use one or more documents to assist with the user query.\\n\\nYou are given a list of documents within <documents></documents> XML tags:\\n<documents>' %}\n{%- set documents_system_message_suffix = '\\n</documents>\\n\\nWrite the response to the user\\'s input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data.' %}\n{%- if available_tools is defined and available_tools %}\n {%- set tools = available_tools %}\n{%- endif %}\n{%- set ns = namespace(tools_system_message=tools_system_message_prefix,\n documents_system_message=documents_system_message_prefix,\n system_message=''\n ) %}\n{%- if tools %}\n {%- for tool in tools %}\n {%- set ns.tools_system_message = ns.tools_system_message + '\\n' + (tool | tojson) %}\n {%- endfor %}\n {%- set ns.tools_system_message = ns.tools_system_message + tools_system_message_suffix %}\n{%- else %}\n {%- set ns.tools_system_message = '' %}\n{%- endif %}\n{%- if documents %}\n {%- for document in documents %}\n {%- set ns.documents_system_message = ns.documents_system_message + '\\n' + (document | tojson) %}\n {%- endfor %}\n {%- set ns.documents_system_message = ns.documents_system_message + documents_system_message_suffix %}\n{%- else %}\n {%- set ns.documents_system_message = '' %}\n{%- endif %}\n{%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {%- set ns.system_message = messages[0].content %}\n {%- elif messages[0].content is iterable %}\n {%- for entry in messages[0].content %}\n {%- if entry.type== 'text' %}\n {%- if ns.system_message != '' %}\n {%- set ns.system_message = ns.system_message + '\\n' %}\n {%- endif %}\n {%- set ns.system_message = ns.system_message + entry.text %}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if tools and documents %}\n {%- set ns.system_message = ns.system_message + '\\n\\n' + ns.tools_system_message + '\\n\\n' + ns.documents_system_message %}\n {%- elif tools %}\n {%- set ns.system_message = ns.system_message + '\\n\\n' + ns.tools_system_message %}\n {%- elif documents %}\n {%- set ns.system_message = ns.system_message + '\\n\\n' + ns.documents_system_message %}\n {%- endif %}\n{%- else %}\n {%- if tools and documents %}\n {%- set ns.system_message = ns.tools_system_message + '\\n\\n' + ns.documents_system_message %}\n {%- elif tools %}\n {%- set ns.system_message = ns.tools_system_message %}\n {%- elif documents %}\n {%- set ns.system_message = ns.documents_system_message %}\n {%- endif %}\n{%- endif %}\n{%- if ns.system_message %}\n {{- '<|start_of_role|>system<|end_of_role|>' + ns.system_message + '<|end_of_text|>\\n' }}\n{%- endif %}\n{%- for message in messages %}\n {%- set content = namespace(val='') %}\n {%- if message.content is string %}\n {%- set content.val = message.content %}\n {%- else %}\n {%- if message.content is iterable %}\n {%- for entry in message.content %}\n {%- if entry.type== 'text' %}\n {%- if content.val != '' %}\n {%- set content.val = content.val + '\\n' %}\n {%- endif %}\n {%- set content.val = content.val + entry.text %}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- endif %}\n {%- if (message.role == 'user') or (message.role == 'system' and not loop.first) %}\n {{- '<|start_of_role|>' + message.role + '<|end_of_role|>' + content.val + '<|end_of_text|>\\n' }}\n {%- elif message.role == 'assistant' %}\n {{- '<|start_of_role|>' + message.role + '<|end_of_role|>' + content.val }}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content.val) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|end_of_text|>\\n' }}\n {%- elif message.role == 'tool' %}\n {%- if loop.first or (messages[loop.index0 - 1].role != 'tool') %}\n {{- '<|start_of_role|>user<|end_of_role|>' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content.val }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != 'tool') %}\n {{- '<|end_of_text|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|start_of_role|>assistant<|end_of_role|>' }}\n{%- endif %}"
15
+ }