yujiepan commited on
Commit
9c88b68
·
verified ·
1 Parent(s): 9713639

Upload folder using huggingface_hub

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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
.meta.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_model": {
3
+ "name": "meta-models/Muse-Spark-Open-816B-A42B",
4
+ "commit_id": "0fb02478b02565b2ce7fc57e6051c91172774ac9"
5
+ },
6
+ "environments": {
7
+ "creation": {
8
+ "python": "3.12.13",
9
+ "packages": {
10
+ "huggingface_hub": "2.3.0",
11
+ "safetensors": "0.8.0",
12
+ "tokenizers": "0.23.3",
13
+ "torch": "2.13.0+cu126",
14
+ "transformers": "5.20.2"
15
+ },
16
+ "cuda": "12.6"
17
+ },
18
+ "sglang": {
19
+ "python": "3.12.13",
20
+ "packages": {
21
+ "av": "16.0.1",
22
+ "cuda-toolkit": "13.0.3.0",
23
+ "flashinfer-python": "0.7.2",
24
+ "huggingface_hub": "1.33.0",
25
+ "nvidia-nccl-cu13": "2.30.7",
26
+ "safetensors": "0.8.0",
27
+ "sglang": "0.5.23.dev384+g9ab74b851",
28
+ "sglang-kernel": "0.4.10",
29
+ "tokenizers": "0.23.2",
30
+ "torch": "2.14.1+cu130",
31
+ "torchaudio": "2.11.0",
32
+ "torchcodec": "0.17.0",
33
+ "torchvision": "0.29.1",
34
+ "transformers": "5.20.2"
35
+ },
36
+ "cuda": "13.0"
37
+ },
38
+ "transformers": {
39
+ "python": "3.12.13",
40
+ "packages": {
41
+ "Pillow": "12.3.0",
42
+ "huggingface_hub": "2.3.0",
43
+ "numpy": "2.5.2",
44
+ "safetensors": "0.8.0",
45
+ "soundfile": "0.13.1",
46
+ "tokenizers": "0.23.3",
47
+ "torch": "2.13.0+cu126",
48
+ "torchvision": "0.28.0+cu126",
49
+ "transformers": "5.20.2"
50
+ },
51
+ "cuda": "12.6"
52
+ }
53
+ }
54
+ }
LICENSE.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **MUSE MODEL LICENSE**
2
+
3
+ *version: Muse Spark Open*
4
+
5
+ *Release date: October 15, 2026*
6
+
7
+ Copyright (c) 2026 Meta Platforms, Inc.
8
+
9
+ Permission is hereby granted, free of charge, to any person (the "Licensee") accessing or obtaining a copy of this software, including the model, code, model weights, parameters, configuration files, and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation, the rights to use, copy, modify (including fine-tune), create derivative works, distill, merge, publish, distribute, sublicense, and/or sell copies of the Software; and to permit persons to whom the Software is furnished to do so, in each case subject to the following conditions:
10
+
11
+ 1\. The above copyright notice and this license and the Usage Policy shall be included in all copies or substantial portions of the Software and Derivatives (defined below). Licensee's use of the Software shall comply with the Usage Policy, which is hereby incorporated into this license and attached hereto as Exhibit A.
12
+
13
+ 2\. Licensee shall prominently display "Built with Muse Spark Open" in the user interface of each product or service that uses the Software or any Derivatives, or in the accompanying documentation, website, or settings menu. “Derivatives” means any AI model created, trained, modified (including fine-tuned), distilled, or otherwise improved using the Software or any outputs or results thereof.
14
+
15
+ 3\. If the Licensee or any of its affiliates provide a third party with access to artificial intelligence models as a product or service, via API or a similar interface, where the third party receives outputs of such models (“**Model as a Service**”), and the aggregate gross revenue of the Licensee and its affiliates exceeds twenty (20) million US dollars (or the equivalent in other currencies) during any consecutive twelve (12) month period, the Licensee must notify Meta and enter into a separate written agreement with Meta before offering the Software or any Derivatives as part of that Model as a Service business. This Section 3 does not apply to (a) internal use, research, or any commercial activity that is not Model as a Service, or (b) the Licensee's use of the Software as a component to power features of the Licensee's own product or service that is not a Model as a Service.
16
+
17
+ 4\. Meta claims no ownership of outputs generated by the Software.
18
+
19
+ 5\. THE SOFTWARE, ANY OUTPUTS, AND ANY RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL META OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR ITS OUTPUTS, OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. META AND ITS AFFILIATES SHALL HAVE NO LIABILITY WITH RESPECT TO ANY DERIVATIVES, AND LICENSEE IS SOLELY RESPONSIBLE FOR THE SAFETY, DEPLOYMENT, AND USE OF ITS DERIVATIVES.
20
+
21
+ “Meta” means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the European region) and Meta Platforms, Inc. (if you are located outside of the European region).
22
+
23
+ **EXHIBIT A \- Muse Spark Open Usage Policy**
24
+
25
+ Dated: October 15, 2026
26
+
27
+ Meta is committed to promoting safe and fair use of its tools and features, including Muse Spark Open. This Usage Policy (“Policy”) applies to your access or use of Muse Spark Open and any Derivatives.
28
+
29
+ Prohibited Uses
30
+
31
+ We want everyone to use Muse Spark Open safely and responsibly. It is your obligation to ensure that any deployment of the model to end-users is safe, taking into account the deployment context and the user-base. Muse Spark Open is not intended for individuals under the age of 18\.
32
+
33
+ You should not use, or allow others to use, Muse Spark Open to:
34
+
35
+ 1. Violate the law or others' rights, including to:
36
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
37
+ 1. Violence or terrorism
38
+ 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
39
+ 3. Human trafficking, exploitation, and sexual violence
40
+ 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials
41
+ 5. Sexual solicitation
42
+ 6. Any other criminal activity
43
+ 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
44
+ 3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
45
+ 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
46
+ 5. Collect, process, disclose, generate, or infer private or sensitive information about individuals, including information about individuals' identity, health, or demographic information, unless you have obtained the right to do so in accordance with applicable law
47
+ 6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using Muse Spark Open
48
+ 7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
49
+ 8. Engage in any action, or facilitate any action, to intentionally circumvent or remove usage restrictions or other safety measures, or to enable functionality disabled by Meta
50
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Muse Spark Open related to the following:
51
+ 1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State or to the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons Convention Implementation Act of 1997
52
+ 2. Guns and illegal weapons (including weapon development)
53
+ 3. Illegal drugs and regulated/controlled substances
54
+ 4. Operation of critical infrastructure, transportation technologies, or heavy machinery
55
+ 5. Self-harm or harm to others, including suicide, cutting, and eating disorders
56
+ 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
57
+ 3. Intentionally deceive or mislead others, including use of Muse Spark Open related to the following:
58
+ 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
59
+ 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
60
+ 3. Generating, promoting, or further distributing spam
61
+ 4. Impersonating another individual without consent, authorization, or legal right
62
+ 5. Representing that the use of Muse Spark Open or outputs are human generated
63
+ 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
64
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
65
+ 5. Interact with third party tools, models, or software designed to generate unlawful content or engage in unlawful or harmful conduct and/or represent that the outputs of such tools, models, or software are associated with Meta or Muse Spark Open
README.md ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - meta-models/Muse-Spark-Open-816B-A42B
4
+ ---
5
+
6
+ This tiny model is randomly initialized for debugging using [meta-models/Muse-Spark-Open-816B-A42B](https://huggingface.co/meta-models/Muse-Spark-Open-816B-A42B).
7
+
8
+ Built with Muse Spark Open. Random weights preserve sigmoid top-8 routed MoE, expert pooling, centered norms, residual/attention gates, sliding RoPE and full NoPE attention, NaViT image/video encoding, and the four-stage waveform audio encoder. Vocabulary rows and source precision are unchanged.
9
+
10
+ | Feature | Source | Tiny |
11
+ |---|---|---|
12
+ | Checkpoint tensor elements | 821,906,490,368 BF16, 130,039,296 F32 | 3,580,264 BF16, 2,304 F32 |
13
+ | Safetensors weight files | 1,644,333,393,864 bytes (65 files) | 7,211,288 bytes (model.safetensors) |
14
+ | Text layers / attention cycle | 62 / sliding, full, sliding, sliding | 8 / two source cycles |
15
+ | Residual / expert pool / expert intermediate width | 8192 / 4096 / 4096 | 8 / 4 / 16 |
16
+ | Q heads / KV heads / head dimension | 128 / 16 / 64 | 8 / 1 / 32 |
17
+ | Experts / activated experts | 256 / 8 | 32 / 8 |
18
+ | Vocabulary / tying | 202048 / untied | Same |
19
+ | Vision layers / width / temporal patch / merge | 50 / 1536 / 2 / 2 | 8 / 32 / 2 / 2 |
20
+ | Audio stages / block depths / sample rate | 4 / [2, 2, 2, 2] / 24 kHz | Same |
21
+ | Checkpoint precision | BF16; router weights/biases FP32 | Same |
22
+ | Modalities | Text + image + video + audio → text | Same |
23
+
24
+ | File path | Size |
25
+ |------|------|
26
+ | model.safetensors | 7.2MB |
27
+
28
+ ### Example usage:
29
+
30
+ - Transformers (✅ verified)
31
+
32
+ This example uses text, an image, predecoded video frames and a 24 kHz waveform. SDPA remains enabled; batched expert GEMMs support the tiny expert pool without grouped-GEMM alignment padding.
33
+
34
+ ```python
35
+ def run_transformers(model_id: str):
36
+ import numpy as np
37
+ import torch
38
+ from PIL import Image
39
+ from transformers import AutoProcessor, MuseSparkForConditionalGeneration
40
+ from transformers.video_utils import VideoMetadata
41
+
42
+ processor = AutoProcessor.from_pretrained(model_id)
43
+ model = MuseSparkForConditionalGeneration.from_pretrained(
44
+ model_id,
45
+ dtype=torch.bfloat16,
46
+ attn_implementation="sdpa",
47
+ experts_implementation="batched_mm",
48
+ device_map="cuda",
49
+ )
50
+ image = Image.new("RGB", (112, 112), "blue")
51
+ video = np.stack([np.full((112, 112, 3), value, dtype=np.uint8) for value in (40, 80, 120, 160)])
52
+ audio = (0.1 * np.sin(2 * np.pi * 440 * np.arange(24000) / 24000)).astype(np.float32)
53
+ messages = [
54
+ {
55
+ "role": "user",
56
+ "content": [
57
+ {"type": "image"},
58
+ {"type": "video"},
59
+ {"type": "audio"},
60
+ {"type": "text", "text": "Describe the image, video and sound."},
61
+ ],
62
+ }
63
+ ]
64
+ prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, reasoning_effort="low")
65
+ inputs = processor(
66
+ text=[prompt],
67
+ images=[image],
68
+ videos=[video],
69
+ audio=[audio],
70
+ sampling_rate=24000,
71
+ video_metadata=[VideoMetadata(total_num_frames=4, fps=2, frames_indices=[0, 1, 2, 3])],
72
+ do_sample_frames=False,
73
+ return_tensors="pt",
74
+ ).to(model.device, dtype=model.dtype)
75
+ outputs = model.generate(**inputs, max_new_tokens=10, do_sample=False)
76
+ print(model)
77
+ print(processor.batch_decode(outputs[:, inputs.input_ids.shape[1] :], skip_special_tokens=True))
78
+
79
+
80
+ if __name__ == "__main__":
81
+ run_transformers(model_id="tiny-random/muse-spark-open")
82
+ ```
83
+
84
+ - SGLang (✅ verified)
85
+
86
+ Muse Spark's BF16 experts require EP=TP, so this single-node launch uses TP=4 and EP=4. Install FFmpeg shared libraries for video decoding.
87
+
88
+ ```bash
89
+ sglang serve \
90
+ --model-path tiny-random/muse-spark-open \
91
+ --tp-size 4 \
92
+ --ep-size 4 \
93
+ --attention-backend triton \
94
+ --context-length 4096 \
95
+ --max-running-requests 4 \
96
+ --max-total-tokens 4096 \
97
+ --mem-fraction-static 0.2 \
98
+ --disable-custom-all-reduce
99
+ ```
100
+
101
+ ### Codes to create this repo:
102
+
103
+ <details><summary>Click to expand</summary>
104
+
105
+ ```python
106
+ def create_model(source_model_id: str, source_revision: str, save_folder: str) -> str:
107
+ import json
108
+ from pathlib import Path
109
+ import torch
110
+ from huggingface_hub import hf_hub_download
111
+ from transformers import MuseSparkConfig, MuseSparkForConditionalGeneration, set_seed
112
+
113
+ folder = Path(save_folder)
114
+ folder.mkdir(parents=True, exist_ok=True)
115
+ config_json = json.loads(
116
+ Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text()
117
+ )
118
+ text = config_json["text_config"]
119
+ text.update(
120
+ hidden_size=8,
121
+ num_attention_heads=8,
122
+ num_key_value_heads=1,
123
+ head_dim=32,
124
+ num_hidden_layers=8,
125
+ intermediate_size=32,
126
+ moe_hidden_size=4,
127
+ moe_intermediate_size=16,
128
+ num_local_experts=32,
129
+ )
130
+ for name in ("layer_types", "mlp_layer_types", "layer_rope_theta"):
131
+ text[name] = text[name][:8]
132
+ vision = config_json["vision_config"]
133
+ vision.update(hidden_size=32, intermediate_size=64, num_attention_heads=4, num_hidden_layers=8)
134
+ vision["layer_types"] = vision["layer_types"][:8]
135
+ config_json["audio_config"].update(hidden_sizes=[8, 16, 32, 64], out_hidden_size=8)
136
+ config_json.update(out_hidden_size=128, projector_hidden_size=16)
137
+ config = MuseSparkConfig.from_dict(config_json)
138
+ set_seed(42)
139
+ model = MuseSparkForConditionalGeneration._from_config(config, dtype=torch.bfloat16, attn_implementation="sdpa")
140
+ # The source checkpoint uses FP32 only for routed-expert router weights and
141
+ # correction biases; residual gates and all other parameters remain BF16.
142
+ for module in model.modules():
143
+ if module.__class__.__name__ == "MuseSparkTopkRouter":
144
+ module.float()
145
+ model.save_pretrained(folder, safe_serialization=True)
146
+ # Restore the deliberately edited raw config and immutable shared assets.
147
+ (folder / "config.json").write_text(json.dumps(config_json, indent=2) + "\n")
148
+ for name in (
149
+ "tokenizer.json",
150
+ "tokenizer_config.json",
151
+ "special_tokens_map.json",
152
+ "chat_template.jinja",
153
+ "processor_config.json",
154
+ "generation_config.json",
155
+ "l4_200k_base",
156
+ "LICENSE.md",
157
+ "USE_POLICY.md",
158
+ ):
159
+ (folder / name).write_bytes(Path(hf_hub_download(source_model_id, name, revision=source_revision)).read_bytes())
160
+ return str(model)
161
+
162
+
163
+ create_model(
164
+ source_model_id="meta-models/Muse-Spark-Open-816B-A42B",
165
+ source_revision="0fb02478b02565b2ce7fc57e6051c91172774ac9",
166
+ save_folder="/mlx_devbox/users/yujie.pan/playground/tiny-random/tmp/scratch/muse-spark-open",
167
+ )
168
+ ```
169
+
170
+ </details>
171
+
172
+ ### Printing the model:
173
+
174
+ <details><summary>Click to expand</summary>
175
+
176
+ ```text
177
+ MuseSparkForConditionalGeneration(
178
+ (model): MuseSparkModel(
179
+ (vision_tower): MuseSparkVisionModel(
180
+ (patch_embedder): MuseSparkVisionPatchEmbedder(
181
+ (patch_embedding): Linear(in_features=1176, out_features=32, bias=False)
182
+ (position_embedding_table): Embedding(1024, 32)
183
+ )
184
+ (rotary_emb): MuseSparkVisionRotaryEmbedding()
185
+ (ln_pre): LayerNorm((32,), eps=1e-05, elementwise_affine=True, bias=True)
186
+ (layers): ModuleList(
187
+ (0-7): 8 x MuseSparkVisionEncoderLayer(
188
+ (norm1): LayerNorm((32,), eps=1e-05, elementwise_affine=True, bias=True)
189
+ (norm2): LayerNorm((32,), eps=1e-05, elementwise_affine=True, bias=True)
190
+ (attn): MuseSparkVisionAttention(
191
+ (proj): Linear(in_features=32, out_features=32, bias=True)
192
+ (q_proj): Linear(in_features=32, out_features=32, bias=True)
193
+ (k_proj): Linear(in_features=32, out_features=32, bias=True)
194
+ (v_proj): Linear(in_features=32, out_features=32, bias=True)
195
+ )
196
+ (mlp): MuseSparkVisionMLP(
197
+ (fc1): Linear(in_features=32, out_features=64, bias=True)
198
+ (act): GELUActivation()
199
+ (fc2): Linear(in_features=64, out_features=32, bias=True)
200
+ )
201
+ )
202
+ )
203
+ (ln_post): LayerNorm((32,), eps=1e-05, elementwise_affine=True, bias=True)
204
+ )
205
+ (language_model): MuseSparkTextModel(
206
+ (embed_tokens): MuseSparkTextNormedEmbedding(
207
+ 202048, 8, padding_idx=200018
208
+ (embed_norm): MuseSparkRMSNorm()
209
+ )
210
+ (layers): ModuleList(
211
+ (0-7): 8 x MuseSparkTextDecoderLayer(
212
+ (self_attn): MuseSparkTextAttention(
213
+ (q_proj): Linear(in_features=8, out_features=256, bias=False)
214
+ (k_proj): Linear(in_features=8, out_features=32, bias=False)
215
+ (v_proj): Linear(in_features=8, out_features=32, bias=False)
216
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
217
+ (gate_proj): Linear(in_features=8, out_features=256, bias=False)
218
+ (qk_norm): MuseSparkRMSNorm()
219
+ (o_norm): MuseSparkRMSNorm()
220
+ )
221
+ (mlp): MuseSparkMoE(
222
+ (gate): MuseSparkTopkRouter(
223
+ (scoring_function): Sigmoid()
224
+ )
225
+ (pre_expert_proj): Linear(in_features=8, out_features=4, bias=False)
226
+ (pre_expert_norm): MuseSparkTextCenteredRMSNorm((4,), eps=1e-05)
227
+ (experts): MuseSparkExperts(
228
+ (act_fn): SiLUActivation()
229
+ (post_expert_norm): MuseSparkTextInputScaledRMSNorm((4,), eps=1e-08)
230
+ )
231
+ (post_expert_proj): Linear(in_features=4, out_features=8, bias=False)
232
+ )
233
+ (input_layernorm): MuseSparkTextCenteredRMSNorm((8,), eps=1e-05)
234
+ (post_attention_layernorm): MuseSparkRMSNorm()
235
+ (pre_feedforward_layernorm): MuseSparkTextCenteredRMSNorm((8,), eps=1e-05)
236
+ (post_feedforward_layernorm): MuseSparkTextInputScaledRMSNorm((8,), eps=1e-08)
237
+ (post_attention_residual_gate): MuseSparkResidualGate()
238
+ (post_feedforward_residual_gate): MuseSparkResidualGate()
239
+ )
240
+ )
241
+ (norm): MuseSparkRMSNorm()
242
+ (rotary_emb): MuseSparkTextRotaryEmbedding()
243
+ )
244
+ (vision_adapter): MuseSparkVisionAdapter(
245
+ (fc1): Linear(in_features=128, out_features=16, bias=False)
246
+ (act): GELUActivation()
247
+ (fc2): Linear(in_features=16, out_features=16, bias=False)
248
+ )
249
+ (vision_projection): Linear(in_features=16, out_features=8, bias=False)
250
+ (perception_emb_norm): MuseSparkRMSNorm()
251
+ (audio_tower): MuseSparkAudioModel(
252
+ (layers): ModuleList(
253
+ (0): MuseSparkAudioLayer(
254
+ (patch_embedder): MuseSparkAudioPatchEmbedding(
255
+ (proj): Linear(in_features=16, out_features=8, bias=True)
256
+ (norm): MuseSparkRMSNorm()
257
+ )
258
+ (conv_blocks): ModuleList(
259
+ (0-1): 2 x MuseSparkAudioConvBlock(
260
+ (conv): MuseSparkAudioCausalConv1d(8, 8, kernel_size=(7,), stride=(1,), groups=8)
261
+ (norm): MuseSparkRMSNorm()
262
+ (mlp): MuseSparkAudioMLP(
263
+ (fc1): Linear(in_features=8, out_features=32, bias=True)
264
+ (fc2): Linear(in_features=32, out_features=8, bias=True)
265
+ (activation_fn): GELUActivation()
266
+ )
267
+ )
268
+ )
269
+ )
270
+ (1): MuseSparkAudioLayer(
271
+ (patch_embedder): MuseSparkAudioPatchEmbedding(
272
+ (proj): Linear(in_features=48, out_features=16, bias=True)
273
+ (norm): MuseSparkRMSNorm()
274
+ )
275
+ (conv_blocks): ModuleList(
276
+ (0-1): 2 x MuseSparkAudioConvBlock(
277
+ (conv): MuseSparkAudioCausalConv1d(16, 16, kernel_size=(7,), stride=(1,), groups=16)
278
+ (norm): MuseSparkRMSNorm()
279
+ (mlp): MuseSparkAudioMLP(
280
+ (fc1): Linear(in_features=16, out_features=64, bias=True)
281
+ (fc2): Linear(in_features=64, out_features=16, bias=True)
282
+ (activation_fn): GELUActivation()
283
+ )
284
+ )
285
+ )
286
+ )
287
+ (2): MuseSparkAudioLayer(
288
+ (patch_embedder): MuseSparkAudioPatchEmbedding(
289
+ (proj): Linear(in_features=80, out_features=32, bias=True)
290
+ (norm): MuseSparkRMSNorm()
291
+ )
292
+ (conv_blocks): ModuleList(
293
+ (0-1): 2 x MuseSparkAudioConvBlock(
294
+ (conv): MuseSparkAudioCausalConv1d(32, 32, kernel_size=(7,), stride=(1,), groups=32)
295
+ (norm): MuseSparkRMSNorm()
296
+ (mlp): MuseSparkAudioMLP(
297
+ (fc1): Linear(in_features=32, out_features=128, bias=True)
298
+ (fc2): Linear(in_features=128, out_features=32, bias=True)
299
+ (activation_fn): GELUActivation()
300
+ )
301
+ )
302
+ )
303
+ )
304
+ (3): MuseSparkAudioLayer(
305
+ (patch_embedder): MuseSparkAudioPatchEmbedding(
306
+ (proj): Linear(in_features=128, out_features=64, bias=True)
307
+ (norm): MuseSparkRMSNorm()
308
+ )
309
+ (conv_blocks): ModuleList(
310
+ (0-1): 2 x MuseSparkAudioConvBlock(
311
+ (conv): MuseSparkAudioCausalConv1d(64, 64, kernel_size=(7,), stride=(1,), groups=64)
312
+ (norm): MuseSparkRMSNorm()
313
+ (mlp): MuseSparkAudioMLP(
314
+ (fc1): Linear(in_features=64, out_features=256, bias=True)
315
+ (fc2): Linear(in_features=256, out_features=64, bias=True)
316
+ (activation_fn): GELUActivation()
317
+ )
318
+ )
319
+ )
320
+ )
321
+ )
322
+ (norm): MuseSparkRMSNorm()
323
+ (proj): Linear(in_features=64, out_features=8, bias=True)
324
+ (post_proj_norm): MuseSparkRMSNorm()
325
+ )
326
+ )
327
+ (lm_head): Linear(in_features=8, out_features=202048, bias=False)
328
+ )
329
+ ```
330
+
331
+ </details>
332
+
333
+ Environment: [.meta.json](.meta.json)
334
+
335
+ ### Change log:
336
+
337
+ - 2026-10-26: Created a tiny Muse Spark Open checkpoint preserving text, image, video and audio inputs.
338
+
339
+ This repo is generated by GPT-6.1-Sol
USE_POLICY.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **Muse Spark Open Usage Policy**
2
+
3
+ Dated: October 15, 2026
4
+
5
+ Meta is committed to promoting safe and fair use of its tools and features, including Muse Spark Open. This Usage Policy (“Policy”) applies to your access or use of Muse Spark Open and any Derivatives.
6
+
7
+ Prohibited Uses
8
+
9
+ We want everyone to use Muse Spark Open safely and responsibly. It is your obligation to ensure that any deployment of the model to end-users is safe, taking into account the deployment context and the user-base. Muse Spark Open is not intended for individuals under the age of 18\.
10
+
11
+ You should not use, or allow others to use, Muse Spark Open to:
12
+
13
+ 1. Violate the law or others' rights, including to:
14
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
15
+ 1. Violence or terrorism
16
+ 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
17
+ 3. Human trafficking, exploitation, and sexual violence
18
+ 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials
19
+ 5. Sexual solicitation
20
+ 6. Any other criminal activity
21
+ 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
22
+ 3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
23
+ 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
24
+ 5. Collect, process, disclose, generate, or infer private or sensitive information about individuals, including information about individuals' identity, health, or demographic information, unless you have obtained the right to do so in accordance with applicable law
25
+ 6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using Muse Spark Open
26
+ 7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
27
+ 8. Engage in any action, or facilitate any action, to intentionally circumvent or remove usage restrictions or other safety measures, or to enable functionality disabled by Meta
28
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Muse Spark Open related to the following:
29
+ 1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State or to the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons Convention Implementation Act of 1997
30
+ 2. Guns and illegal weapons (including weapon development)
31
+ 3. Illegal drugs and regulated/controlled substances
32
+ 4. Operation of critical infrastructure, transportation technologies, or heavy machinery
33
+ 5. Self-harm or harm to others, including suicide, cutting, and eating disorders
34
+ 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
35
+ 3. Intentionally deceive or mislead others, including use of Muse Spark Open related to the following:
36
+ 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
37
+ 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
38
+ 3. Generating, promoting, or further distributing spam
39
+ 4. Impersonating another individual without consent, authorization, or legal right
40
+ 5. Representing that the use of Muse Spark Open or outputs are human generated
41
+ 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
42
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
43
+ 5. Interact with third party tools, models, or software designed to generate unlawful content or engage in unlawful or harmful conduct and/or represent that the outputs of such tools, models, or software are associated with Meta or Muse Spark Open
chat_template.jinja ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
14
+ form "<|...|>"; the bare media placeholders are broken because the
15
+ multimodal processor rewrites them positionally and a literal one in text
16
+ would desynchronise placeholders from the attached media. -#}
17
+ {%- macro esc(value) -%}
18
+ {{- value | string
19
+ | replace('<|', '< |')
20
+ | replace('<image>', '< image>')
21
+ | replace('<video>', '< video>')
22
+ | replace('<audio>', '< audio>') -}}
23
+ {%- endmacro -%}
24
+
25
+ {%- macro esc_header(value) -%}
26
+ {{- esc(value) | replace('\r', ' ') | replace('\n', ' ') -}}
27
+ {%- endmacro -%}
28
+
29
+ {%- macro esc_attr(value) -%}
30
+ {{- esc_header(value)
31
+ | replace('&', '&amp;')
32
+ | replace('"', '&quot;')
33
+ | replace("'", '&#39;')
34
+ | replace('<', '&lt;')
35
+ | replace('>', '&gt;') -}}
36
+ {%- endmacro -%}
37
+
38
+ {%- macro render_content(content) -%}
39
+ {%- if content is string -%}
40
+ {{- esc(content) -}}
41
+ {%- elif content is not none -%}
42
+ {%- for part in content -%}
43
+ {%- set part_type = part.get('type', '') -%}
44
+ {%- if part_type in ['image', 'input_image', 'image_url'] -%}
45
+ {{- '<|patch|>' -}}
46
+ {%- elif part_type in ['video', 'input_video', 'video_url'] -%}
47
+ {{- '<|video|>' -}}
48
+ {%- elif part_type in ['audio', 'input_audio', 'audio_url'] -%}
49
+ {{- '<|audio|>' -}}
50
+ {%- elif part_type in ['text', 'input_text', 'output_text'] -%}
51
+ {{- esc(part.get('text', '')) -}}
52
+ {%- endif -%}
53
+ {%- endfor -%}
54
+ {%- endif -%}
55
+ {%- endmacro -%}
56
+
57
+ {%- macro render_atem(tc) -%}
58
+ {%- set args = tc.function.arguments -%}
59
+ {%- if args is not mapping -%}
60
+ {{- raise_exception('This chat template requires tool_call.function.arguments to be a dict (mapping). The jinja sandbox has no JSON parser, so deserialize the arguments string before calling apply_chat_template.') -}}
61
+ {%- endif -%}
62
+ {{- '<atem:function_calls>\n<atem:invoke name="' -}}{{- esc_attr(tc.function.name) -}}{{- '">\n' -}}
63
+ {%- for k, v in args.items() -%}
64
+ {{- '<atem:parameter name="' -}}{{- esc_attr(k) -}}{{- '">' -}}
65
+ {%- if v is boolean -%}
66
+ {%- if v -%}
67
+ true
68
+ {%- else -%}
69
+ false
70
+ {%- endif -%}
71
+ {%- elif v is none -%}
72
+ null
73
+ {%- elif v is mapping or (v is iterable and v is not string) -%}
74
+ {{- esc(v | tojson) -}}
75
+ {%- else -%}
76
+ {{- esc(v) -}}
77
+ {%- endif -%}
78
+ {{- '</atem:parameter>\n' -}}
79
+ {%- endfor -%}
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' -}}
147
+ {{- 'to=example_tool_name_1.example_function_name_1\n\n' -}}
148
+ {{- '<atem:function_calls>\n<atem:invoke name="example_tool_name_1.example_function_name_1">\n' -}}
149
+ {{- '<atem:parameter name="example_parameter_1">value_1</atem:parameter>\n' -}}
150
+ {{- '</atem:invoke>\n</atem:function_calls>\n\n' -}}
151
+ {{- 'to=example_tool_name_2.example_function_name_2\n\n' -}}
152
+ {{- '<atem:function_calls>\n<atem:invoke name="example_tool_name_2.example_function_name_2">\n' -}}
153
+ {{- '<atem:parameter name="example_parameter_2">This is the value for the second parameter\nthat can span\n"multiple" lines\n</atem:parameter>\n' -}}
154
+ {{- '<atem:parameter name="example_parameter_3">value_3</atem:parameter>\n' -}}
155
+ {{- '</atem:invoke>\n</atem:function_calls>' -}}
156
+ {%- endmacro -%}
157
+
158
+ {%- macro render_valid_recipients(tools) -%}
159
+ {%- set rns = namespace(recipients=[]) -%}
160
+ {{- 'Use the appropriate recipient for each message:\n\n' -}}
161
+ {%- set rns.recipients = rns.recipients + ['"self"'] -%}
162
+ {{- '- "self": private reasoning and tool planning.\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"'] -%}
178
+ {{- '- "user": messages that end the assistant turn, such as a completed response or clarification question that waits for the user\'s reply; do not use for pre-tool updates or partial responses.\n' -}}
179
+ {{- '\n# Valid recipients: ' ~ rns.recipients | join(', ') ~ '.' -}}
180
+ {%- endmacro -%}
181
+
182
+ {{- bos_token -}}
183
+ {%- set ns = namespace(instructions=none, rest=messages) -%}
184
+ {%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
185
+ {%- set ns.instructions = render_content(messages[0]['content'])
186
+ | replace('Reasoning effort', 'Reasoning strength')
187
+ | replace('Reasoning Effort', 'Reasoning Strength')
188
+ | replace('reasoning effort', 'reasoning strength')
189
+ | replace('REASONING EFFORT', 'REASONING STRENGTH') -%}
190
+ {%- set ns.rest = messages[1:] -%}
191
+ {%- endif -%}
192
+ {%- set sys = namespace(parts=['You are a helpful AI assistant.', 'Knowledge cutoff: ' ~ cutoff_date ~ '.']) -%}
193
+ {%- if current_date -%}
194
+ {%- set sys.parts = sys.parts + ['Current date: ' ~ current_date ~ '.'] -%}
195
+ {%- endif -%}
196
+ {%- if ns.instructions -%}
197
+ {%- set sys.parts = sys.parts + [ns.instructions] -%}
198
+ {%- endif -%}
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] -%}
206
+ {{- '<|start|>system<|message|>' ~ sys.parts | join('\n\n') ~ '<|eot|>' -}}
207
+ {%- for message in ns.rest -%}
208
+ {%- set role = message['role'] -%}
209
+ {%- set end_token = '<|eom|>' if (not loop.last and ns.rest[loop.index0 + 1]['role'] == role) else '<|eot|>' -%}
210
+ {%- if role in ['system', 'developer'] -%}
211
+ {{- '<|start|>' + role + '<|message|>' -}}
212
+ {{- render_content(message['content']) -}}
213
+ {{- '<|eot|>' -}}
214
+ {%- elif role == 'user' -%}
215
+ {{- '<|start|>user<|message|>' -}}
216
+ {%- if message.get('render_timestamp') and message.get('timestamp') -%}
217
+ {%- set ts = message['timestamp'] -%}
218
+ {%- if ts is string -%}
219
+ {{- '[' ~ esc_header(ts) ~ '] ' -}}
220
+ {%- elif ts.strftime is defined -%}
221
+ {{- '[' ~ (ts.strftime('%a %Y-%m-%d %H:%M %Z') | trim) ~ '] ' -}}
222
+ {%- endif -%}
223
+ {%- endif -%}
224
+ {{- render_content(message['content']) -}}
225
+ {{- '<|eot|>' -}}
226
+ {%- elif role == 'tool' -%}
227
+ {%- set tname = message.get('name') -%}
228
+ {%- if not tname -%}
229
+ {%- set tcid = message.get('tool_call_id') -%}
230
+ {%- set tns = namespace(name=tcid if tcid else '') -%}
231
+ {%- for m in messages -%}
232
+ {%- if m.get('tool_calls') -%}
233
+ {%- for tc in m['tool_calls'] -%}
234
+ {%- if tcid is not none and tc.id is defined and tc.id == tcid -%}
235
+ {%- set tns.name = tc.function.name -%}
236
+ {%- endif -%}
237
+ {%- endfor -%}
238
+ {%- endif -%}
239
+ {%- endfor -%}
240
+ {%- set tname = tns.name -%}
241
+ {%- endif -%}
242
+ {%- if not tname -%}
243
+ {{- raise_exception('tool message has no name and no matching tool_call_id') -}}
244
+ {%- endif -%}
245
+ {{- '<|start|>tool ' -}}{{- esc_header(tname) -}}{{- '<|message|><tool_output name="' -}}{{- esc_attr(tname) -}}{{- '">\n' -}}
246
+ {{- render_content(message['content']) -}}
247
+ {{- '\n</tool_output><|eot|>' -}}
248
+ {%- elif role == 'assistant' -%}
249
+ {%- generation %}
250
+ {%- set reasoning = message.get('reasoning_content') or message.get('reasoning') -%}
251
+ {%- if reasoning -%}
252
+ {{- '<|start|>assistant to=self<|message|>' -}}{{- esc(reasoning) -}}{{- '<|eom|>' -}}
253
+ {%- endif -%}
254
+ {%- set body = render_content(message.get('content')) -%}
255
+ {%- if message.get('tool_calls') -%}
256
+ {%- if body -%}
257
+ {{- '<|start|>assistant to=commentary<|message|>' + body + '<|eom|>' -}}
258
+ {%- endif -%}
259
+ {%- for tc in message['tool_calls'] -%}
260
+ {{- '<|start|>assistant to=' -}}{{- esc_header(tc.function.name) -}}{{- '<|message|>' -}}
261
+ {{- render_atem(tc) -}}
262
+ {{- (end_token if loop.last else '<|eom|>') -}}
263
+ {%- endfor -%}
264
+ {%- elif body or not reasoning -%}
265
+ {%- set recipient = message.get('recipient') or 'user' -%}
266
+ {%- if recipient == 'user' -%}
267
+ {%- set end_turn = true -%}
268
+ {%- elif recipient in ['self', 'commentary'] -%}
269
+ {%- set end_turn = false -%}
270
+ {%- elif message.get('end_turn') is not none -%}
271
+ {%- set end_turn = message.get('end_turn') -%}
272
+ {%- else -%}
273
+ {%- set end_turn = false -%}
274
+ {%- endif -%}
275
+ {{- '<|start|>assistant to=' -}}{{- esc_header(recipient) -}}{{- '<|message|>' -}}
276
+ {{- body -}}
277
+ {{- ('<|eot|>' if end_turn else '<|eom|>') -}}
278
+ {%- endif -%}
279
+ {%- endgeneration %}
280
+ {%- endif -%}
281
+ {%- endfor -%}
282
+ {%- if add_generation_prompt -%}
283
+ {{- '<|start|>assistant' -}}
284
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MuseSparkForConditionalGeneration"
4
+ ],
5
+ "audio_config": {
6
+ "conv_kernel_size": 7,
7
+ "depths": [
8
+ 2,
9
+ 2,
10
+ 2,
11
+ 2
12
+ ],
13
+ "hidden_act": "gelu",
14
+ "hidden_sizes": [
15
+ 8,
16
+ 16,
17
+ 32,
18
+ 64
19
+ ],
20
+ "initializer_range": 0.02,
21
+ "mlp_ratio": 4.0,
22
+ "model_type": "muse_spark_audio",
23
+ "num_hidden_layers": 4,
24
+ "out_hidden_size": 8,
25
+ "patch_sizes": [
26
+ 16,
27
+ 6,
28
+ 5,
29
+ 4
30
+ ],
31
+ "rms_norm_eps": 1e-06
32
+ },
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": 16,
40
+ "text_config": {
41
+ "attention_bias": false,
42
+ "attention_dropout": 0.0,
43
+ "bos_token_id": 200000,
44
+ "eos_token_id": 200001,
45
+ "final_logit_softcapping": 20.0,
46
+ "head_dim": 32,
47
+ "hidden_act": "silu",
48
+ "hidden_size": 8,
49
+ "initializer_range": 0.02,
50
+ "intermediate_size": 32,
51
+ "layer_rope_theta": [
52
+ 500000.0,
53
+ 0,
54
+ 500000.0,
55
+ 500000.0,
56
+ 500000.0,
57
+ 0,
58
+ 500000.0,
59
+ 500000.0
60
+ ],
61
+ "layer_types": [
62
+ "sliding_attention",
63
+ "full_attention",
64
+ "sliding_attention",
65
+ "sliding_attention",
66
+ "sliding_attention",
67
+ "full_attention",
68
+ "sliding_attention",
69
+ "sliding_attention"
70
+ ],
71
+ "max_position_embeddings": 1048576,
72
+ "mlp_layer_types": [
73
+ "sparse",
74
+ "sparse",
75
+ "sparse",
76
+ "sparse",
77
+ "sparse",
78
+ "sparse",
79
+ "sparse",
80
+ "sparse"
81
+ ],
82
+ "model_type": "muse_spark_text",
83
+ "moe_hidden_size": 4,
84
+ "moe_intermediate_size": 16,
85
+ "num_attention_heads": 8,
86
+ "num_experts_per_tok": 8,
87
+ "num_hidden_layers": 8,
88
+ "num_key_value_heads": 1,
89
+ "num_local_experts": 32,
90
+ "num_shared_experts": 0,
91
+ "output_multiplier": 0.17677669529663687,
92
+ "pad_token_id": 200018,
93
+ "post_norm_eps": 1e-08,
94
+ "qk_scale_factor": 5.4730064863875,
95
+ "residual_gate_temperature": 0.3,
96
+ "rms_norm_eps": 1e-05,
97
+ "rope_parameters": {
98
+ "rope_theta": 500000.0,
99
+ "rope_type": "default"
100
+ },
101
+ "routed_scaling_factor": 1.0,
102
+ "sliding_window": 2048,
103
+ "tie_word_embeddings": false,
104
+ "use_cache": true,
105
+ "vocab_size": 202048
106
+ },
107
+ "transformers_version": "5.18.0.dev0",
108
+ "video_token_id": 200091,
109
+ "vision_config": {
110
+ "hidden_act": "gelu",
111
+ "hidden_size": 32,
112
+ "intermediate_size": 64,
113
+ "layer_norm_eps": 1e-05,
114
+ "layer_types": [
115
+ "window_attention",
116
+ "window_attention",
117
+ "window_attention",
118
+ "full_attention",
119
+ "window_attention",
120
+ "window_attention",
121
+ "window_attention",
122
+ "full_attention"
123
+ ],
124
+ "max_position_embeddings": 1024,
125
+ "merge_size": 2,
126
+ "model_type": "muse_spark_vision",
127
+ "num_attention_heads": 4,
128
+ "num_hidden_layers": 8,
129
+ "patch_size": 14,
130
+ "patch_temporal": 2,
131
+ "pos_emb_height": 32,
132
+ "pos_emb_width": 32,
133
+ "rope_parameters": {
134
+ "rope_theta": 10000,
135
+ "rope_type": "axial"
136
+ }
137
+ }
138
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 200000,
3
+ "eos_token_id": [
4
+ 200001,
5
+ 200008
6
+ ],
7
+ "pad_token_id": 200018,
8
+ "max_length": 1048576,
9
+ "do_sample": true,
10
+ "temperature": 1.0,
11
+ "top_p": 1,
12
+ "top_k": 64
13
+ }
l4_200k_base ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c02cbb78eeafd5167e2e578216448b487c7f28f61288771b76f11a2df38f8f6
3
+ size 7211288
processor_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "feature_extractor": {
3
+ "feature_extractor_type": "MuseSparkFeatureExtractor",
4
+ "feature_size": 1,
5
+ "padding_side": "right",
6
+ "padding_value": 0.0,
7
+ "return_attention_mask": true,
8
+ "samples_per_token": 1920,
9
+ "sampling_rate": 24000
10
+ },
11
+ "image_processor": {
12
+ "do_convert_rgb": true,
13
+ "do_normalize": true,
14
+ "do_rescale": true,
15
+ "do_resize": true,
16
+ "image_mean": [
17
+ 0.5,
18
+ 0.5,
19
+ 0.5
20
+ ],
21
+ "image_processor_type": "MuseGlimmerImageProcessor",
22
+ "image_std": [
23
+ 0.5,
24
+ 0.5,
25
+ 0.5
26
+ ],
27
+ "max_image_tokens": 4096,
28
+ "merge_size": 2,
29
+ "patch_size": 14,
30
+ "resample": 1,
31
+ "rescale_factor": 0.00392156862745098,
32
+ "temporal_patch_size": 2
33
+ },
34
+ "processor_class": "MuseSparkProcessor",
35
+ "video_processor": {
36
+ "do_convert_rgb": true,
37
+ "do_normalize": true,
38
+ "do_rescale": true,
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,
46
+ 0.5
47
+ ],
48
+ "image_std": [
49
+ 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,
59
+ "return_metadata": true,
60
+ "temporal_patch_size": 2,
61
+ "video_processor_type": "MuseGlimmerVideoProcessor"
62
+ }
63
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|begin_of_text|>",
3
+ "eos_token": "<|end_of_text|>",
4
+ "pad_token": "<|finetune_right_pad|>"
5
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac2f41ef2444dec82fdc90e334f80543f298535005fe78aec7e8311ef86f84d0
3
+ size 28085854
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff