Muse Spark Open 是 Meta 推出的一款开源权重模型。这款混合专家(MoE)模型将文本、图像、音频和视频整合到一个拥有约 8160 亿参数的模型中,每个 token 激活约 420 亿参数,上下文窗口长达一百万个 token。它生成文本,为开发者提供了一个统一的接口,用于针对不同种类的输入提出问题。
继 Muse Glimmer 之后,Muse Spark Open 以更大的规模引入了混合专家架构,成为迄今为止最强大的美国开源权重模型。
Meta 针对代理式编程(agentic coding)训练了 Muse Spark Open:阅读代码库、编写和调试代码以及调用工具。它还接受图像、音频和视频作为输入,因此同一个模型可以在处理代码的同时读取截图、听取语音笔记或观看屏幕录制。本文展示了如何运行它、如何对其进行微调,以及我们用它构建了什么内容。在此处找到所有模型。
整体能力与架构
Meta 将 Muse Spark Open 描述为一个针对编码优化的模型,在真实开发者工作流(如多文件重构和长时间调试会话)上进行训练。Muse Spark Open 是一个专注于代理任务的模型,能够规划、行动、观察并在长任务中自我纠正,包括使用图像浏览网页。
| 特性 | Muse Spark Open |
|---|---|
| 模型大小 | ~816B 总参数;~42B 每个 token 激活参数 |
| 专家路由 | MoE 层每层 256 个专家;每个 token 选择 8 个 |
| 输入 | 文本、图像、音频和视频 |
| 输出 | 文本 |
| 上下文窗口 | 高达 1M tokens |
| 检查点格式 | BF16 和 NVFP4 |
检查点仓库为 Muse-Spark-Open-816B-A42B 和 Muse-Spark-Open-816B-A42B-NVFP4。
Muse Spark Open 是 Muse 系列模型的完整尺寸版本。Meta 于八月发布的 Muse Glimmer 是该系列的较小稠密模型,非常适合本地运行。这两个模型使用相同的分词器和词汇表。聊天模板遵循 Muse Glimmer 的模板,并增加了对新模态的支持。在 Muse Spark Open 中,输入嵌入层和输出层是各自约 16.6 亿参数的独立矩阵。
混合专家
该语言模型有 62 层,隐藏维度为 8192。每层有 128 个查询头和 16 个键值头(分组查询注意力)。每个头的维度为 64。注意力块包含一个输出门和一个输出归一化层。该模型还对查询和键应用归一化(QK-norm)。每个块通过一个学习的残差门将输入和输出结合起来,而不是通过简单的求和。
Muse Glimmer 在每层使用一个稠密的前馈网络。Muse Spark Open 用混合专家(MoE)块替换了这个稠密网络。每个 MoE 块有 256 个专家,路由器为每个 token 选择 8 个专家。每个专家都是一个前馈网络,将维度从 8192 投影到 4096,再投影回 8192,然后对其输出应用自己的归一化。这些专家持有模型总参数的约 97%。
每个 token 仅运行 8 个专家,因此该模型计算每个 token 时仅使用约 420 亿参数。所有 256 个专家都保留在内存中,因此部署需要相当于 8160 亿参数模型的内存,但运行速度却达到 420 亿参数模型的速度。BF16 检查点约为 1.5 TB(safetensors 格式)。NVFP4 检查点以 4 位精度存储参数,在 NVIDIA Blackwell GPU 上几乎不损失准确性。在 transformers 中,BF16 检查点在 4 个节点上运行,每个节点配备 8 块 H200 GPU,采用张量并行(TP=32);而 NVFP4 在单个 B200 节点上运行。如果您希望部署 Muse Spark Open,请参阅下方的 llama.cpp、vLLM 和 SGLang 配方。
感知编码器
感知编码器将图像和视频帧转换为语言模型的令牌,就像 Muse Glimmer 一样。该编码器拥有 18 亿参数、50 层结构、1536 的隐藏维度以及 16 个注意力头。它将每张图像分割为 14×14 的补丁,并生成具有 4096 维的特征。位置信息来自学习的绝对嵌入和 2D RoPE。每一层中的前馈网络使用 LayerNorm 和 GELU。每隔四层以及最后一层使用全注意力机制,而其他层则使用稀疏注意力机制。
Muse Glimmer 30B 使用具有相同架构的编码器。该设计遵循 Meta 的感知编码器(Perception Encoder)工作成果。视频输入通过与图像相同的编码器进行处理。
音频编码器
Muse Spark Open 通过其音频编码器接受音频作为输入。音频标记器将音频转换为令牌,聊天模板使用 <|audio|> 令牌标记音频位置。编码器每 80 毫秒输出一个音频令牌,即每秒产生 12.5 个令牌。因此,假设你有一段 10 秒的音频,输入的音频令牌数量将为 125。
该编码器本身是一个卷积金字塔,其中每个阶段由不同补丁大小的补丁嵌入器和两个具有大小为 7、步幅为 1 的一维内核的卷积块组成。这些阶段针对 [16, 6, 5, 4] 的补丁大小重复执行。在最终阶段的末尾,时间帧被输入到一个由 RMSNorm → 线性投影 → RMSNorm 组成的最终块中。
长上下文
推理时的上下文窗口为 100 万令牌。配置将 max_position_embeddings 设置为 1,048,576。这包括与文本在同一窗口中的图像、视频和音频令牌。
分组查询注意力(Grouped-query attention)使这种规模的模型的 KV 缓存保持较小。每个令牌向缓存添加 2 × 16 个头 × 64 维 × 62 层 = 126,976 个值。在 BF16 精度下,这相当于每个令牌约 250 KB,对于完整的 100 万令牌上下文则约为 266 GB。
推理支持
Transformers
Muse Spark Open 的实现提供了 MuseSparkForConditionalGeneration 用于从多模态输入生成文本,以及 MuseSparkProcessor 用于准备对话。处理器结合了标记器、图像和视频处理器、音频特征提取器和聊天模板。
使用 DistributedConfig 配置并行设置。tp_size 是密集层分片跨越的设备数量,ep_size 是专家分布跨越的设备数量。
你可以按以下方式初始化模型和处理器。
import os
from transformers import AutoModelForMultimodalLM, AutoTokenizer, DistributedConfig
distributed_config = DistributedConfig(
tp_size= int (os.environ[ "WORLD_SIZE" ]),
ep_size= int (os.environ[ "WORLD_SIZE" ]),
)
tokenizer = AutoTokenizer.from_pretrained( "meta-models/Muse-Spark-Open-816B-A42B
" )
model = AutoModelForMultimodalLM.from_pretrained(
"meta-models/Muse-Spark-Open-816B-A42B" ,
distributed_config=distributed_config,
)
messages = [
{ "role" : "user" , "content" : "Explain in one sentence why the sky is usually blue." },
]
inputs = tokenizer.apply_chat_template(
messages,
reasoning_effort= "medium" ,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
).to(model.device).to(model.dtype)
input_len = inputs[ "input_ids" ].shape[- 1 ]
outputs = model.generate(**inputs, max_new_tokens= 2000 )
纯文本推理
准备好对话后,将消息传递给 processor.apply_chat_template,设置 add_generation_prompt=True、tokenize=True、return_dict=True 以及 return_tensors="pt"。将处理器的输出传递给 model.generate 并对新生成的 token 进行解码,同时排除输入前缀部分。处理器提供了一个用于控制推理强度的杠杆,它将符号级别(low/medium/high/xhigh)映射为模型本身接受的整数(16, 64, 256, 512)。请注意,Muse Spark Open 无法关闭推理功能,因此如果你希望以更少的 token 消耗来解决较简单的任务,请将模型的推理强度保持在“low”。你也可以通过在系统提示中包含类似 “Reasoning strength: 1” 的行来设置具体的数值强度。
messages = [
{ "role" : "system" , "content" : "You should only answer with a number." },
{ "role" : "user" , "content" : "What is 17 * 23?" },
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
reasoning_effort= "high" ,
).to(model.device).to(model.dtype)
output = model.generate(**inputs, max_new_tokens= 2000 )
generated_tokens = output[ 0 ][inputs[ "input_ids" ].shape[ 1 ] :]
print (processor.decode(generated_tokens, skip_special_tokens= False ))
图像与文本
Muse Spark Open 处理器将每个图像标记扩展为处理后的图像所需的 patch token 数量,并用图像边界 token 包围。这种扩展保持了文本位置与传递给模型的视觉特征之间的对齐。该处理器还能处理单个提示中的多张图像。
image_url = (
"https://huggingface.co/datasets/merve/vl-test-suite/"
"resolve/main/pills.jpg"
)
messages = [
{
"role" : "user" ,
"content" : [
{
"type" : "image" ,
"image" : image_url,
},
{
"type" : "text" ,
"text" : "Do any of the components in this supplement interact?" ,
},
],
},
]
inputs = processor.apply_chat_template(
messages,
tokenize= True ,
add_generation_prompt= True ,
reasoning_effort= "medium" ,
return_dict= True ,
return_tensors= "pt" ,
).to(model.device).to(model.dtype)
input_len = inputs[ "input_ids" ].shape[- 1 ]
outputs = model.generate(**inputs, max_new_tokens= 2000 )
response = processor.decode(outputs[ 0 ][input_len:], skip_special_tokens= False )
processor.parse_response(response)
视频推理
视频提示包括帧时间戳以及视觉内容。处理器处理包含音频的视频(得益于音频编码器,这是 Muse Glimmer 的升级功能)。处理器会对视频帧和音频进行下采样以对齐帧。默认情况下,视频采样率为 2 FPS,上限为 96 帧。你可以通过设置视频处理器的 fps 来修改此参数:
processor.video_processor.fps = 4.0
作为一般经验法则,视频是按时间顺序排列的帧,下采样越多,特定事件之间的帧丢失就越多,因此如果你希望获得更准确的生成结果,需要保持较高的 fps。然而,这存在权衡,因为你需要更多的内存并增加预填充阶段的延迟。帧与表示时间戳的文本输入交错(例如 “Time: 3.5s”)。要启用传入带音频的视频,请将 load_audio_from_video=True 传递给 apply_chat_template 。
在使用 return_metadata=True 准备输入时保留视频的元数据,以便处理器分配正确的帧率。
import torch
messages = [
{
"role" : "user" ,
"content" : [
{
"type" : "text" ,
"text" : (
"Describe what happens in this video. "
"Use timestamps and include relevant speech or sounds."
),
},
{
"type" : "video" ,
"url" : "https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/ramen.mp4"
},
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
load_audio_from_video= True ,
return_metadata= True ,
).to(model.device).to(model.dtype)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
max_new_tokens= 256 ,
do_sample= False ,
)
generated_ids = output_ids[:, inputs[ "input_ids" ].shape[ 1 ] :]
response = processor.batch_decode(
generated_ids,
skip_special_tokens= True ,
)[ 0 ]
print (response)
音频推理
Muse Spark Open 音频塔接收原始波形。处理器期望采样率为 24 kHz 的单声道音频,并将波形填充至样本数的 1,920 的倍数,这对应于每 80 毫秒一个音频嵌入。如果以其他采样率直接向处理器提供音频,则必须先进行重采样。你可以使用 transformers 中的 load_audio 工具来实现这一点。load_audio 使用 torchcodec、librosa 或 torchaudio 后端,因此在运行推理之前,请确保本地已安装其中之一。
不过,如果你只想使用 apply_chat_template 配合消息,这一切都在底层自动处理:
import torch
from transformers import AutoProcessor, AutoModelForMultimodalLM
model_id = "meta-models/Muse-Spark-Open-816B-A42B"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id). eval ()
messages = [
{
"role" : "user" ,
"content" : [
{
"type" : "audio" ,
"url" : "https://huggingface.co/buckets/huggingface/audio-samples/resolve/bbaudio_question_39.mp3" ,
},
{
"type" : "text" ,
"text" : "Answer the question." ,
},
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
load_audio_backend= "auto" ,
).to(model.device).to(model.dtype)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
max_new_tokens= 128 ,
do_sample= False ,
)
prompt_length = inputs[ "input_ids" ].shape[ 1 ]
generated_text = processor.batch_decode(
output_ids[:, prompt_length:],
skip_special_tokens= True ,
)
print (generated_text[ 0 ])
处理器会在音频边界标记之间插入相应数量的音频令牌。它还返回一个掩码以标识真实样本,从而允许模型排除填充的音频嵌入。
工具调用
Muse Spark Open 支持纯文本和多模态工具调用。你可以按以下方式让模型调用工具。
from transformers import AutoProcessor, AutoModelForMultimodalLM
MODEL_ID = "meta-models/Muse-Spark-Open-816B-A42B"
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForMultimodalLM.from_pretrained(
MODEL_ID,
dtype= "auto" ,
device_map= "auto"
)
tools = [
{
"type" : "function" ,
"function" : {
"name" : "weather.get" ,
"description" : "Get the current weather for a city." ,
"parameters" : {
"type" : "object" ,
"properties" : {
"city" : { "type" : "string" },
},
"required" : [ "city" ],
},
},
}
]
messages = [
{
"role" : "user" ,
"content" : [
{ "type" : "image" , "image" : "https://huggingface.co/datasets/merve/vl-test-suite/resolve/main/SF.png" },
{ "type" : "text" , "text" : "I'm going to the city in this picture. What clothes should I wear?" },
],
},
]
inputs = processor.apply_chat_template(
messages,
tools=tools,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
add_generation_prompt= True ,
reasoning_strength= "high"
).to(model.device).to(model.dtype)
input_len = inputs[ "input_ids" ].shape[- 1 ]
outputs = model.generate(**inputs)
response = processor.parse_response(
completion,
prefix=inputs[ "input_ids" ][ 0 ],
tools=tools,
)
print (response)
Muse Spark Open 使用基于通道的聊天模板(Harmony,由 gpt-oss 首次引入)。请注意,你不需要了解内部机制,但检查模型路由到的通道很有用,以防出现低质量输出。在下面的输入消息中:
<|begin_of_text|>
<|start|>system<|message|>
You are a helpful AI assistant.
Knowledge cutoff: 2026-01-04.
Current date: ...
...
<|eot|>
<|start|>user<|message|>...
<|eot|>
<|start|>assistant
assistant intentionally 保持开放,由模型选择接收者,使用 to= 参数。模型有不同的接收者,例如 self 用于让模型进行推理,
to=self<|message|>模型在此处进行推理<|eom|> # 推理
<|start|>assistant to=user<|message|>最终答案<|eot|> # 最终答案
self 用于推理,commentary 是工具调用前后及之间对最终用户可见的注释,user 则是最终回复。
工具调用路由解析如下(假设你已通过 apply_chat_template 传递了工具):
<|start|>assistant to=weather.get<|message|>
<|eot|>
Llama.cpp
在 Llama Server 上运行的 Muse Spark 2-bit 版本
Muse Spark Open 已集成到 llama.cpp 中,并提供预编译二进制文件。你可以使用以下命令安装:
curl -LsSf https://llama.app/install.sh | sh
你可以通过在模型 ID 后附加量化后缀来启动服务器,如下所示:
llama serve -hf ggml-org/Muse-Spark-Open-816B-A42B-GGUF:Q2_K
包含量化的仓库位于此处。一旦服务器启动
Muse Spark Open is an open-weight model from Meta. The mixture of experts model brings text, images, audio, and video into a model with approximately 816 billion parameters, around 42 billion active per token, and a context window of up to one million tokens. It generates text, giving developers a common interface for asking questions about different kinds of input.
Following Muse Glimmer, Muse Spark Open introduces a mixture-of-experts architecture at a much larger scale, and the most capable US open-weights model to date.
Meta trained Muse Spark Open for agentic coding: reading a codebase, writing and debugging code, and calling tools. It also takes images, audio, and video as input, so the same model can read a screenshot, listen to a voice note, or watch a screen recording while it works on your code. This post shows you how to run it, how to fine-tune it, and what we built with it. Find all the models here .
Overall Capabilities and Architecture
Meta describes Muse Spark Open as a coding-optimized model trained on real developer workflows such as multi-file refactors and long debugging sessions. Muse Spark Open is an agentic focused model that plans, acts, observes, and self-corrects over long tasks, including browsing the web with images.
Feature
Muse Spark Open
Model size
~816B total parameters; ~42B active per token
Expert routing
256 experts per MoE layer; 8 selected per token
Inputs
Text, images, audio, and video
Output
Text
Context window
Up to 1M tokens
Checkpoint formats
BF16 and NVFP4
The checkpoint repositories are Muse-Spark-Open-816B-A42B and Muse-Spark-Open-816B-A42B-NVFP4.
Muse Spark Open is the full-size model of the Muse series of models. Muse Glimmer, which Meta released in August, is a small dense model from the same series, ideal for running locally. Both models use the same tokenizer and vocabulary. The chat template follows the Muse Glimmer template, with additions for the new modalities. In Muse Spark Open the input embedding and the output layer are separate matrices of about 1.66B parameters each.
Mixture of Experts
The language model has 62 layers and a hidden dimension of 8192. Each layer has 128 query heads and 16 key-value heads (grouped-query attention). Each head has 64 dimensions. The attention block has an output gate and an output normalization layer. The model also applies normalization to the queries and the keys (QK-norm). Each block combines its input and its output through a learned residual gate, not through a plain sum.
Muse Glimmer uses one dense feed-forward network in each layer. Muse Spark Open replaces this dense network with a Mixture-of-Experts (MoE) block. Each MoE block has 256 experts, and a router selects 8 experts for each token. Each expert is a feed-forward network that projects from 8192 to 4096 dimensions and back to 8192, then applies its own normalization to its output. The experts hold ~97% of the total model parameters.
Only 8 experts run per token, so the model computes each token with about 42B parameters. All 256 experts stay in memory, so deployment needs the memory of an 816B-parameter model, but runs at the much faster speed of a 42B model. The BF16 checkpoint is about 1.5 TB in safetensors format. The NVFP4 checkpoint stores the parameters in 4-bit precision with negligible loss in accuracy, specifically for NVIDIA Blackwell GPUs. In transformers, the BF16 checkpoint runs across 4 nodes of 8 H200 GPUs with tensor parallelism (TP=32) and the NVFP4 runs on a single B200 node. If you want to deploy Muse Spark Open, check out the llama.cpp , vLLM, and SGLang recipes below.
Perception Encoder
A perception encoder converts images and video frames into tokens for the language model, just like Muse Glimmer. The encoder has 1.8B parameters, 50 layers, a hidden dimension of 1536, and 16 attention heads. It splits each image into 14×14 patches and produces features with 4096 dimensions. Position information comes from learned absolute embeddings and 2D RoPE. The feed-forward network in each layer uses LayerNorm and GELU. Every fourth layer and the last layer use full attention, and the other layers use sparse attention.
Muse Glimmer 30B uses an encoder with the same architecture. The design follows the Perception Encoder work from Meta. Video input goes through the same encoder as images.
Audio Encoder
Muse Spark Open accepts audio as input through its audio encoder. An audio tokenizer converts the audio into tokens, and the chat template marks the audio position with <|audio|> tokens. The encoder emits one audio token every 80 ms, which yields 12.5 tokens per second. So let’s say, you have an audio of 10 seconds, the number of input audio tokens would be 125.
The encoder itself is a convolutional pyramid where each stage consists of a patch embedder of different patch sizes and 2 convolutional blocks of 1d kernels of size 7 with stride of 1. These stages are repeated for patch sizes of [16, 6, 5, 4]. At the end of the final stage, the temporal frames are fed to a final block of RMSNorm → linear projection → RMSNorm.
Long Context
The context window is 1M tokens at inference. The configuration sets max_position_embeddings to 1,048,576. This includes image, video, and audio tokens in the same window as text.
Grouped-query attention keeps the KV cache small for a model of this size. Each token adds 2 × 16 heads × 64 dimensions × 62 layers = 126,976 values to the cache. In BF16, this is about 250 KB per token and about 266 GB for a full 1M-token context.
Inference Support
Transformers
The Muse Spark Open implementation provides MuseSparkForConditionalGeneration for text generation from multimodal inputs and MuseSparkProcessor for preparing conversations. The processor combines the tokenizer, image and video processors, audio feature extractor, and chat template.
Use a DistributedConfig to configure the parallelism settings. tp_size is the number of devices across which the dense layers are sharded, and ep_size is the number of devices across which the experts are distributed.
You can initialize the model and processor as follows.
import os
from transformers import AutoModelForMultimodalLM, AutoTokenizer, DistributedConfig
distributed_config = DistributedConfig(
tp_size= int (os.environ[ "WORLD_SIZE" ]),
ep_size= int (os.environ[ "WORLD_SIZE" ]),
)
tokenizer = AutoTokenizer.from_pretrained( "meta-models/Muse-Spark-Open-816B-A42B
" )
model = AutoModelForMultimodalLM.from_pretrained(
"meta-models/Muse-Spark-Open-816B-A42B" ,
distributed_config=distributed_config,
)
messages = [
{ "role" : "user" , "content" : "Explain in one sentence why the sky is usually blue." },
]
inputs = tokenizer.apply_chat_template(
messages,
reasoning_effort= "medium" ,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
).to(model.device).to(model.dtype)
input_len = inputs[ "input_ids" ].shape[- 1 ]
outputs = model.generate(**inputs, max_new_tokens= 2000 )
Text-only Inference
Prepare the conversation, then pass the messages to processor.apply_chat_template , enabling add_generation_prompt=True , tokenize=True , return_dict=True , and return_tensors="pt" . Pass the processor output to model.generate and decode the newly generated tokens, excluding the input prefix. The processor has a lever for the reasoning effort, mapping symbolic levels (low/medium/high/xhigh) to the integers the model itself accepts (16, 64, 256, 512). Note that turning off reasoning is not possible with Muse Spark Open, so keep the model reasoning at “low” if you want to consume less tokens to solve an easier task. You can also set a numeric effort by including a line like Reasoning strength: 1 in the system prompt.
messages = [
{ "role" : "system" , "content" : "You should only answer with a number." },
{ "role" : "user" , "content" : "What is 17 * 23?" },
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
reasoning_effort= "high" ,
).to(model.device).to(model.dtype)
output = model.generate(**inputs, max_new_tokens= 2000 )
generated_tokens = output[ 0 ][inputs[ "input_ids" ].shape[ 1 ] :]
print (processor.decode(generated_tokens, skip_special_tokens= False ))
Images and Text
The Muse Spark Open processor expands each image marker into the number of patch tokens required by the processed image, surrounded by image boundary tokens. This expansion keeps the text positions aligned with the visual features passed to the model. The processor also handles multiple images within a single prompt.
image_url = (
"https://huggingface.co/datasets/merve/vl-test-suite/"
"resolve/main/pills.jpg"
)
messages = [
{
"role" : "user" ,
"content" : [
{
"type" : "image" ,
"image" : image_url,
},
{
"type" : "text" ,
"text" : "Do any of the components in this supplement interact?" ,
},
],
},
]
inputs = processor.apply_chat_template(
messages,
tokenize= True ,
add_generation_prompt= True ,
reasoning_effort= "medium" ,
return_dict= True ,
return_tensors= "pt" ,
).to(model.device).to(model.dtype)
input_len = inputs[ "input_ids" ].shape[- 1 ]
outputs = model.generate(**inputs, max_new_tokens= 2000 )
response = processor.decode(outputs[ 0 ][input_len:], skip_special_tokens= False )
processor.parse_response(response)
Video Inference
Video prompts include frame timing as well as visual content. The processor handles videos with audios in them (which is an upgrade from Muse Glimmer thanks to the audio encoder). The processor downsamples video frames and audio to align frames together. By default, videos are sampled to 2 FPS, capped at 96 frames. You can modify this by setting the fps of the video processor:
processor.video_processor.fps = 4.0
As a general rule of thumb, videos are frames in temporal sequence, and the more you downsample, the more you will lose frames in between specific events, so you need to keep fps high if you want more accurate generations. However, there’s a trade-off because you will require more memory and increase latency for prefill. The frames are interleaved with text input that states timestamps (e.g. “Time: 3.5s”). To enable passing in videos with audio, pass load_audio_from_video=True to apply_chat_template .
Preserve the video's metadata when preparing inputs with return_metadata=True so the processor can assign the correct framerate.
import torch
messages = [
{
"role" : "user" ,
"content" : [
{
"type" : "text" ,
"text" : (
"Describe what happens in this video. "
"Use timestamps and include relevant speech or sounds."
),
},
{
"type" : "video" ,
"url" : "https://huggingface.co/datasets/merve/vlm_test_images/resolve/main/ramen.mp4"
},
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
load_audio_from_video= True ,
return_metadata= True ,
).to(model.device).to(model.dtype)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
max_new_tokens= 256 ,
do_sample= False ,
)
generated_ids = output_ids[:, inputs[ "input_ids" ].shape[ 1 ] :]
response = processor.batch_decode(
generated_ids,
skip_special_tokens= True ,
)[ 0 ]
print (response)
Audio Inference
The Muse Spark Open audio tower consumes a raw waveform. The processor expects mono audio at 24 kHz and pads the waveform to a multiple of 1,920 samples, corresponding to one audio embedding per 80 milliseconds. Audio supplied directly to the processor at another sample rate must first be resampled. You can do this by using the load_audio util of transformers. load_audio uses torchcodec, librosa or torchaudio backends, so make sure to have one of these installed locally before running inference.
If you want to simply use apply_chat_template with messages though, this is all handled for you under the hood:
import torch
from transformers import AutoProcessor, AutoModelForMultimodalLM
model_id = "meta-models/Muse-Spark-Open-816B-A42B"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id). eval ()
messages = [
{
"role" : "user" ,
"content" : [
{
"type" : "audio" ,
"url" : "https://huggingface.co/buckets/huggingface/audio-samples/resolve/bbaudio_question_39.mp3" ,
},
{
"type" : "text" ,
"text" : "Answer the question." ,
},
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt= True ,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
load_audio_backend= "auto" ,
).to(model.device).to(model.dtype)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
max_new_tokens= 128 ,
do_sample= False ,
)
prompt_length = inputs[ "input_ids" ].shape[ 1 ]
generated_text = processor.batch_decode(
output_ids[:, prompt_length:],
skip_special_tokens= True ,
)
print (generated_text[ 0 ])
The processor inserts the matching number of audio tokens between audio boundary markers. It also returns a mask identifying real samples, allowing the model to exclude padded audio embeddings.
Tool Calling
Muse Spark Open can do text-only and multimodal tool calling. You can make the model call tools as follows.
from transformers import AutoProcessor, AutoModelForMultimodalLM
MODEL_ID = "meta-models/Muse-Spark-Open-816B-A42B"
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForMultimodalLM.from_pretrained(
MODEL_ID,
dtype= "auto" ,
device_map= "auto"
)
tools = [
{
"type" : "function" ,
"function" : {
"name" : "weather.get" ,
"description" : "Get the current weather for a city." ,
"parameters" : {
"type" : "object" ,
"properties" : {
"city" : { "type" : "string" },
},
"required" : [ "city" ],
},
},
}
]
messages = [
{
"role" : "user" ,
"content" : [
{ "type" : "image" , "image" : "https://huggingface.co/datasets/merve/vl-test-suite/resolve/main/SF.png" },
{ "type" : "text" , "text" : "I'm going to the city in this picture. What clothes should I wear?" },
],
},
]
inputs = processor.apply_chat_template(
messages,
tools=tools,
tokenize= True ,
return_dict= True ,
return_tensors= "pt" ,
add_generation_prompt= True ,
reasoning_strength= "high"
).to(model.device).to(model.dtype)
input_len = inputs[ "input_ids" ].shape[- 1 ]
outputs = model.generate(**inputs)
response = processor.parse_response(
completion,
prefix=inputs[ "input_ids" ][ 0 ],
tools=tools,
)
print (response)
Muse Spark Open uses a channel-based chat template (Harmony, first introduced by gpt-oss). Note that you don’t have to know about the internals, but it’s useful to check the channels the model routes to, in case you get low quality outputs. In the input message below:
<|begin_of_text|>
<|start|>system<|message|>
You are a helpful AI assistant.
Knowledge cutoff: 2026-01-04.
Current date: ...
...
<|eot|>
<|start|>user<|message|>...
<|eot|>
<|start|>assistant
<|start|>assistant is intentionally left open, it’s the model that chooses recipient with to= . The model has different recipients, e.g. self asks the model to reason,
to=self<|message|>the model reasons here<|eom|> # reasoning
<|start|>assistant to=user<|message|>final answer<|eot|> # final answer
self is for reasoning, commentary are comments before and between tool calls visible to the end user, user is the final response.
Tool-call routing is parsed as follows (assuming you have passed tools to apply_chat_template :
<|start|>assistant to=weather.get<|message|>
<|eot|>
Llama.cpp
Muse Spark 2-bit running on Llama Server
Muse Spark Open is integrated in llama.cpp and comes in the prebuilt binaries. You can install this with following command:
curl -LsSf https://llama.app/install.sh | sh
You can start the server as follows with quant suffix attached to model ID:
llama serve -hf ggml-org/Muse-Spark-Open-816B-A42B-GGUF:Q2_K
The repository containing quants is here . Once the server has
| 刊期 | 得分 | 排名 | 结果 |
|---|---|---|---|
| 2026-10-18 | 8.77 | 22 | 入选 |
| 2026-10-17 | 9.22 | 34 | 未入选 |
| 2026-10-16 | 9.95 | 30 | 未入选 |