分支标签打开更多操作菜单

最新提交

 

历史

57 次提交57 次提交

文件夹和文件

名称名称最后提交信息最后提交日期
assetsassets  
deploydeploy  
docsdocs  
examplesexamples  
scriptsscripts  
.gitignore.gitignore  
LEGAL.mdLEGAL.md  
LICENSELICENSE  
README.mdREADME.md  
cookbook.ipynbcookbook.ipynb  
requirements-client.txtrequirements-client.txt  
requirements-sglang.txtrequirements-sglang.txt  
requirements-transformers.txtrequirements-transformers.txt  
requirements-vllm-omni.txtrequirements-vllm-omni.txt  

仓库文件导航

Ming-3.0-audio-flash

听得清。理解深。行动智。

一款为真实场景语音识别、音频理解、推理和端到端语音交互打造的原生音频模型。

License: MIT Transformers: 5.14.1 Serving: vLLM--Omni Serving: SGLang

🤗 Hugging Face · Flash · 🤗 Hugging Face · Tiny · 🤖 ModelScope · Flash · 📓 示例手册 · 💻 示例


Ming-3.0-audio.mp4

🧩 模型变体

  • Ming-3.0-audio-flash — 一款 126B 参数的混合专家模型,激活参数为 6.5B。下文示例和基准测试结果均使用该模型。
  • Ming-3.0-audio-tiny — 一款紧凑的 9.3B 参数混合专家模型,激活参数为 2.7B。有关检查点详情和使用指南,请参阅其模型卡。

✨ 亮点

  • 🎙️ 复杂语音识别 — 可识别跨方言、口音、嘈杂环境和多人会议场景中的中英文语音。
  • ⏱️ 长音频理解 — 可理解并分析长篇录音。
  • 🎧 多维度感知 — 可理解细粒度语音、非语音声音、声学场景和音乐。
  • 💡 音频推理 — 可直接基于音频内容进行分析和推理。
  • 🗣️ 音频交互 — 支持端到端语音对话,并可选择输出合成语音。

Ming-3.0-audio-flash 打通了从 听到声音, 到 理解信息, 再到 完成任务.

🏗️ 架构

Ming-3.0-audio-flash architecture

📊 基准测试

所有分数均以百分比形式报告。↑ 表示越高越好,↓ 表示越低越好。Ming-3.0-audio-flash 在非思考模式下进行评估。 加粗 表示最佳结果,下划线表示次佳结果,星号(*)表示我们自身评估中获得的结果。

语音识别

ASR benchmark results

音频智能

Audio intelligence benchmark results

文本智能

Text intelligence benchmark results

注意

对比模型的结果是在我们的评估设置下复现的,可能因其提示词、解码设置、模型版本和评估流程的差异而与官方报告有所不同。

🧭 推理选项

vLLM-Omni SGLang Transformers
最适合 服务与语音交互 高吞吐文本服务 本地评估与研究
输入 音频 + 文本指令 音频 + 文本指令 音频 + 文本指令
输出 文本或文本+语音 文本 文本或文本+语音
接口 OpenAI 兼容 API OpenAI 兼容 API Hugging Face AutoClass
依赖项 requirements-vllm-omni.txt requirements-sglang.txt requirements-transformers.txt

🚀 快速开始

1️⃣ 下载模型

pip install -U huggingface_hub
hf download inclusionAI/Ming-3.0-audio-flash \
  --local-dir inclusionAI/Ming-3.0-audio-flash

export MODEL_PATH="$PWD/inclusionAI/Ming-3.0-audio-flash"
从 ModelScope 下载
pip install -U modelscope
modelscope download --model inclusionAI/Ming-3.0-audio-flash \
  --local_dir inclusionAI/Ming-3.0-audio-flash \
  --revision master

export MODEL_PATH="$PWD/inclusionAI/Ming-3.0-audio-flash"

模型目录包含分词器、处理器、模型实现、检查点分片和 Talker 资源。大型模型文件通过 Hugging Face 和 ModelScope 分发,而非本 GitHub 仓库。

2️⃣ 启动服务器

vLLM-Omni

安装 inclusionAI/vllm-omni:

python3 -m venv .venv-vllm-omni
source .venv-vllm-omni/bin/activate
pip install -r requirements-vllm-omni.txt

的 Ming-3.0-audio-flash 修复分支。该分支包含 bailing_moe_v3_audio 流水线与当前的 Ming Talker 请求接口。它通过 Chat Completions 支持 IP 和已注册的语音 ID, audio.voice并通过 ref_audio 以及 prompt_text.

启动文本输出服务,用于音频理解和推理:

MING_OUTPUT_MODE=text ./scripts/serve_vllm_omni.sh "$MODEL_PATH"

在使用 10-gram 阻塞支持复现识别评估时,使用 ASR 配置:

MING_OUTPUT_MODE=asr ./scripts/serve_vllm_omni.sh "$MODEL_PATH"

或同时启用文本和合成语音输出:

MING_OUTPUT_MODE=audio ./scripts/serve_vllm_omni.sh "$MODEL_PATH"

对于 Ming-3.0-audio-tiny,将 MODEL_PATH 指向 Tiny 检查点并选择 Tiny 部署配置:

export MODEL_PATH="$PWD/inclusionAI/Ming-3.0-audio-tiny"
MING_MODEL_VARIANT=tiny MING_OUTPUT_MODE=text ./scripts/serve_vllm_omni.sh "$MODEL_PATH"

scripts/serve_vllm_omni.sh 还会在模型目录名包含 tiny时自动检测 Tiny。使用自定义目录名时,请显式设置 MING_MODEL_VARIANT 。

注意

默认的 Flash 配置在八块 GPU 上使用张量并行。这是 80 GB H800 GPU 上默认 128K 上下文长度所必需的,因为 vLLM 在启动时会根据配置的上下文长度预留 KV-cache 内存。在完整音频配置中,Talker 复用 GPU 7,并使用独立的内存预算。Tiny 完整音频配置每个阶段使用一块 GPU。请根据你的硬件调整 devices、上下文和序列限制,以及 gpu_memory_utilization 在 deploy/*.yaml 中的设置。

SGLang

在单独的环境中安装 inclusionAI/sglang_ling_v3 的音频分支:

python3 -m venv .venv-sglang
source .venv-sglang/bin/activate
pip install -r requirements-sglang.txt

当 sglang_ling_v3 源代码检出目录与本仓库相邻可用时,改为以可编辑模式安装该确切检出:

pip install -e ../sglang_ling_v3/python

使用经过验证的四 GPU 配置启动 Ming-3.0-audio-flash:

./scripts/serve_sglang.sh "$MODEL_PATH"

对于 Ming-3.0-audio-tiny,使用其检查点和单 GPU 配置:

export MODEL_PATH="$PWD/inclusionAI/Ming-3.0-audio-tiny"
MING_MODEL_VARIANT=tiny CUDA_VISIBLE_DEVICES=0 \
  ./scripts/serve_sglang.sh "$MODEL_PATH"

SGLang 示例目前涵盖音频输入与文本输出。当需要合成语音输出时,请使用 vLLM-Omni 或直接使用 Transformers 推理。

3️⃣ 发送请求

vLLM-Omni

pip install -r requirements-client.txt

语音识别

python examples/vllm_omni_audio_chat.py examples/audio/introduce_ant_group.wav \
  --task asr \
  --prompt 'Please recognize the language of this speech and transcribe it, placing a `\t` between the identified language and the transcribe.' \
  --max-tokens 256 \
  --no-repeat-ngram-size 10

语音回复

python examples/vllm_omni_audio_chat.py examples/audio/introduce_ant_group.wav \
  --audio-response \
  --output-audio outputs/answer.wav

默认情况下,vLLM-Omni 使用内置 IP 音色 灵小柔。传入 --voice 以从 完整的内置音色列表中选择另一个 IP 音色,或使用由 GET /v1/audio/voices返回的已注册音色 ID。客户端将其作为 Chat Completions 的 audio.voice: {"id": "..."}发送。音色选择不能与 --ref-audio组合使用;省略时则使用服务器默认值。

模型目录还提供两个预设参考音色, 灵楷 和 US_James,在 voice_presets/voice_audio/。它们匹配的转录文本记录在 voice_presets/voice_prompts.json。使用这些预设音色,或使用另一个带有其精确转录文本的参考 WAV,通过 --ref-audio 和 --prompt-text:

python examples/vllm_omni_audio_chat.py examples/audio/introduce_ant_group.wav \
  --audio-response \
  --ref-audio path/to/reference.wav \
  --prompt-text "<exact transcript of the reference audio>" \
  --output-audio outputs/cloned_answer.wav

流式语音响应及延迟指标

python examples/vllm_omni_audio_streaming.py examples/audio/introduce_ant_group.wav \
  --output-audio outputs/stream_answer.wav

客户端使用 http://localhost:8091/v1 ,并自动选择由 返回的第一个模型。使用 覆盖连接。 /v1/models、 和 ,或对应的 环境变量。SGLangSGLang 客户端使用该分支的 消息格式发送原始 base64 音频。针对默认端点 运行 ASR:对于语音问答,使用经过验证的默认系统提示词:使用 和 ,或使用 和 覆盖端点或服务模型。🤗 Transformers 推理使用隔离环境进行直接推理:语音识别语音问答Thinker + 原生 Talker使用随 m 捆绑的 Talker 实现 --base-url, --api-key,以及 --model,或对应的 MING_* 环境变量。

SGLang

SGLang 客户端使用该分支的原始 base64 音频发送 input_audio 消息格式。针对默认端点运行 ASR: http://localhost:8008/v1:

python examples/sglang_audio_chat.py examples/audio/introduce_ant_group.wav \
  --task asr \
  --max-tokens 256

对于语音问答,请使用经过验证的默认系统提示词:

python examples/sglang_audio_chat.py examples/audio/introduce_ant_group.wav

使用以下参数覆盖端点或服务模型: --base-url 以及 --model,或使用 MING_SGLANG_BASE_URL 和 MING_SGLANG_MODEL.

🤗 Transformers 推理

使用隔离环境进行直接推理:

python3 -m venv .venv-transformers
source .venv-transformers/bin/activate
pip install -r requirements-transformers.txt

语音识别

python examples/transformers_audio.py examples/audio/introduce_ant_group.wav \
  --model "$MODEL_PATH" \
  --task asr \
  --prompt 'Please recognize the language of this speech and transcribe it, placing a `\t` between the identified language and the transcribe.' \
  --max-new-tokens 256 \
  --no-repeat-ngram-size 10

语音问答

python examples/transformers_audio.py examples/audio/introduce_ant_group.wav \
  --model "$MODEL_PATH"

Thinker + 原生 Talker

使用模型自带的 Talker 实现生成语音,无需启动 vLLM-Omni 服务器:

python examples/transformers_thinker_talker.py \
  --model "$MODEL_PATH" \
  --audio examples/audio/introduce_ant_group.wav \
  --voice US_Stella \
  --thinker-max-memory 72GiB \
  --output outputs/answer.wav

也支持参考音频声音克隆:

python examples/transformers_thinker_talker.py \
  --model "$MODEL_PATH" \
  --audio examples/audio/introduce_ant_group.wav \
  --ref-audio path/to/reference.wav \
  --prompt-text "<exact transcript of the reference audio>" \
  --output outputs/cloned_answer.wav

重要

直接推理会使用模型注册的 AutoClasses 加载模型,并采用 trust_remote_code=True在启用环境中的远程代码之前,请先审查已下载的模型代码。原生语音输出还会额外导入模型目录中随附的 Talker 实现。

📚 更多示例

🗂️ 仓库结构

Ming-3.0-audio-flash/
├── cookbook.ipynb                  # Interactive walkthrough
├── deploy/                         # vLLM-Omni deployment profiles
├── examples/
│   ├── audio/                      # Sample audio and metadata
│   ├── sglang_audio_chat.py         # SGLang text-output client
│   ├── vllm_omni_audio_chat.py      # Text and non-streaming speech client
│   ├── vllm_omni_audio_streaming.py # Streaming speech and latency metrics
│   ├── transformers_thinker_talker.py # Direct Thinker-to-Talker inference
│   └── transformers_audio.py       # Direct Transformers inference
├── scripts/
│   ├── serve_vllm_omni.sh          # vLLM-Omni launcher
│   └── serve_sglang.sh             # SGLang launcher
├── requirements-client.txt         # Lightweight API client dependencies
├── requirements-sglang.txt         # Compatible SGLang audio branch
├── requirements-vllm-omni.txt      # Compatible vLLM-Omni server branch
└── requirements-transformers.txt   # Direct inference dependencies

🔌 API 格式

vLLM-Omni 端点接受以 base64 数据 URL 形式提供的音频:

messages = [
    {
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe this audio."},
            {
                "type": "audio_url",
                "audio_url": {"url": "data:audio/wav;base64,..."},
            },
        ],
    }
]

用于文本输出,或用于文本和合成语音。 modalities=["text"] 用于文本输出,或 modalities=["text", "audio"] 用于文本和合成语音。

SGLang 端点使用原始 base64 音频作为 input_audio 内容项:

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": {"data": audio_base64, "format": "wav"},
            },
            {"type": "text", "text": "Describe this audio."},
        ],
    }
]

Chat Completions 语音输出通过以下方式选择 IP 音色或注册音色: audio.voice:

audio = {
    "format": "wav",  # The streaming client uses vLLM-Omni's raw PCM format.
    "voice": {"id": "灵小柔"},
}

服务器在查找已注册的参考音色之前,会先检查其 IP 音色列表。 省略 voice 以使用默认内置 IP 音色, 灵小柔.

参考音频声音克隆使用原始 base64 音频及其转录文本:

additional_information = {
    "voice_mode": "reference",
    "ref_audio": reference_audio_base64,
    "prompt_text": reference_audio_transcript,
}

📄 许可证

本项目基于 MIT 许可证。参见 LEGAL.md ,以查阅法律免责声明。

关于

未提供描述、网站或主题。

资源

ReadmeMIT 许可证活动自定义属性

星标

40 星标

关注者

0 关注者

分支

1 分支报告仓库

版本发布

包

贡献者

语言