End-to-end conversation latency bench. Drives N sequential turns through a single WebSocket and reports per-phase stats: audio_send_ms (client streaming PCM in until EOT) transcript_ms (server EOT → "transcript" event) first_audio_ms (server "transcript" → first audio chunk) turn_total_ms (full audio_send → "done" event) Pulls /metrics at end for the server-side averages. First numbers on Metal (M-series, 10.43s LibriSpeech FLAC, 3 turns, mock LLM with 50ms/token sleep): audio_send p50=1ms p95=1ms transcript p50=5.2s p95=5.4s (STT, 1.9x realtime) first_audio p50=3.8s p95=4.4s (LLM stream + first sentence TTS) turn_total p50=17.7s p95=18.5s server stt avg 5.3s server tts avg 2.7s/utterance server e2e avg 9.3s These are the empirical baselines for the Rust Unmute MVP. Optimization opportunities: parallel STT during receive (already wired for VAD path), smaller STT model, quantized CSM-1B (already shipped via Q8 GGUF), and the obvious one — replace mock LLM with a real fast endpoint. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
216 lines
6.2 KiB
TOML
216 lines
6.2 KiB
TOML
[package]
|
|
name = "rtx-csm"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
authors.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
description = "Rust-native port of Sesame CSM-1B (Conversational Speech Model) on candle + moshi"
|
|
|
|
# NOTE: candle-transformers 0.8 (workspace pin) does NOT contain the `csm`
|
|
# model module — it was added in 0.9.0. We deliberately pull candle 0.9 + moshi
|
|
# 0.6 directly here, NOT via workspace deps. Cargo will compile candle 0.8 (for
|
|
# the rest of rustytorch) and candle 0.9 (for rtx-csm) side-by-side. No Tensor
|
|
# types are shared across that boundary today.
|
|
|
|
[dependencies]
|
|
# Candle 0.9 — required for the csm model module
|
|
candle-core = { version = "0.9.1", default-features = false }
|
|
candle-nn = { version = "0.9.1", default-features = false }
|
|
candle-transformers = { version = "0.9.1", default-features = false }
|
|
|
|
# Kyutai's moshi crate: provides streaming STT (asr.rs + lm.rs) on top of
|
|
# candle 0.9.1. We use moshi::{asr, lm, mimi} for STT integration. Note:
|
|
# moshi::mimi uses a different weight-key naming than HF's kyutai/mimi
|
|
# (older Kyutai split-format with weight_g/weight_v); we keep our existing
|
|
# Mimi loader on candle_transformers::models::mimi for the HF format. The
|
|
# STT path uses Kyutai's pytorch_mimi file which IS in moshi's expected
|
|
# naming, so they coexist cleanly in different model instances.
|
|
moshi = { version = "0.6.4", default-features = false }
|
|
# SentencePiece tokenizer for Kyutai STT detokenization (token IDs → text).
|
|
sentencepiece = "0.13"
|
|
|
|
# Mimi neural audio codec: we use the HF-compatible `candle-transformers::models::mimi`
|
|
# (not the `moshi` crate, which expects different weight-key naming).
|
|
|
|
# Tokenizer (Llama-3.2 BPE)
|
|
tokenizers = { version = "0.20", default-features = false, features = ["onig"] }
|
|
|
|
# HF Hub asset resolution (synchronous via ureq + rustls)
|
|
hf-hub = { version = "0.5", default-features = false, features = ["ureq", "rustls-tls"] }
|
|
|
|
# Audio I/O
|
|
hound = "3.5"
|
|
symphonia = { version = "0.5", features = ["all"] }
|
|
rubato = "0.15"
|
|
# Loudness normalization (EBU R128 / ITU-R BS.1770-4)
|
|
ebur128 = "0.1"
|
|
|
|
# In-process ASR via whisper.cpp bindings. Optional via the `asr` feature
|
|
# because it pulls a C++ build (cmake + clang). Provides Metal acceleration.
|
|
whisper-rs = { version = "0.16", default-features = false, optional = true }
|
|
|
|
# Text normalization
|
|
unicode-normalization = "0.1"
|
|
regex = "1"
|
|
|
|
# Weight loading
|
|
safetensors = "0.4"
|
|
|
|
# Errors / logging / serde
|
|
anyhow.workspace = true
|
|
thiserror.workspace = true
|
|
tracing.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
|
|
# Numerics
|
|
half = "2.3"
|
|
rand = "0.8"
|
|
bytemuck = { version = "1.14", features = ["derive"] }
|
|
|
|
# Async + HTTP for the LlmClient abstraction (Phase 6b). Promoted from
|
|
# dev-dependency to regular dependency so the trait is part of the public
|
|
# library surface.
|
|
tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync"] }
|
|
futures-util = "0.3"
|
|
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }
|
|
async-trait = "0.1"
|
|
eventsource-stream = "0.2"
|
|
|
|
[dev-dependencies]
|
|
clap = { version = "4.5", features = ["derive"] }
|
|
tempfile = "3.0"
|
|
approx = "0.5"
|
|
tracing-subscriber = "0.3"
|
|
# For the TTS HTTP server + converse_server WebSocket examples.
|
|
axum = { version = "0.7", features = ["multipart", "ws"] }
|
|
# WebSocket client for examples/converse_client.
|
|
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] }
|
|
# tokio with extra features (signal handler) needed by tts_server.
|
|
tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal", "sync"] }
|
|
tower = "0.5"
|
|
tower-http = { version = "0.6", features = ["trace"] }
|
|
# Multipart support added on top of the public reqwest dep for tts_server_bench.
|
|
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "rustls-tls"] }
|
|
|
|
[features]
|
|
default = ["cpu"]
|
|
cpu = []
|
|
cuda = ["candle-core/cuda", "candle-nn/cuda", "candle-transformers/cuda"]
|
|
metal = ["candle-core/metal", "candle-nn/metal", "candle-transformers/metal"]
|
|
accelerate = ["candle-core/accelerate", "candle-nn/accelerate"]
|
|
mkl = ["candle-core/mkl", "candle-nn/mkl"]
|
|
# In-process Whisper ASR via whisper.cpp bindings. Brings in C++ build deps.
|
|
asr = ["dep:whisper-rs"]
|
|
asr-metal = ["asr", "whisper-rs/metal"]
|
|
asr-cuda = ["asr", "whisper-rs/cuda"]
|
|
|
|
[[example]]
|
|
name = "generate"
|
|
path = "examples/generate.rs"
|
|
|
|
[[example]]
|
|
name = "bench"
|
|
path = "examples/bench.rs"
|
|
|
|
[[example]]
|
|
name = "quantize"
|
|
path = "examples/quantize.rs"
|
|
|
|
[[example]]
|
|
name = "inspect_gguf"
|
|
path = "examples/inspect_gguf.rs"
|
|
|
|
[[example]]
|
|
name = "qmatmul_repro"
|
|
path = "examples/qmatmul_repro.rs"
|
|
|
|
[[example]]
|
|
name = "qmm_layer_diff"
|
|
path = "examples/qmm_layer_diff.rs"
|
|
|
|
[[example]]
|
|
name = "lora_train_step"
|
|
path = "examples/lora_train_step.rs"
|
|
|
|
[[example]]
|
|
name = "forward_loss_demo"
|
|
path = "examples/forward_loss_demo.rs"
|
|
|
|
[[example]]
|
|
name = "lora_finetune_step"
|
|
path = "examples/lora_finetune_step.rs"
|
|
|
|
[[example]]
|
|
name = "tts_server"
|
|
path = "examples/tts_server.rs"
|
|
|
|
[[example]]
|
|
name = "lora_train"
|
|
path = "examples/lora_train.rs"
|
|
|
|
[[example]]
|
|
name = "audioseal_inspect"
|
|
path = "examples/audioseal_inspect.rs"
|
|
|
|
[[example]]
|
|
name = "audioseal_convert"
|
|
path = "examples/audioseal_convert.rs"
|
|
|
|
[[example]]
|
|
name = "audioseal_demo"
|
|
path = "examples/audioseal_demo.rs"
|
|
|
|
[[example]]
|
|
name = "audioseal_apply"
|
|
path = "examples/audioseal_apply.rs"
|
|
|
|
[[example]]
|
|
name = "wavlm_sv_convert"
|
|
path = "examples/wavlm_sv_convert.rs"
|
|
|
|
[[example]]
|
|
name = "wavlm_sv_demo"
|
|
path = "examples/wavlm_sv_demo.rs"
|
|
|
|
[[example]]
|
|
name = "wavlm_sv_inspect"
|
|
path = "examples/wavlm_sv_inspect.rs"
|
|
|
|
[[example]]
|
|
name = "pipeline"
|
|
path = "examples/pipeline.rs"
|
|
|
|
[[example]]
|
|
name = "generate_long"
|
|
path = "examples/generate_long.rs"
|
|
|
|
[[example]]
|
|
name = "tts_server_bench"
|
|
path = "examples/tts_server_bench.rs"
|
|
|
|
[[example]]
|
|
name = "stt_demo"
|
|
path = "examples/stt_demo.rs"
|
|
|
|
[[example]]
|
|
name = "llm_chat"
|
|
path = "examples/llm_chat.rs"
|
|
|
|
[[example]]
|
|
name = "converse"
|
|
path = "examples/converse.rs"
|
|
|
|
[[example]]
|
|
name = "converse_server"
|
|
path = "examples/converse_server.rs"
|
|
|
|
[[example]]
|
|
name = "converse_client"
|
|
path = "examples/converse_client.rs"
|
|
|
|
[[example]]
|
|
name = "converse_server_bench"
|
|
path = "examples/converse_server_bench.rs"
|