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:
# pip install -U transformers accelerate # 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
[Docs] Update SGLang Omni Serving Commands
#10
by zhaochenyang20 - opened
README.md
CHANGED
|
@@ -42,7 +42,8 @@ Given an audio or video file, the model generates a compact speaker-aware transc
|
|
| 42 |
- [Environment Setup](#environment-setup)
|
| 43 |
- [Python Usage](#python-usage)
|
| 44 |
- [Custom Prompt and Hotwords](#custom-prompt-and-hotwords)
|
| 45 |
-
- [Serve with
|
|
|
|
| 46 |
- [Subtitle Web App](#subtitle-web-app)
|
| 47 |
- [Output Format](#output-format)
|
| 48 |
- [More Information](#more-information)
|
|
@@ -249,9 +250,84 @@ To add hotwords, append a short hint to the default prompt:
|
|
| 249 |
|
| 250 |
More prompt recipes are available in the GitHub repository: <https://github.com/OpenMOSS/MOSS-Transcribe-Diarize/blob/main/examples/prompts.md>
|
| 251 |
|
| 252 |
-
### Serve with
|
| 253 |
|
| 254 |
-
MOSS-Transcribe-Diarize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
```bash
|
| 257 |
uv pip install -U vllm \
|
|
@@ -279,25 +355,6 @@ curl http://localhost:8000/v1/audio/transcriptions \
|
|
| 279 |
-F temperature="0"
|
| 280 |
```
|
| 281 |
|
| 282 |
-
The same request format can be used with an SGLang OpenAI-compatible server:
|
| 283 |
-
|
| 284 |
-
```bash
|
| 285 |
-
python -m sglang.launch_server \
|
| 286 |
-
--model-path OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 287 |
-
--served-model-name OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 288 |
-
--trust-remote-code \
|
| 289 |
-
--host 0.0.0.0 \
|
| 290 |
-
--port 30000
|
| 291 |
-
```
|
| 292 |
-
|
| 293 |
-
```bash
|
| 294 |
-
curl http://localhost:30000/v1/audio/transcriptions \
|
| 295 |
-
-F model="OpenMOSS-Team/MOSS-Transcribe-Diarize" \
|
| 296 |
-
-F file=@"audio.wav" \
|
| 297 |
-
-F response_format="json" \
|
| 298 |
-
-F temperature="0"
|
| 299 |
-
```
|
| 300 |
-
|
| 301 |
### Subtitle Web App
|
| 302 |
|
| 303 |
The source package includes a local subtitle workflow for upload, review, subtitle export, and optional FFmpeg burn-in:
|
|
|
|
| 42 |
- [Environment Setup](#environment-setup)
|
| 43 |
- [Python Usage](#python-usage)
|
| 44 |
- [Custom Prompt and Hotwords](#custom-prompt-and-hotwords)
|
| 45 |
+
- [Serve with SGLang Omni](#serve-with-sglang-omni)
|
| 46 |
+
- [Serve with vLLM](#serve-with-vllm)
|
| 47 |
- [Subtitle Web App](#subtitle-web-app)
|
| 48 |
- [Output Format](#output-format)
|
| 49 |
- [More Information](#more-information)
|
|
|
|
| 250 |
|
| 251 |
More prompt recipes are available in the GitHub repository: <https://github.com/OpenMOSS/MOSS-Transcribe-Diarize/blob/main/examples/prompts.md>
|
| 252 |
|
| 253 |
+
### Serve with SGLang Omni
|
| 254 |
|
| 255 |
+
The recommended way to serve MOSS-Transcribe-Diarize is [SGLang Omni](https://github.com/sgl-project/sglang-omni) through the OpenAI-compatible `/v1/audio/transcriptions` endpoint. Install `sglang-omni` by following the [Installation guide](https://github.com/sgl-project/sglang-omni/blob/main/docs/get_started/installation.md), then download the model:
|
| 256 |
+
|
| 257 |
+
```bash
|
| 258 |
+
hf download OpenMOSS-Team/MOSS-Transcribe-Diarize
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
Serve the model:
|
| 262 |
+
|
| 263 |
+
```bash
|
| 264 |
+
sgl-omni serve \
|
| 265 |
+
--model-path OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 266 |
+
--port 8000 \
|
| 267 |
+
--max-running-requests 16 \
|
| 268 |
+
--cuda-graph-max-bs 16 \
|
| 269 |
+
--mem-fraction-static 0.80
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
Use `response_format=verbose_json` when you need parsed speaker segments. `json` returns the raw transcript text only.
|
| 273 |
+
|
| 274 |
+
```bash
|
| 275 |
+
curl -X POST http://localhost:8000/v1/audio/transcriptions \
|
| 276 |
+
-F model=OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 277 |
+
-F file=@audio.wav \
|
| 278 |
+
-F response_format=verbose_json
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
```python
|
| 282 |
+
import requests
|
| 283 |
+
|
| 284 |
+
with open("audio.wav", "rb") as f:
|
| 285 |
+
resp = requests.post(
|
| 286 |
+
"http://localhost:8000/v1/audio/transcriptions",
|
| 287 |
+
data={
|
| 288 |
+
"model": "OpenMOSS-Team/MOSS-Transcribe-Diarize",
|
| 289 |
+
"response_format": "verbose_json",
|
| 290 |
+
},
|
| 291 |
+
files={"file": ("audio.wav", f, "audio/wav")},
|
| 292 |
+
timeout=300,
|
| 293 |
+
)
|
| 294 |
+
|
| 295 |
+
resp.raise_for_status()
|
| 296 |
+
payload = resp.json()
|
| 297 |
+
print(payload["text"])
|
| 298 |
+
for segment in payload.get("segments", []):
|
| 299 |
+
print(
|
| 300 |
+
f"[{segment['start']:.2f}-{segment['end']:.2f}] {segment['text']}"
|
| 301 |
+
)
|
| 302 |
+
```
|
| 303 |
+
|
| 304 |
+
For longer multi-speaker audio, raise `max_new_tokens` so the decoder can finish the full diarized transcript:
|
| 305 |
+
|
| 306 |
+
```bash
|
| 307 |
+
curl -X POST http://localhost:8000/v1/audio/transcriptions \
|
| 308 |
+
-F model=OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 309 |
+
-F file=@audio.wav \
|
| 310 |
+
-F response_format=verbose_json \
|
| 311 |
+
-F max_new_tokens=65536
|
| 312 |
+
```
|
| 313 |
+
|
| 314 |
+
| Parameter | Type | Default | Description |
|
| 315 |
+
|---|---|---|---|
|
| 316 |
+
| `file` | file | required | Audio file uploaded as multipart form data |
|
| 317 |
+
| `model` | string | server default | Model identifier |
|
| 318 |
+
| `language` | string | unset | Optional language hint |
|
| 319 |
+
| `response_format` | string | `json` | `json`, `verbose_json`, or `text` |
|
| 320 |
+
| `temperature` | float | model default (`0.0`) | Sampling temperature |
|
| 321 |
+
| `max_new_tokens` | int | `5120` | Max generated tokens; raise for long audio (e.g. `65536`) |
|
| 322 |
+
| `prompt` | string | unset | Optional instruction override; omit to use the built-in transcribe+diarize prompt |
|
| 323 |
+
|
| 324 |
+
`verbose_json` parses the model markup into OpenAI-style `segments` with `start`, `end`, and speaker-prefixed `text` (for example `[S01]...`). `json` / `text` return the full transcript string without segment parsing.
|
| 325 |
+
|
| 326 |
+
For benchmarking, performance numbers, and more details, see the [SGLang Omni cookbook](https://github.com/sgl-project/sglang-omni/blob/main/docs/cookbook/moss_transcribe_diarize.md).
|
| 327 |
+
|
| 328 |
+
### Serve with vLLM
|
| 329 |
+
|
| 330 |
+
MOSS-Transcribe-Diarize also supports vLLM serving through the OpenAI-compatible transcription API. Use a pinned vLLM nightly build that includes the MOSS-Transcribe-Diarize model registration. Choose one of the following commands: for CUDA 12 environments, use `cu129`; for CUDA 13 environments, use `cu130`.
|
| 331 |
|
| 332 |
```bash
|
| 333 |
uv pip install -U vllm \
|
|
|
|
| 355 |
-F temperature="0"
|
| 356 |
```
|
| 357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
### Subtitle Web App
|
| 359 |
|
| 360 |
The source package includes a local subtitle workflow for upload, review, subtitle export, and optional FFmpeg burn-in:
|