Skip to content

Latest commit

 

History

History
155 lines (115 loc) · 6.15 KB

cli.md

File metadata and controls

155 lines (115 loc) · 6.15 KB

RapidSpeech CLI

pip install rapidspeech ships a rapidspeech console command that covers the zero-config first run: no CMake, no manual model download, no absolute paths.

Quick start

pip install rapidspeech          # or rapidspeech-metal / rapidspeech-cuda

rapidspeech transcribe audio.wav              # ASR — downloads the default model on first use
rapidspeech speak "你好,世界" -o hello.wav     # TTS — downloads the default model on first use
rapidspeech serve                             # API server + browser console

The first run downloads the default models into ~/.cache/rapidspeech/models/ (resumable, sha256-verified). Subsequent runs are fully offline.

Commands

rapidspeech doctor

Diagnoses the install: OS/arch, native module import, model cache, bundled TTS G2P data, registry defaults, mirror reachability. Run this first when anything fails — every problem line comes with a fix suggestion.

rapidspeech models

Lists the model registry with size, cache status and known issues:

ID                       TASK   SIZE       CACHED    DESCRIPTION
funasr-nano:q4_k_m *     asr    692 MB     yes       FunASR-Nano offline ASR ...
kokoro-zh:q8_0 *         tts    107 MB     yes       Kokoro v1.1-zh TTS ...

* marks the default variant used when you omit :variant.

rapidspeech pull <id>...

Prefetch models, e.g. rapidspeech pull funasr-nano kokoro-zh:f16. Downloads resume automatically after an interruption and are verified against the sha256 recorded in the registry. Pulling a TTS model also pulls its default voice pack.

rapidspeech transcribe <audio.wav>

flag meaning
--model <id|path> registry ID (default funasr-nano) or a local .gguf
--two-pass CTC first pass, then LLM rescoring
--threads N / --cpu CPU threads / disable GPU

Only the transcription goes to stdout, so the output is pipeable.

rapidspeech speak <text>

flag meaning
-o out.wav output path (default output.wav)
--model <id|path> registry ID (default kokoro-zh) or a local .gguf
--voice <name> kokoro voice pack, e.g. zf_001 (default) / zm_009
--lang zh text language (kokoro G2P is Chinese; English words inside Chinese text are handled)

The Chinese G2P data (jieba dict, pinyin tables, WeText FSTs) ships inside the wheel; the CLI wires it up via RS_KOKORO_*_DATA_DIR automatically.

rapidspeech serve

Starts the native RapidSpeech server and opens the browser test console:

pip install rapidspeech
rapidspeech serve

The first run downloads the default ASR, TTS, and VAD models, then exposes:

surface endpoint
Browser console http://127.0.0.1:8080/webui.html
OpenAI ASR POST /v1/audio/transcriptions
OpenAI TTS POST /v1/audio/speech
Streaming ASR ws://127.0.0.1:8081/asr/stream and /asr/vad
Streaming TTS ws://127.0.0.1:8081/tts/stream and /tts/segmented

Useful flags:

flag meaning
--asr-model / --tts-model / --vad-model registry ID or .gguf path
--host / --port / --ws-port HTTP and WebSocket bind settings
--no-vad skip VAD download/load and disable /asr/vad
--two-pass / --ctc-precheck FunASR-Nano decode controls
--cpu / --threads N backend and threading controls
--no-browser print URLs without opening the browser

Environment variables

variable effect
RAPIDSPEECH_HOME cache root (default ~/.cache/rapidspeech)
RAPIDSPEECH_OFFLINE=1 forbid all network access; error if a model is missing
RAPIDSPEECH_SOURCE mirror order, e.g. huggingface,modelscope (default modelscope,huggingface)
RAPIDSPEECH_HF_ENDPOINT reroute Hugging Face through a mirror, e.g. https://hf-mirror.com
RS_KOKORO_*_DATA_DIR override bundled G2P data locations

Model catalogue

rapidspeech models lists everything below. Any variant works with --model <id> or --model <id>:<variant>; rapidspeech pull <id> prefetches.

ID Task Languages Notes
funasr-nano ASR zh, en default ASR; CTC + optional LLM rescoring, hotword biasing
sense-voice ASR zh, en, ja, ko, yue multilingual; emits language/emotion/event tags
xasr ASR zh, en Zipformer2, offline + true streaming, punctuation
kokoro-zh TTS zh (+en words) default TTS; 82M params, 100+ voices, 24 kHz
omnivoice TTS zh, en single-stage diffusion, instruct-controlled voice
silero-vad VAD any default VAD; tiny universal detector
firered-vad VAD any streaming VAD
campplus Speaker any CAM++ 192-dim speaker embedding

All three ASR models share the transcribe verb (architecture is auto-detected from the GGUF). CosyVoice3 and IndexTTS-2 exist as GGUFs on the model repo but need companion files (speech tokenizer / BigVGAN / emotion model) and are driven through the native rs-tts-offline CLI, not the pip speak command yet — see their model guides.

Model registry

The machine-readable registry lives at rapidspeech/python/_registry.json inside the package. Every entry records: stable ID, task, languages, file size, sha256, download sources (ModelScope + Hugging Face where the bytes match), license and an example command. Files failing hash verification are rejected and the next mirror is tried.

The registry is generated, not hand-edited:

python scripts/gen_model_registry.py          # rebuild from the live repos
python scripts/gen_model_registry.py --check   # CI: fail if stale

Sizes and hashes come straight from the ModelScope API; a Hugging Face mirror is added for a file only when HF's LFS hash matches ModelScope's.

Known issues

  • kokoro-zh:q4_k_m and q3_k_m produce silent/clipped output on the Metal backend (2026-07-16). They work on CPU. The default is q8_0, which is correct on all backends. Being investigated.
  • Hugging Face carries only a subset of the GGUFs (mostly funasr-nano and sense-voice); xasr, kokoro-zh, omnivoice and campplus download from ModelScope. The downloader falls back automatically.