forked from huggingface/speech-to-speech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule_arguments.py
More file actions
93 lines (89 loc) · 3.76 KB
/
Copy pathmodule_arguments.py
File metadata and controls
93 lines (89 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from dataclasses import dataclass, field
from typing import Optional
from speech_to_speech.backend_registry import LLM_BACKENDS, STT_BACKENDS, TTS_BACKENDS
_AUDIO_INPUT_LLM_BACKENDS = ", ".join(
name for name, spec in LLM_BACKENDS.items() if spec.capabilities.supports_audio_input
)
_PROXY_LLM_BACKENDS = ", ".join(name for name, spec in LLM_BACKENDS.items() if spec.capabilities.supports_llm_proxy)
@dataclass
class ModuleArguments:
device: Optional[str] = field(
default=None,
metadata={"help": "If specified, overrides the device for all handlers."},
)
mac_optimal_settings: bool = field(
default=False,
metadata={
"help": "If specified, provides macOS defaults: Parakeet TDT for STT, MLX LM for the language "
"model, Qwen3-TTS for TTS, and MPS for supported component devices. Explicit component, model, "
"global-device, and component-device flags override these defaults. It does not select a command.",
},
)
stt: Optional[str] = field(
default="parakeet-tdt",
metadata={
"choices": tuple(STT_BACKENDS),
"help": "The STT to use. Use 'none' to send VAD audio directly to an audio-input LLM. "
f"Audio-input LLM backends: {_AUDIO_INPUT_LLM_BACKENDS}. Select an explicitly audio-capable "
"model with --model_name. Default is 'parakeet-tdt'.",
},
)
llm_backend: Optional[str] = field(
default="responses-api",
metadata={
"choices": tuple(LLM_BACKENDS),
"help": "The LLM backend to use. Default is 'responses-api'.",
},
)
tts: Optional[str] = field(
default="qwen3",
metadata={
"choices": tuple(TTS_BACKENDS),
"help": "The TTS backend to use. Default is 'qwen3'.",
},
)
log_level: str = field(
default="info",
metadata={"help": "Provide logging level. Example --log_level debug, default=info."},
)
enable_live_transcription: bool = field(
default=True,
metadata={
"help": "Enable live transcription display while user is speaking (works with parakeet-tdt). Default is true."
},
)
live_transcription_update_interval: float = field(
default=0.5,
metadata={"help": "Update interval for live transcription in seconds (default: 0.5s = 500ms)"},
)
live_transcription_min_silence_ms: int = field(
default=500,
metadata={
"help": "Minimum silence duration (ms) before ending speech when live transcription is enabled (default: 500ms)"
},
)
enable_llm_proxy: bool = field(
default=False,
metadata={
"help": f"Expose a proxy-capable LLM backend ({_PROXY_LLM_BACKENDS}) as an "
"OpenAI-compatible HTTP endpoint on the realtime server. The server performs no authentication of "
"its own: enable it only on a trusted network or behind a gateway that owns access control. Off by "
"default."
},
)
llm_proxy_connect_timeout_s: float = field(
default=10.0,
metadata={
"help": "Connect timeout in seconds for LLM proxy requests to the upstream provider. Reads have no "
"timeout (generation may take minutes). Default is 10.0."
},
)
num_pipelines: int = field(
default=1,
metadata={
"help": "Number of isolated pipeline instances in the pool. One uvicorn server listens on "
"--port and routes each incoming client to the next free pipeline (each has its own "
"VAD/STT/LM/TTS handlers and conversation state). Max concurrent websocket sessions equals "
"num_pipelines; further connections are rejected. Default is 1."
},
)