qgallouedec HF Staff commited on
Commit
c9f831c
·
verified ·
1 Parent(s): 394fe96

Upload MuseSparkForConditionalGeneration

Browse files
chat_template.jinja CHANGED
@@ -1,9 +1,13 @@
1
  {%- set tools = tools | default(none) -%}
2
  {%- set add_generation_prompt = add_generation_prompt | default(false) -%}
3
- {%- set reasoning_effort = reasoning_effort | default('medium') -%}
4
  {%- set cutoff_date = cutoff_date | default('2026-01-04') -%}
5
  {%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%}
6
- {%- set reasoning_effort_map = {'minimal': 1, 'low': 16, 'medium': 64, 'high': 256, 'xhigh': 512} -%}
 
 
 
 
7
 
8
  {#- Neutralise control sequences in caller-supplied text so it cannot be
9
  tokenized as structure. "<|" is broken because every special token has the
@@ -76,20 +80,67 @@
76
  {{- '</atem:invoke>\n</atem:function_calls>' -}}
77
  {%- endmacro -%}
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  {%- macro render_tool_defs(tools) -%}
80
  {{- 'In this environment you have access to a set of tools you can use to answer the user\'s question.\n\n' -}}
81
  {{- 'You can invoke a function by writing a "<atem:function_calls>" block like the following as part of your reply to the user:\n' -}}
82
  {{- '<atem:function_calls>\n<atem:invoke name="$FUNCTION_NAME">\n<atem:parameter name="$PARAMETER_NAME">$PARAMETER_VALUE</atem:parameter>\n...\n</atem:invoke>\n</atem:function_calls>\n\n' -}}
83
  {{- 'String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.\n' -}}
84
  {{- 'Here are the functions available in JSONSchema format:\n' -}}
85
- {{- '// Tool metadata\n{"name": "", "description": ""}\n' -}}
86
- {{- '// Function schemas' -}}
87
  {%- for tool in tools -%}
88
- {%- set fn = tool.function if tool.function is defined else tool -%}
89
- {{- '\n{"name": ' -}}{{- fn.name | tojson -}}
90
- {{- ', "description": ' -}}{{- (fn.description if fn.description is defined and fn.description else '') | tojson -}}
91
- {{- ', "parameters": ' -}}{{- (fn.parameters if fn.parameters is defined and fn.parameters else {}) | tojson -}}{{- '}' -}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  {%- endfor -%}
 
93
  {{- '\n\n' -}}
94
  {{- 'Here are examples of how to call functions in the tool set. To make parallel tool calls, emit each call as its own message (one tool call per message) in consecutive messages, as shown below:\n' -}}
95
  {{- '(If the tool namespace is not specified, invoke the function directly as `example_function_name_1` rather than `example_tool_name_1.example_function_name_1`)\n\n' -}}
@@ -112,9 +163,15 @@
112
  {%- set rns.recipients = rns.recipients + ['"commentary"'] -%}
113
  {{- '- "commentary": user-visible intermediate updates while the assistant will continue working, including messages sent to the user before or between tool calls.\n' -}}
114
  {%- if tools -%}
115
- {%- set first_tool = tools | first -%}
116
- {%- set first_fn = (first_tool.function if first_tool.function is defined else first_tool).name -%}
117
- {%- set rns.recipients = rns.recipients + ['"[func_name] (e.g., ' ~ esc_header(first_fn) ~ ')"'] -%}
 
 
 
 
 
 
118
  {{- '- "tool" or "[tool name]": the name of the tool to call.\n' -}}
119
  {%- endif -%}
120
  {%- set rns.recipients = rns.recipients + ['"user"'] -%}
@@ -142,7 +199,7 @@
142
  {%- if tools -%}
143
  {%- set sys.parts = sys.parts + [render_tool_defs(tools) | trim] -%}
144
  {%- endif -%}
145
- {%- if reasoning_effort in reasoning_effort_map and 'reasoning strength:' not in ((ns.instructions if ns.instructions else '') | lower) -%}
146
  {%- set sys.parts = sys.parts + ['Reasoning strength: ' ~ reasoning_effort_map[reasoning_effort] ~ '.'] -%}
147
  {%- endif -%}
148
  {%- set sys.parts = sys.parts + [render_valid_recipients(tools) | trim] -%}
 
1
  {%- set tools = tools | default(none) -%}
2
  {%- set add_generation_prompt = add_generation_prompt | default(false) -%}
3
+ {%- set reasoning_effort = reasoning_effort | default('xhigh', true) -%}
4
  {%- set cutoff_date = cutoff_date | default('2026-01-04') -%}
5
  {%- set current_date = current_date | default(strftime_now('%Y-%m-%d') if strftime_now is defined else none) -%}
6
+ {%- set reasoning_effort_map = {'low': 8, 'medium': 32, 'high': 256, 'xhigh': 512} -%}
7
+ {%- if not (reasoning_effort is string and reasoning_effort in reasoning_effort_map) -%}
8
+ {{- raise_exception('Unsupported reasoning_effort: ' ~ reasoning_effort ~ '. Expected one of: low, medium, high, xhigh.') -}}
9
+ {%- endif -%}
10
+ {%- set deferred_render_mode = deferred_render_mode | default('tool_name_and_description') -%}
11
 
12
  {#- Neutralise control sequences in caller-supplied text so it cannot be
13
  tokenized as structure. "<|" is broken because every special token has the
 
80
  {{- '</atem:invoke>\n</atem:function_calls>' -}}
81
  {%- endmacro -%}
82
 
83
+ {#- One function line, as the training renderer prints it. Deferred: name plus description and annotation
84
+ (tool_name_and_description) or annotation only (tool_name_only). Full: "additionalProperties": false is added
85
+ when the schema lacks it, and empty parameters become an empty object schema. -#}
86
+ {%- macro fn_line(name, fn, deferred) -%}
87
+ {%- set desc = fn.description if fn.description is defined and fn.description else '' -%}
88
+ {%- set p = fn.parameters if fn.parameters is defined and fn.parameters else {} -%}
89
+ {%- if deferred -%}
90
+ {%- set desc = ('' if deferred_render_mode == 'tool_name_only' else desc ~ ' ') ~ '[deferred: use tool_search to load full schema]' -%}
91
+ {{- '\n{"name": ' ~ esc(name | tojson) ~ ', "description": ' ~ esc(desc | tojson) ~ ', "defer_loading": true}' -}}
92
+ {%- else -%}
93
+ {%- if p is mapping and p | length == 0 -%}
94
+ {%- set p = '{"type": "object", "properties": {}, "additionalProperties": false}' -%}
95
+ {%- elif p is mapping and 'additionalProperties' not in p -%}
96
+ {%- set p = (p | tojson)[:-1] ~ ', "additionalProperties": false}' -%}
97
+ {%- else -%}
98
+ {%- set p = p | tojson -%}
99
+ {%- endif -%}
100
+ {{- '\n{"name": ' ~ esc(name | tojson) ~ ', "description": ' ~ esc(desc | tojson) ~ ', "parameters": ' ~ esc(p) ~ '}' -}}
101
+ {%- endif -%}
102
+ {%- endmacro -%}
103
+
104
+ {#- tools: OpenAI function tools, plus namespace tools {"type": "namespace", "name", "description", "defer_loading",
105
+ "tools": [function, ...]}. In a deferred namespace, functions without their own flag inherit the deferral; only
106
+ when some are true and some explicitly false do the explicitly eager ones keep their full schema. -#}
107
  {%- macro render_tool_defs(tools) -%}
108
  {{- 'In this environment you have access to a set of tools you can use to answer the user\'s question.\n\n' -}}
109
  {{- 'You can invoke a function by writing a "<atem:function_calls>" block like the following as part of your reply to the user:\n' -}}
110
  {{- '<atem:function_calls>\n<atem:invoke name="$FUNCTION_NAME">\n<atem:parameter name="$PARAMETER_NAME">$PARAMETER_VALUE</atem:parameter>\n...\n</atem:invoke>\n</atem:function_calls>\n\n' -}}
111
  {{- 'String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.\n' -}}
112
  {{- 'Here are the functions available in JSONSchema format:\n' -}}
113
+ {%- set td = namespace(meta='', fns='', loose=false) -%}
 
114
  {%- for tool in tools -%}
115
+ {%- if tool.type is defined and tool.type == 'namespace' -%}
116
+ {%- set ns_deferred = tool.defer_loading is defined and tool.defer_loading -%}
117
+ {%- set ns_desc = tool.description if tool.description is defined and tool.description else '' -%}
118
+ {%- set members = tool.tools if tool.tools is defined and tool.tools else [] -%}
119
+ {%- set flags = namespace(t=false, f=false) -%}
120
+ {%- for m in members -%}
121
+ {%- set d = (m.function if m.function is defined else m).defer_loading -%}
122
+ {%- set flags.t = flags.t or d is not sameas false -%}
123
+ {%- set flags.f = flags.f or d is sameas false -%}
124
+ {%- endfor -%}
125
+ {%- if ns_deferred -%}
126
+ {%- set ns_desc = '[deferred: use tool_search to load descriptions and schemas]' if deferred_render_mode == 'tool_name_only' else (ns_desc ~ ' ' if ns_desc else '') ~ '[deferred: use tool_search to discover functions]' -%}
127
+ {%- endif -%}
128
+ {%- set td.meta = td.meta ~ '\n{"name": ' ~ esc(tool.name | tojson) ~ ', "description": ' ~ esc(ns_desc | tojson) ~ (', "has_deferred_functions": true}' if ns_deferred else '}') -%}
129
+ {%- for m in members -%}
130
+ {%- set mfn = m.function if m.function is defined else m -%}
131
+ {%- set eager = flags.t and flags.f and mfn.defer_loading is defined and mfn.defer_loading is sameas false -%}
132
+ {%- if not ns_deferred or eager or deferred_render_mode == 'tool_name_only' -%}
133
+ {%- set td.fns = td.fns ~ fn_line(tool.name ~ '.' ~ mfn.name, mfn, (not eager) if ns_deferred else (mfn.defer_loading is defined and mfn.defer_loading)) -%}
134
+ {%- endif -%}
135
+ {%- endfor -%}
136
+ {%- else -%}
137
+ {%- set fn = tool.function if tool.function is defined else tool -%}
138
+ {%- set td.meta = td.meta ~ ('' if td.loose else '\n{"name": "", "description": ""}') -%}
139
+ {%- set td.loose = true -%}
140
+ {%- set td.fns = td.fns ~ fn_line(fn.name, fn, fn.defer_loading is defined and fn.defer_loading) -%}
141
+ {%- endif -%}
142
  {%- endfor -%}
143
+ {{- '// Tool metadata' ~ td.meta ~ '\n// Function schemas' ~ td.fns -}}
144
  {{- '\n\n' -}}
145
  {{- 'Here are examples of how to call functions in the tool set. To make parallel tool calls, emit each call as its own message (one tool call per message) in consecutive messages, as shown below:\n' -}}
146
  {{- '(If the tool namespace is not specified, invoke the function directly as `example_function_name_1` rather than `example_tool_name_1.example_function_name_1`)\n\n' -}}
 
163
  {%- set rns.recipients = rns.recipients + ['"commentary"'] -%}
164
  {{- '- "commentary": user-visible intermediate updates while the assistant will continue working, including messages sent to the user before or between tool calls.\n' -}}
165
  {%- if tools -%}
166
+ {%- set rt = namespace(first=none, ns=[]) -%}
167
+ {%- for tool in tools -%}
168
+ {%- if tool.type is defined and tool.type == 'namespace' -%}
169
+ {%- set rt.ns = rt.ns + ['"' ~ esc_header(tool.name) ~ '.*"'] -%}
170
+ {%- elif rt.first is none -%}
171
+ {%- set rt.first = (tool.function if tool.function is defined else tool).name -%}
172
+ {%- endif -%}
173
+ {%- endfor -%}
174
+ {%- set rns.recipients = rns.recipients + (['"[func_name] (e.g., ' ~ esc_header(rt.first) ~ ')"'] if rt.first is not none else []) + rt.ns -%}
175
  {{- '- "tool" or "[tool name]": the name of the tool to call.\n' -}}
176
  {%- endif -%}
177
  {%- set rns.recipients = rns.recipients + ['"user"'] -%}
 
199
  {%- if tools -%}
200
  {%- set sys.parts = sys.parts + [render_tool_defs(tools) | trim] -%}
201
  {%- endif -%}
202
+ {%- if 'reasoning strength:' not in ((ns.instructions if ns.instructions else '') | lower) -%}
203
  {%- set sys.parts = sys.parts + ['Reasoning strength: ' ~ reasoning_effort_map[reasoning_effort] ~ '.'] -%}
204
  {%- endif -%}
205
  {%- set sys.parts = sys.parts + [render_valid_recipients(tools) | trim] -%}
config.json CHANGED
@@ -19,7 +19,7 @@
19
  ],
20
  "initializer_range": 0.02,
21
  "mlp_ratio": 2.0,
22
- "model_type": "musespark1x_omni_audio",
23
  "num_hidden_layers": 4,
24
  "out_hidden_size": 64,
25
  "patch_sizes": [
@@ -33,7 +33,7 @@
33
  "audio_token_id": 200038,
34
  "dtype": "bfloat16",
35
  "image_token_id": 200092,
36
- "model_type": "musespark1x_omni",
37
  "out_hidden_size": 128,
38
  "projector_hidden_act": "gelu",
39
  "projector_hidden_size": 32,
@@ -121,7 +121,7 @@
121
  "sparse",
122
  "sparse"
123
  ],
124
- "model_type": "musespark1x_omni_text",
125
  "moe_hidden_size": 16,
126
  "moe_intermediate_size": 32,
127
  "num_attention_heads": 4,
@@ -131,6 +131,7 @@
131
  "num_local_experts": 16,
132
  "num_shared_experts": 0,
133
  "output_multiplier": 0.17677669529663687,
 
134
  "pad_token_id": 200018,
135
  "post_norm_eps": 1e-08,
136
  "qk_scale_factor": 5.4730064863875,
@@ -146,7 +147,7 @@
146
  "use_cache": true,
147
  "vocab_size": 202048
148
  },
149
- "transformers_version": "5.18.0.dev0",
150
  "video_token_id": 200091,
151
  "vision_config": {
152
  "hidden_act": "gelu",
@@ -159,7 +160,7 @@
159
  ],
160
  "max_position_embeddings": 1024,
161
  "merge_size": 2,
162
- "model_type": "musespark1x_omni_vision",
163
  "num_attention_heads": 4,
164
  "num_hidden_layers": 2,
165
  "patch_size": 14,
 
19
  ],
20
  "initializer_range": 0.02,
21
  "mlp_ratio": 2.0,
22
+ "model_type": "muse_spark_audio",
23
  "num_hidden_layers": 4,
24
  "out_hidden_size": 64,
25
  "patch_sizes": [
 
33
  "audio_token_id": 200038,
34
  "dtype": "bfloat16",
35
  "image_token_id": 200092,
36
+ "model_type": "muse_spark",
37
  "out_hidden_size": 128,
38
  "projector_hidden_act": "gelu",
39
  "projector_hidden_size": 32,
 
121
  "sparse",
122
  "sparse"
123
  ],
124
+ "model_type": "muse_spark_text",
125
  "moe_hidden_size": 16,
126
  "moe_intermediate_size": 32,
127
  "num_attention_heads": 4,
 
131
  "num_local_experts": 16,
132
  "num_shared_experts": 0,
133
  "output_multiplier": 0.17677669529663687,
134
+ "output_router_logits": false,
135
  "pad_token_id": 200018,
136
  "post_norm_eps": 1e-08,
137
  "qk_scale_factor": 5.4730064863875,
 
147
  "use_cache": true,
148
  "vocab_size": 202048
149
  },
150
+ "transformers_version": "5.19.0.dev0",
151
  "video_token_id": 200091,
152
  "vision_config": {
153
  "hidden_act": "gelu",
 
160
  ],
161
  "max_position_embeddings": 1024,
162
  "merge_size": 2,
163
+ "model_type": "muse_spark_vision",
164
  "num_attention_heads": 4,
165
  "num_hidden_layers": 2,
166
  "patch_size": 14,
generation_config.json CHANGED
@@ -9,6 +9,6 @@
9
  "pad_token_id": 200018,
10
  "temperature": 1.0,
11
  "top_k": 64,
12
- "top_p": 0.95,
13
- "transformers_version": "5.18.0.dev0"
14
  }
 
9
  "pad_token_id": 200018,
10
  "temperature": 1.0,
11
  "top_k": 64,
12
+ "top_p": 1,
13
+ "transformers_version": "5.19.0.dev0"
14
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0eca1a0351ae70d60e5c7b1031984afbb33f61c1aef279b139b417a45194f6b0
3
  size 52154128
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10f92659782580ffd54363ad540da89f3203a176879a15ec905d125c47f95356
3
  size 52154128
processor_config.json CHANGED
@@ -39,6 +39,7 @@
39
  "do_resize": true,
40
  "do_sample_frames": true,
41
  "fps": 2.0,
 
42
  "image_mean": [
43
  0.5,
44
  0.5,
@@ -49,9 +50,9 @@
49
  0.5,
50
  0.5
51
  ],
52
- "max_video_frame_tokens": 144,
53
  "merge_size": 2,
54
- "num_frames": 96,
55
  "patch_size": 14,
56
  "resample": 1,
57
  "rescale_factor": 0.00392156862745098,
 
39
  "do_resize": true,
40
  "do_sample_frames": true,
41
  "fps": 2.0,
42
+ "frame_timestamp_format": "Time: {timestamp:.2f}s",
43
  "image_mean": [
44
  0.5,
45
  0.5,
 
50
  0.5,
51
  0.5
52
  ],
53
+ "max_video_frame_tokens": 256,
54
  "merge_size": 2,
55
+ "num_frames": 600,
56
  "patch_size": 14,
57
  "resample": 1,
58
  "rescale_factor": 0.00392156862745098,
tokenizer_config.json CHANGED
@@ -3,7 +3,7 @@
3
  "bos_token": "<|begin_of_text|>",
4
  "clean_up_tokenization_spaces": false,
5
  "eos_token": "<|end_of_text|>",
6
- "is_local": true,
7
  "local_files_only": false,
8
  "model_max_length": 1048576,
9
  "pad_token": "<|finetune_right_pad|>",
 
3
  "bos_token": "<|begin_of_text|>",
4
  "clean_up_tokenization_spaces": false,
5
  "eos_token": "<|end_of_text|>",
6
+ "is_local": false,
7
  "local_files_only": false,
8
  "model_max_length": 1048576,
9
  "pad_token": "<|finetune_right_pad|>",