Audio-Text-to-Text
Transformers
Safetensors
English
Chinese
moss_transcribe_diarize
text-generation
moss
audio
speech
asr
diarization
timestamp-asr
long-form-audio
multimodal
multilingual
custom_code
Eval Results
Instructions to use OpenMOSS-Team/MOSS-Transcribe-Diarize with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMOSS-Team/MOSS-Transcribe-Diarize with Transformers:
# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("OpenMOSS-Team/MOSS-Transcribe-Diarize", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update model card README
Browse files
README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
- zh
|
|
@@ -12,46 +13,56 @@ tags:
|
|
| 12 |
- timestamp-asr
|
| 13 |
- long-form-audio
|
| 14 |
- multimodal
|
|
|
|
| 15 |
pipeline_tag: audio-text-to-text
|
| 16 |
---
|
| 17 |
|
| 18 |
# MOSS-Transcribe-Diarize
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
|
| 24 |
## News
|
| 25 |
|
| 26 |
-
* 2026
|
| 27 |
|
| 28 |
## Contents
|
| 29 |
|
| 30 |
- [Introduction](#introduction)
|
| 31 |
- [Model Architecture](#model-architecture)
|
| 32 |
-
- [Released Models](#released-models)
|
| 33 |
- [Evaluation](#evaluation)
|
| 34 |
- [Quickstart](#quickstart)
|
| 35 |
- [Environment Setup](#environment-setup)
|
| 36 |
-
- [Command Line Inference](#command-line-inference)
|
| 37 |
- [Python Usage](#python-usage)
|
|
|
|
|
|
|
|
|
|
| 38 |
- [Output Format](#output-format)
|
| 39 |
- [More Information](#more-information)
|
| 40 |
-
- [
|
| 41 |
- [Citation](#citation)
|
| 42 |
|
| 43 |
## Introduction
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
* **Long-form ASR**: Transcribes long audio and video recordings into text.
|
| 50 |
* **Speaker-aware transcription**: Adds anonymous speaker labels to each speech segment.
|
| 51 |
-
* **Speaker diarization**: Produces "who spoke when"
|
| 52 |
* **Timestamp prediction**: Generates segment-level start and end timestamps.
|
| 53 |
-
* **Audio and video input**: Supports common audio files and video containers
|
| 54 |
-
* **Promptable generation**:
|
| 55 |
|
| 56 |
## Model Architecture
|
| 57 |
|
|
@@ -59,102 +70,117 @@ MOSS-Transcribe-Diarize is built to unify these capabilities within a single gen
|
|
| 59 |
<img src="Model_Architecture.png" alt="MOSS-Transcribe-Diarize model architecture" width="900">
|
| 60 |
</p>
|
| 61 |
|
| 62 |
-
MOSS-Transcribe-Diarize follows a modular audio-language design comprising three components: an audio encoder, a modality adapter, and a causal language model. Raw audio is converted into log-mel features, encoded by a Whisper-style audio encoder, projected into the language model embedding space through an MLP adapter, and then consumed by a Qwen3-style causal decoder for auto-regressive text generation.
|
| 63 |
-
|
| 64 |
-
The model uses audio placeholder tokens in the text sequence. During the forward pass, projected audio representations replace the corresponding placeholder embeddings, allowing the language model to generate timestamped, speaker-aware transcripts conditioned on the input audio.
|
| 65 |
-
|
| 66 |
| Component | Specification |
|
| 67 |
-
|
|
| 68 |
| Text backbone | Qwen3-0.6B style causal decoder |
|
| 69 |
| Audio encoder | Whisper-Medium encoder configuration |
|
| 70 |
| Audio frontend | `WhisperFeatureExtractor`, 16 kHz, 80 mel bins, 30 s chunks |
|
| 71 |
-
| Audio-text
|
| 72 |
-
| Fusion
|
| 73 |
-
| Output format | Compact `[start][Sxx]text[end]` transcript |
|
| 74 |
-
|
| 75 |
-
## Released Models
|
| 76 |
|
| 77 |
-
|
| 78 |
-
| --- | --- | --- | --- |
|
| 79 |
-
| **MOSS-Transcribe-Diarize** | Whisper-style audio encoder | Qwen3-0.6B style decoder | [Hugging Face](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize) |
|
| 80 |
-
|
| 81 |
-
> More model variants may be released in the future. Stay tuned!
|
| 82 |
|
| 83 |
## Evaluation
|
| 84 |
|
| 85 |
-
We evaluate MOSS-Transcribe-Diarize
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
## Quickstart
|
| 103 |
|
| 104 |
### Environment Setup
|
| 105 |
|
| 106 |
-
|
| 107 |
|
| 108 |
```bash
|
| 109 |
-
git clone https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize
|
| 110 |
-
cd MOSS-Transcribe-Diarize
|
| 111 |
-
|
| 112 |
conda create -n moss-transcribe-diarize python=3.12 -y
|
| 113 |
conda activate moss-transcribe-diarize
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
```
|
| 118 |
-
|
| 119 |
-
Optional: if your GPU supports FlashAttention 2, install the optional runtime with:
|
| 120 |
-
|
| 121 |
-
```bash
|
| 122 |
-
pip install --extra-index-url https://download.pytorch.org/whl/cu128 -e ".[torch-runtime,flash-attn]"
|
| 123 |
-
```
|
| 124 |
-
|
| 125 |
-
### Command Line Inference
|
| 126 |
-
|
| 127 |
-
Run greedy decoding:
|
| 128 |
-
|
| 129 |
-
```bash
|
| 130 |
-
python infer.py \
|
| 131 |
-
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 132 |
-
--audio /path/to/audio_or_video.mp4 \
|
| 133 |
-
--decoding greedy \
|
| 134 |
-
--max-new-tokens 2048
|
| 135 |
-
```
|
| 136 |
-
|
| 137 |
-
Run sampling decoding:
|
| 138 |
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 142 |
-
--audio /path/to/audio_or_video.mp4 \
|
| 143 |
-
--decoding sample \
|
| 144 |
-
--temperature 0.7 \
|
| 145 |
-
--max-new-tokens 2048
|
| 146 |
```
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
```bash
|
| 151 |
-
python infer.py \
|
| 152 |
-
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 153 |
-
--audio /path/to/audio_or_video.mp4 \
|
| 154 |
-
--json
|
| 155 |
-
```
|
| 156 |
-
|
| 157 |
-
Audio files are loaded through the Transformers audio loader. Video containers such as MP4, MOV, and MKV are decoded with PyAV and resampled to mono 16 kHz before feature extraction.
|
| 158 |
|
| 159 |
### Python Usage
|
| 160 |
|
|
@@ -162,6 +188,7 @@ Audio files are loaded through the Transformers audio loader. Video containers s
|
|
| 162 |
import torch
|
| 163 |
from transformers import AutoModelForCausalLM, AutoProcessor
|
| 164 |
|
|
|
|
| 165 |
from moss_transcribe_diarize.inference_utils import (
|
| 166 |
build_transcription_messages,
|
| 167 |
generate_transcription,
|
|
@@ -169,7 +196,7 @@ from moss_transcribe_diarize.inference_utils import (
|
|
| 169 |
)
|
| 170 |
|
| 171 |
model_id = "OpenMOSS-Team/MOSS-Transcribe-Diarize"
|
| 172 |
-
audio_path = "
|
| 173 |
|
| 174 |
device = resolve_device("auto")
|
| 175 |
dtype = torch.bfloat16 if device.type == "cuda" else torch.float32
|
|
@@ -183,7 +210,6 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 183 |
processor = AutoProcessor.from_pretrained(
|
| 184 |
model_id,
|
| 185 |
trust_remote_code=True,
|
| 186 |
-
fix_mistral_regex=True,
|
| 187 |
)
|
| 188 |
|
| 189 |
messages = build_transcription_messages(audio_path)
|
|
@@ -198,18 +224,91 @@ result = generate_transcription(
|
|
| 198 |
)
|
| 199 |
|
| 200 |
print(result["text"])
|
|
|
|
|
|
|
|
|
|
| 201 |
```
|
| 202 |
|
| 203 |
-
The
|
| 204 |
|
| 205 |
-
``
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
```
|
| 211 |
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
## Output Format
|
| 215 |
|
|
@@ -233,21 +332,26 @@ In this format:
|
|
| 233 |
|
| 234 |
## More Information
|
| 235 |
|
|
|
|
| 236 |
* **MOSI.AI**: <https://mosi.cn>
|
| 237 |
* **OpenMOSS**: <https://www.open-moss.com>
|
| 238 |
|
| 239 |
-
##
|
| 240 |
|
| 241 |
MOSS-Transcribe-Diarize is licensed under the Apache License 2.0.
|
| 242 |
|
| 243 |
## Citation
|
| 244 |
|
|
|
|
|
|
|
| 245 |
```bibtex
|
| 246 |
-
@misc{
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
|
|
|
|
|
|
| 252 |
}
|
| 253 |
```
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
language:
|
| 5 |
- en
|
| 6 |
- zh
|
|
|
|
| 13 |
- timestamp-asr
|
| 14 |
- long-form-audio
|
| 15 |
- multimodal
|
| 16 |
+
- custom_code
|
| 17 |
pipeline_tag: audio-text-to-text
|
| 18 |
---
|
| 19 |
|
| 20 |
# MOSS-Transcribe-Diarize
|
| 21 |
|
| 22 |
+
<div align="center">
|
| 23 |
+
<a href="https://github.com/OpenMOSS/MOSS-Transcribe-Diarize"><img src="https://img.shields.io/badge/GitHub-OpenMOSS%2FMOSS--Transcribe--Diarize-black?logo=github"></a>
|
| 24 |
+
<a href="https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize"><img src="https://img.shields.io/badge/HuggingFace-Model-orange?logo=huggingface"></a>
|
| 25 |
+
<a href="https://arxiv.org/abs/2601.01554"><img src="https://img.shields.io/badge/arXiv-2601.01554-b31b1b?logo=arxiv"></a>
|
| 26 |
+
</div>
|
| 27 |
|
| 28 |
+
MOSS-Transcribe-Diarize is an end-to-end audio understanding model for long-form multi-speaker transcription, diarization, timestamps, and acoustic event awareness.
|
| 29 |
+
|
| 30 |
+
Given an audio or video file, the model generates a compact speaker-aware transcript in one pass, including timestamps and anonymous speaker labels such as `[S01]`, `[S02]`, and beyond.
|
| 31 |
|
| 32 |
## News
|
| 33 |
|
| 34 |
+
* 2026-07-09: Released MOSS-Transcribe-Diarize 0.9B.
|
| 35 |
|
| 36 |
## Contents
|
| 37 |
|
| 38 |
- [Introduction](#introduction)
|
| 39 |
- [Model Architecture](#model-architecture)
|
|
|
|
| 40 |
- [Evaluation](#evaluation)
|
| 41 |
- [Quickstart](#quickstart)
|
| 42 |
- [Environment Setup](#environment-setup)
|
|
|
|
| 43 |
- [Python Usage](#python-usage)
|
| 44 |
+
- [Custom Prompt and Hotwords](#custom-prompt-and-hotwords)
|
| 45 |
+
- [Serve with vLLM and SGLang](#serve-with-vllm-and-sglang)
|
| 46 |
+
- [Subtitle Web App](#subtitle-web-app)
|
| 47 |
- [Output Format](#output-format)
|
| 48 |
- [More Information](#more-information)
|
| 49 |
+
- [License](#license)
|
| 50 |
- [Citation](#citation)
|
| 51 |
|
| 52 |
## Introduction
|
| 53 |
|
| 54 |
+
MOSS-Transcribe-Diarize turns real-world long-form audio into structured, speaker-aware transcripts in one pass. Instead of stitching together separate ASR and diarization systems, it jointly performs speech transcription and speaker diarization, producing time-aligned text with consistent speaker labels.
|
| 55 |
+
|
| 56 |
+
The model is built for meetings, calls, podcasts, interviews, lectures, videos, and other long or messy multi-speaker recordings. It can also emit acoustic event annotations, giving downstream systems a richer view of what happened, who spoke, and when.
|
| 57 |
|
| 58 |
+
Core capabilities:
|
| 59 |
|
| 60 |
* **Long-form ASR**: Transcribes long audio and video recordings into text.
|
| 61 |
* **Speaker-aware transcription**: Adds anonymous speaker labels to each speech segment.
|
| 62 |
+
* **Speaker diarization**: Produces "who spoke when" output without a separate diarization pipeline.
|
| 63 |
* **Timestamp prediction**: Generates segment-level start and end timestamps.
|
| 64 |
+
* **Audio and video input**: Supports common audio files and video containers through the source package utilities.
|
| 65 |
+
* **Promptable generation**: Supports custom transcription instructions and hotwords.
|
| 66 |
|
| 67 |
## Model Architecture
|
| 68 |
|
|
|
|
| 70 |
<img src="Model_Architecture.png" alt="MOSS-Transcribe-Diarize model architecture" width="900">
|
| 71 |
</p>
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
| Component | Specification |
|
| 74 |
+
|---|---|
|
| 75 |
| Text backbone | Qwen3-0.6B style causal decoder |
|
| 76 |
| Audio encoder | Whisper-Medium encoder configuration |
|
| 77 |
| Audio frontend | `WhisperFeatureExtractor`, 16 kHz, 80 mel bins, 30 s chunks |
|
| 78 |
+
| Audio-text bridge | 4x temporal merge + MLP adaptor |
|
| 79 |
+
| Fusion | Audio features replace <code><|audio_pad|></code> embeddings via `masked_scatter` |
|
| 80 |
+
| Output format | Compact `[start][Sxx]text[end]` transcript with speaker tags such as `[S01]` |
|
|
|
|
|
|
|
| 81 |
|
| 82 |
+
This Hugging Face repository includes the custom Transformers remote code required to load the model with `trust_remote_code=True`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
## Evaluation
|
| 85 |
|
| 86 |
+
We evaluate MOSS-Transcribe-Diarize using three objective metrics: Character Error Rate (CER), concatenated minimum-permutation Character Error Rate (cpCER), and Delta-cp. Lower is better for all metrics. A dash (`-`) indicates that the result is unavailable.
|
| 87 |
+
|
| 88 |
+
<div style="overflow-x: auto;">
|
| 89 |
+
<table style="white-space: nowrap;">
|
| 90 |
+
<thead>
|
| 91 |
+
<tr>
|
| 92 |
+
<th rowspan="2" style="min-width: 220px;">Model</th>
|
| 93 |
+
<th colspan="3" style="text-align:center;">AISHELL‑4</th>
|
| 94 |
+
<th colspan="3" style="text-align:center;">Alimeeting</th>
|
| 95 |
+
<th colspan="3" style="text-align:center;">Podcast</th>
|
| 96 |
+
<th colspan="3" style="text-align:center;">Movies</th>
|
| 97 |
+
</tr>
|
| 98 |
+
<tr>
|
| 99 |
+
<th>CER↓</th><th>cpCER↓</th><th>Δcp↓</th>
|
| 100 |
+
<th>CER↓</th><th>cpCER↓</th><th>Δcp↓</th>
|
| 101 |
+
<th>CER↓</th><th>cpCER↓</th><th>Δcp↓</th>
|
| 102 |
+
<th>CER↓</th><th>cpCER↓</th><th>Δcp↓</th>
|
| 103 |
+
</tr>
|
| 104 |
+
</thead>
|
| 105 |
+
<tbody>
|
| 106 |
+
<tr>
|
| 107 |
+
<td style="white-space: nowrap;">Doubao</td>
|
| 108 |
+
<td>18.18</td><td>27.86</td><td>9.68</td>
|
| 109 |
+
<td>25.25</td><td>37.57</td><td>12.31</td>
|
| 110 |
+
<td>7.93</td><td>10.54</td><td>2.61</td>
|
| 111 |
+
<td>9.94</td><td>30.88</td><td>20.94</td>
|
| 112 |
+
</tr>
|
| 113 |
+
<tr>
|
| 114 |
+
<td style="white-space: nowrap;">ElevenLabs</td>
|
| 115 |
+
<td>19.58</td><td>37.95</td><td>18.36</td>
|
| 116 |
+
<td>25.70</td><td>36.69</td><td>10.99</td>
|
| 117 |
+
<td>8.50</td><td>11.34</td><td>2.85</td>
|
| 118 |
+
<td>11.49</td><td>17.85</td><td>6.37</td>
|
| 119 |
+
</tr>
|
| 120 |
+
<tr>
|
| 121 |
+
<td style="white-space: nowrap;">GPT-4o</td>
|
| 122 |
+
<td>-</td><td>-</td><td>-</td>
|
| 123 |
+
<td>-</td><td>-</td><td>-</td>
|
| 124 |
+
<td>-</td><td>-</td><td>-</td>
|
| 125 |
+
<td>14.37</td><td>23.67</td><td>9.31</td>
|
| 126 |
+
</tr>
|
| 127 |
+
<tr>
|
| 128 |
+
<td style="white-space: nowrap;">Gemini 2.5 Pro</td>
|
| 129 |
+
<td>42.70</td><td>53.42</td><td>10.72</td>
|
| 130 |
+
<td>27.43</td><td>41.64</td><td>14.21</td>
|
| 131 |
+
<td>7.38</td><td>10.23</td><td>2.85</td>
|
| 132 |
+
<td>15.46</td><td>24.15</td><td>8.69</td>
|
| 133 |
+
</tr>
|
| 134 |
+
<tr>
|
| 135 |
+
<td style="white-space: nowrap;">Gemini 3 Pro</td>
|
| 136 |
+
<td>22.75</td><td>27.43</td><td>4.68</td>
|
| 137 |
+
<td>26.75</td><td>32.84</td><td>6.09</td>
|
| 138 |
+
<td>-</td><td>-</td><td>-</td>
|
| 139 |
+
<td>8.62</td><td>14.73</td><td>6.11</td>
|
| 140 |
+
</tr>
|
| 141 |
+
<tr>
|
| 142 |
+
<td style="white-space: nowrap;">VIBEVOICE ASR</td>
|
| 143 |
+
<td>21.40</td><td>24.99</td><td>3.59</td>
|
| 144 |
+
<td>27.40</td><td>29.33</td><td>1.93</td>
|
| 145 |
+
<td>27.94</td><td>48.30</td><td>20.36</td>
|
| 146 |
+
<td>14.59</td><td>42.54</td><td>27.94</td>
|
| 147 |
+
</tr>
|
| 148 |
+
<tr>
|
| 149 |
+
<td style="white-space: nowrap;"><b>MOSS Transcribe Diarize</b></td>
|
| 150 |
+
<td>14.84</td><td>15.83</td><td>0.99</td>
|
| 151 |
+
<td>24.86</td><td>22.17</td><td>-2.69</td>
|
| 152 |
+
<td>5.97</td><td>7.37</td><td><b>1.40</b></td>
|
| 153 |
+
<td>6.36</td><td>12.76</td><td>6.40</td>
|
| 154 |
+
</tr>
|
| 155 |
+
<tr>
|
| 156 |
+
<td style="white-space: nowrap;"><b>MOSS Transcribe Diarize Pro</b></td>
|
| 157 |
+
<td><b>13.78</b></td><td><b>14.02</b></td><td><b>0.24</b></td>
|
| 158 |
+
<td><b>18.22</b></td><td><b>13.94</b></td><td><b>-4.27</b></td>
|
| 159 |
+
<td><b>4.46</b></td><td><b>6.97</b></td><td>2.51</td>
|
| 160 |
+
<td><b>5.86</b></td><td><b>11.78</b></td><td><b>5.92</b></td>
|
| 161 |
+
</tr>
|
| 162 |
+
</tbody>
|
| 163 |
+
</table>
|
| 164 |
+
</div>
|
| 165 |
|
| 166 |
## Quickstart
|
| 167 |
|
| 168 |
### Environment Setup
|
| 169 |
|
| 170 |
+
Use a clean Python environment. The model uses custom Transformers code, so load the model and processor with `trust_remote_code=True`.
|
| 171 |
|
| 172 |
```bash
|
|
|
|
|
|
|
|
|
|
| 173 |
conda create -n moss-transcribe-diarize python=3.12 -y
|
| 174 |
conda activate moss-transcribe-diarize
|
| 175 |
|
| 176 |
+
git clone https://github.com/OpenMOSS/MOSS-Transcribe-Diarize.git
|
| 177 |
+
cd MOSS-Transcribe-Diarize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
+
pip install torch torchaudio
|
| 180 |
+
pip install -e .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
```
|
| 182 |
|
| 183 |
+
The GitHub package provides helper utilities such as audio/video loading, transcription message construction, transcript parsing, CLI inference, and the subtitle web app. The model weights and remote-code model files are loaded from this Hugging Face repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
### Python Usage
|
| 186 |
|
|
|
|
| 188 |
import torch
|
| 189 |
from transformers import AutoModelForCausalLM, AutoProcessor
|
| 190 |
|
| 191 |
+
from moss_transcribe_diarize import parse_transcript
|
| 192 |
from moss_transcribe_diarize.inference_utils import (
|
| 193 |
build_transcription_messages,
|
| 194 |
generate_transcription,
|
|
|
|
| 196 |
)
|
| 197 |
|
| 198 |
model_id = "OpenMOSS-Team/MOSS-Transcribe-Diarize"
|
| 199 |
+
audio_path = "audio.wav"
|
| 200 |
|
| 201 |
device = resolve_device("auto")
|
| 202 |
dtype = torch.bfloat16 if device.type == "cuda" else torch.float32
|
|
|
|
| 210 |
processor = AutoProcessor.from_pretrained(
|
| 211 |
model_id,
|
| 212 |
trust_remote_code=True,
|
|
|
|
| 213 |
)
|
| 214 |
|
| 215 |
messages = build_transcription_messages(audio_path)
|
|
|
|
| 224 |
)
|
| 225 |
|
| 226 |
print(result["text"])
|
| 227 |
+
|
| 228 |
+
for segment in parse_transcript(result["text"]):
|
| 229 |
+
print(segment.start, segment.end, segment.speaker, segment.text)
|
| 230 |
```
|
| 231 |
|
| 232 |
+
The message flow follows the common Qwen multimodal pattern:
|
| 233 |
|
| 234 |
+
1. `processor.apply_chat_template(messages, tokenize=False)` renders text with audio placeholders.
|
| 235 |
+
2. The helper utilities load audio waveforms from the same messages.
|
| 236 |
+
3. `processor(text=text, audio=audios)` computes Whisper input features and expands audio placeholders.
|
| 237 |
+
4. `model.generate(...)` produces timestamped transcription and diarization text.
|
| 238 |
+
|
| 239 |
+
### Custom Prompt and Hotwords
|
| 240 |
+
|
| 241 |
+
The default prompt is optimized for timestamped transcription and speaker diarization:
|
| 242 |
+
|
| 243 |
+
```text
|
| 244 |
+
请将音频转写为文本,每一段需以起始时间戳和说话人编号([S01]、[S02]、[S03]…)开头,正文为对应的语音内容,并在段末标注结束时间戳,以清晰标明该段语音范围。
|
| 245 |
+
```
|
| 246 |
+
|
| 247 |
+
To add hotwords, append a short hint to the default prompt:
|
| 248 |
+
|
| 249 |
+
```text
|
| 250 |
+
请将音频转写为文本,每一段需以起始时间戳和说话人编号([S01]、[S02]、[S03]…)开头,正文为对应的语音内容,并在段末标注结束时间戳,以清晰标明该段语音范围。热词提示:热词1, 热词2, 热词3
|
| 251 |
```
|
| 252 |
|
| 253 |
+
More prompt recipes are available in the GitHub repository: <https://github.com/OpenMOSS/MOSS-Transcribe-Diarize/blob/main/examples/prompts.md>
|
| 254 |
+
|
| 255 |
+
### Serve with vLLM and SGLang
|
| 256 |
+
|
| 257 |
+
MOSS-Transcribe-Diarize supports vLLM serving through the OpenAI-compatible transcription API:
|
| 258 |
+
|
| 259 |
+
```bash
|
| 260 |
+
pip install vllm
|
| 261 |
+
vllm serve OpenMOSS-Team/MOSS-Transcribe-Diarize --trust-remote-code
|
| 262 |
+
```
|
| 263 |
+
|
| 264 |
+
```bash
|
| 265 |
+
curl http://localhost:8000/v1/audio/transcriptions \
|
| 266 |
+
-F model="OpenMOSS-Team/MOSS-Transcribe-Diarize" \
|
| 267 |
+
-F file=@"audio.wav" \
|
| 268 |
+
-F response_format="json" \
|
| 269 |
+
-F temperature="0"
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
The same request format can be used with an SGLang OpenAI-compatible server:
|
| 273 |
+
|
| 274 |
+
```bash
|
| 275 |
+
python -m sglang.launch_server \
|
| 276 |
+
--model-path OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 277 |
+
--served-model-name OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 278 |
+
--trust-remote-code \
|
| 279 |
+
--host 0.0.0.0 \
|
| 280 |
+
--port 30000
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
```bash
|
| 284 |
+
curl http://localhost:30000/v1/audio/transcriptions \
|
| 285 |
+
-F model="OpenMOSS-Team/MOSS-Transcribe-Diarize" \
|
| 286 |
+
-F file=@"audio.wav" \
|
| 287 |
+
-F response_format="json" \
|
| 288 |
+
-F temperature="0"
|
| 289 |
+
```
|
| 290 |
+
|
| 291 |
+
### Subtitle Web App
|
| 292 |
+
|
| 293 |
+
The source package includes a local subtitle workflow for upload, review, subtitle export, and optional FFmpeg burn-in:
|
| 294 |
+
|
| 295 |
+
```bash
|
| 296 |
+
mtd-subtitle-web \
|
| 297 |
+
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 298 |
+
--host 127.0.0.1 \
|
| 299 |
+
--port 7860
|
| 300 |
+
```
|
| 301 |
+
|
| 302 |
+
Open `http://127.0.0.1:7860`, upload an audio/video file, review the parsed subtitle segments, then download JSON/SRT/ASS or burn an MP4 if `ffmpeg` and `ffprobe` are available on `PATH`.
|
| 303 |
+
|
| 304 |
+
For batch processing:
|
| 305 |
+
|
| 306 |
+
```bash
|
| 307 |
+
mtd-subtitle /path/to/input.mp4 \
|
| 308 |
+
--model OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 309 |
+
--out-dir runs/example \
|
| 310 |
+
--render
|
| 311 |
+
```
|
| 312 |
|
| 313 |
## Output Format
|
| 314 |
|
|
|
|
| 332 |
|
| 333 |
## More Information
|
| 334 |
|
| 335 |
+
* **GitHub**: <https://github.com/OpenMOSS/MOSS-Transcribe-Diarize>
|
| 336 |
* **MOSI.AI**: <https://mosi.cn>
|
| 337 |
* **OpenMOSS**: <https://www.open-moss.com>
|
| 338 |
|
| 339 |
+
## License
|
| 340 |
|
| 341 |
MOSS-Transcribe-Diarize is licensed under the Apache License 2.0.
|
| 342 |
|
| 343 |
## Citation
|
| 344 |
|
| 345 |
+
If you use MOSS-Transcribe-Diarize, please cite the technical report:
|
| 346 |
+
|
| 347 |
```bibtex
|
| 348 |
+
@misc{moss_transcribe_diarize_2026,
|
| 349 |
+
title={MOSS Transcribe Diarize Technical Report},
|
| 350 |
+
author={{MOSI.AI}},
|
| 351 |
+
year={2026},
|
| 352 |
+
eprint={2601.01554},
|
| 353 |
+
archivePrefix={arXiv},
|
| 354 |
+
primaryClass={cs.SD},
|
| 355 |
+
url={https://arxiv.org/abs/2601.01554}
|
| 356 |
}
|
| 357 |
```
|