MOSS-Transcribe-Diarize 是 OpenMOSS 团队推出的开源语音转写与说话人分离模型。它对长音频、多说话人音频进行统一建模,支持自动语音识别、带说话人标识的转写、说话人分离、时间戳预测以及简洁转录文本生成。
输入音频或视频文件后,MOSS-Transcribe-Diarize 可一次性生成带说话人标识的转录文本,并附带动段时间戳和如 [S01]、[S02]、[S03] 等匿名说话人标签。
长音频语音理解不仅仅是简单的转写。对于会议、通话、播客、访谈、讲座、视频等实际场景的录音,一份有用的转录文本应当明确说了什么、谁在说以及何时说的。
MOSS-Transcribe-Diarize 的设计目标是在单个生成式模型中整合这些能力。
MOSS-Transcribe-Diarize 采用模块化的音频-语言设计,包含三个组件:音频编码器、模态适配器和因果语言模型。原始音频被转换为对数梅尔特征,由 Whisper 风格的音频编码器进行编码,通过 MLP 适配器投影到语言模型的嵌入空间,然后由 Qwen3 风格的因果解码器进行自回归文本生成。
模型在文本序列中使用音频占位符令牌。在前向传播过程中,投影后的音频表示会替换相应的占位符嵌入,使语言模型能够根据输入音频生成带时间戳和说话人标识的转录文本。
| 组件 | 规格 |
|---|---|
| 文本骨干 | Qwen3-0.6B 风格因果解码器 |
| 音频编码器 | Whisper-Medium 编码器配置 |
| 音频前端 | WhisperFeatureExtractor,16 kHz,80 个梅尔 bins,30 秒 chunks |
| 音频-文本适配器 | 4x 时间融合 + MLP 适配器 |
| 融合方法 | 音频特征替换 `< |
| 输出格式 | 简洁的 [start][Sxx]text[end] 转录文本 |
| 模型 | 音频编码器 | 大语言模型 backbone | Hugging Face |
|---|---|---|---|
| MOSS-Transcribe-Diarize | Whisper 风格音频编码器 | Qwen3-0.6B 风格解码器 | Hugging Face |
未来可能会发布更多模型变体,敬请期待!
我们使用字符错误率(CER)、拼接最小排列字符错误率(cpCER)和 Delta-cp 对 MOSS-Transcribe-Diarize 进行评估。所有指标均越低越好。短横线(-)表示结果不可用。
| 数据集 | 指标 | 豆包 | ElevenLabs | GPT-4o | Gemini 2.5 Pro | Gemini 3 Pro | VIBEVOICE ASR | MOSS Transcribe Diarize |
|---|---|---|---|---|---|---|---|---|
| AISHELL-4 | CER(↓) | 18.18 | 19.58 | - | 42.70 | 22.75 | 21.40 | 14.19 |
| cpCER(↓) | 27.86 | 37.95 | - | 53.42 | 27.43 | 24.99 | 14.98 | |
| Delta-cp(↓) | 9.68 | 18.36 | - | 10.72 | 4.68 | 3.59 | 0.79 | |
| Podcast | CER(↓) | 7.93 | 8.50 | - | 7.38 | - | 27.94 | 4.46 |
| cpCER(↓) | 10.54 | 11.34 | - | 10.23 | - | 48.30 | 6.97 | |
| Delta-cp(↓) | 2.61 | 2.85 | - | 2.85 | - | 20.36 | 2.50 | |
| Movies | CER(↓) | 9.94 | 11.49 | 14.37 | 15.46 | 8.62 | 14.59 | 6.58 |
| cpCER(↓) | 30.88 | 17.85 | 23.67 | 24.15 | 14.73 | 42.54 | 13.68 | |
| Delta-cp(↓) | 20.94 | 6.37 | 9.31 | 8.69 | 6.11 | 27.94 | 7.24 | |
| Alimeeting | CER(↓) | 25.25 | 25.70 | - | 27.43 | 26.75 | 27.40 | 24.80 |
| cpCER(↓) | 37.57 | 36.69 | - | 41.64 | 32.84 | 29.33 | 21.51 | |
| Delta-cp(↓) | 12.31 | 10.99 | - | 14.21 | 6.09 | 1.93 | -0.33 |
我们建议使用 Python 3.12 并创建一个干净的 Conda 环境。本仓库使用自定义的 Transformers 模型和处理器代码,因此加载模型和处理器时请始终使用 trust_remote_code=True。
git clone https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize
cd MOSS-Transcribe-Diarize
conda create -n moss-transcribe-diarize python=3.12 -y
conda activate moss-transcribe-diarize
conda install -c conda-forge "ffmpeg=7" -y
pip install --extra-index-url https://download.pytorch.org/whl/cu128 -e ".[torch-runtime]"可选:如果您的 GPU 支持 FlashAttention 2,请使用以下命令安装可选运行时:
pip install --extra-index-url https://download.pytorch.org/whl/cu128 -e ".[torch-runtime,flash-attn]"运行贪婪解码:
python infer.py \
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
--audio /path/to/audio_or_video.mp4 \
--decoding greedy \
--max-new-tokens 2048执行采样解码:
python infer.py \
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
--audio /path/to/audio_or_video.mp4 \
--decoding sample \
--temperature 0.7 \
--max-new-tokens 2048返回 JSON 输出:
python infer.py \
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
--audio /path/to/audio_or_video.mp4 \
--json音频文件通过Transformers音频加载器加载。MP4、MOV和MKV等视频容器使用PyAV解码,并在特征提取前重采样为单声道16 kHz。
import torch
from transformers import AutoModelForCausalLM, AutoProcessor
from moss_transcribe_diarize.inference_utils import (
build_transcription_messages,
generate_transcription,
resolve_device,
)
model_id = "OpenMOSS-Team/MOSS-Transcribe-Diarize"
audio_path = "/path/to/audio_or_video.mp4"
device = resolve_device("auto")
dtype = torch.bfloat16 if device.type == "cuda" else torch.float32
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype="auto",
).to(dtype=dtype).to(device).eval()
processor = AutoProcessor.from_pretrained(
model_id,
trust_remote_code=True,
fix_mistral_regex=True,
)
messages = build_transcription_messages(audio_path)
result = generate_transcription(
model,
processor,
messages,
max_new_tokens=2048,
do_sample=False,
device=device,
dtype=dtype,
)
print(result["text"])默认提示会要求模型输出每个语音片段的开始时间戳、说话人标签、转录文本和结束时间戳。您可以通过以下方式自定义指令:
messages = build_transcription_messages(
audio_path,
prompt="Please transcribe the audio with timestamps and speaker labels.",
)也可以通过命令行使用 --prompt 来实现相同的操作。
标准输出格式如下:
[start_time][Sxx]transcribed speech[end_time]示例:
[0.48][S01]Welcome everyone[1.66][12.26][S02]The new transcription pipeline is ready for evaluation[13.81][14.36][S01]Great, include the diarization results in the report[18.76]以下格式说明:
start_time 和 end_time 为秒级时间戳。[S01]、[S02] 及类似标签为模型生成的匿名说话人标签。MOSS-Transcribe-Diarize 采用 Apache License 2.0 许可证。
@misc{mosstranscribediarize2026,
title={MOSS-Transcribe-Diarize},
author={OpenMOSS Team},
year={2026},
howpublished={\url{https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize}},
note={Hugging Face model repository}
}