zylin12 commited on
Commit
d7231bb
·
verified ·
1 Parent(s): 2c33139

Update SGLang Omni usage in README

Browse files
Files changed (1) hide show
  1. README.md +81 -11
README.md CHANGED
@@ -279,25 +279,95 @@ 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:
 
279
  -F temperature="0"
280
  ```
281
 
282
+ 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:
283
 
284
  ```bash
285
+ hf download OpenMOSS-Team/MOSS-Transcribe-Diarize
286
+ ```
287
+
288
+ Serve the model:
289
+
290
+ ```bash
291
+ sgl-omni serve \
292
  --model-path OpenMOSS-Team/MOSS-Transcribe-Diarize \
293
+ --port 8000 \
294
+ --max-running-requests 16 \
295
+ --cuda-graph-max-bs 16 \
296
+ --mem-fraction-static 0.80
297
  ```
298
 
299
+ Use `response_format=verbose_json` when you need parsed speaker segments. `json` returns the raw transcript text only.
300
+
301
  ```bash
302
+ curl -X POST http://localhost:8000/v1/audio/transcriptions \
303
+ -F model=OpenMOSS-Team/MOSS-Transcribe-Diarize \
304
+ -F file=@audio.wav \
305
+ -F response_format=verbose_json
 
306
  ```
307
 
308
+ ```python
309
+ import requests
310
+
311
+ with open("audio.wav", "rb") as f:
312
+ resp = requests.post(
313
+ "http://localhost:8000/v1/audio/transcriptions",
314
+ data={
315
+ "model": "OpenMOSS-Team/MOSS-Transcribe-Diarize",
316
+ "response_format": "verbose_json",
317
+ },
318
+ files={"file": ("audio.wav", f, "audio/wav")},
319
+ timeout=300,
320
+ )
321
+
322
+ resp.raise_for_status()
323
+ payload = resp.json()
324
+ print(payload["text"])
325
+ for segment in payload.get("segments", []):
326
+ print(f"[{segment['start']:.2f}-{segment['end']:.2f}] {segment['text']}")
327
+ ```
328
+
329
+ For longer multi-speaker audio, raise `max_new_tokens` so the decoder can finish the full diarized transcript:
330
+
331
+ ```bash
332
+ curl -X POST http://localhost:8000/v1/audio/transcriptions \
333
+ -F model=OpenMOSS-Team/MOSS-Transcribe-Diarize \
334
+ -F file=@audio.wav \
335
+ -F response_format=verbose_json \
336
+ -F max_new_tokens=65536
337
+ ```
338
+
339
+ | Parameter | Type | Default | Description |
340
+ |---|---|---|---|
341
+ | `file` | file | required | Audio file uploaded as multipart form data |
342
+ | `model` | string | server default | Model identifier |
343
+ | `language` | string | unset | Optional language hint |
344
+ | `response_format` | string | `json` | `json`, `verbose_json`, or `text` |
345
+ | `temperature` | float | model default (`0.0`) | Sampling temperature |
346
+ | `max_new_tokens` | int | `5120` | Max generated tokens; raise for long audio, for example `65536` |
347
+ | `prompt` | string | unset | Optional instruction override; omit to use the built-in transcribe+diarize prompt |
348
+
349
+ For benchmarking, performance numbers, and implementation details, see the [SGLang Omni cookbook](https://github.com/sgl-project/sglang-omni/blob/main/docs/cookbook/moss_transcribe_diarize.md). The following single-H100 results are reported for short- and long-sequence multi-speaker ASR tasks.
350
+
351
+ `movies` short-sequence ASR:
352
+
353
+ | Concurrency | Throughput (req/s) | Mean latency (s) | RTF mean | audio_s/s |
354
+ |---:|---:|---:|---:|---:|
355
+ | 1 | 2.57 | 0.388 | 0.0612 | 29.76 |
356
+ | 2 | 4.89 | 0.409 | 0.0659 | 56.55 |
357
+ | 4 | 6.62 | 0.513 | 0.0790 | 76.64 |
358
+ | 8 | 6.80 | 0.533 | 0.0810 | 78.70 |
359
+ | 16 | 7.08 | 0.659 | 0.0922 | 81.98 |
360
+
361
+ `aishell4_long` long-sequence ASR:
362
+
363
+ | Concurrency | Throughput (req/s) | Mean latency (s) | RTF mean | audio_s/s |
364
+ |---:|---:|---:|---:|---:|
365
+ | 1 | 0.022 | 45.2 | 0.0197 | 50.64 |
366
+ | 2 | 0.032 | 60.7 | 0.0265 | 74.25 |
367
+ | 4 | 0.036 | 105.6 | 0.0461 | 81.64 |
368
+ | 8 | 0.040 | 172.6 | 0.0754 | 90.62 |
369
+ | 16 | 0.043 | 282.8 | 0.1237 | 98.83 |
370
+
371
  ### Subtitle Web App
372
 
373
  The source package includes a local subtitle workflow for upload, review, subtitle export, and optional FFmpeg burn-in: