[Wake/VAD/STT 与 Live runtime]:完成真实重复语音运行,包含云端ASR/TTS开关、run-live和临时上下文测试
This commit is contained in:
@@ -99,6 +99,34 @@ def required_model_files(models_dir: str | Path) -> tuple[str, ...]:
|
||||
return tuple(str(item) for item in files)
|
||||
|
||||
|
||||
def vad_model_path(models_dir: str | Path) -> Path:
|
||||
root = Path(models_dir)
|
||||
manifest = load_manifest(root)
|
||||
path = manifest.get("providers", {}).get("vad", {}).get("path", "vad/silero_vad.onnx")
|
||||
return root / str(path)
|
||||
|
||||
|
||||
def stt_model_paths(model_path: str | Path) -> dict[str, Path]:
|
||||
root = Path(model_path)
|
||||
if (root / "manifest.json").exists() or (root / "stt").exists():
|
||||
manifest = load_manifest(root)
|
||||
stt = manifest.get("providers", {}).get("stt", {})
|
||||
return {
|
||||
"model_dir": root / str(stt.get("model_dir", f"stt/{DEFAULT_STT_DIR}")),
|
||||
"tokens": root / str(stt.get("tokens", f"stt/{DEFAULT_STT_DIR}/tokens.txt")),
|
||||
"encoder": root / str(stt.get("encoder", f"stt/{DEFAULT_STT_DIR}/encoder-epoch-99-avg-1.int8.onnx")),
|
||||
"decoder": root / str(stt.get("decoder", f"stt/{DEFAULT_STT_DIR}/decoder-epoch-99-avg-1.onnx")),
|
||||
"joiner": root / str(stt.get("joiner", f"stt/{DEFAULT_STT_DIR}/joiner-epoch-99-avg-1.int8.onnx")),
|
||||
}
|
||||
return {
|
||||
"model_dir": root,
|
||||
"tokens": root / "tokens.txt",
|
||||
"encoder": root / "encoder-epoch-99-avg-1.int8.onnx",
|
||||
"decoder": root / "decoder-epoch-99-avg-1.onnx",
|
||||
"joiner": root / "joiner-epoch-99-avg-1.int8.onnx",
|
||||
}
|
||||
|
||||
|
||||
def check_speech_models(models_dir: str | Path, require_sherpa: bool = True) -> SpeechModelStatus:
|
||||
root = Path(models_dir)
|
||||
manifest_path = root / "manifest.json"
|
||||
|
||||
Reference in New Issue
Block a user