feat: add CW-026 Local Voice plugin

This commit is contained in:
Bryan Gilliom
2026-07-27 00:33:25 +08:00
commit 5d680928b9
29 changed files with 2697 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
#!/bin/zsh
set -euo pipefail
usage() {
echo "Usage: install_macos.sh --wheel PATH --assets PATH --model-dir PATH [--runtime PATH]"
}
runtime_root="$HOME/Library/Application Support/MPM Local Voice/runtime"
wheel_path=""
assets_path=""
model_source=""
while (( $# )); do
case "$1" in
--runtime)
runtime_root="$2"
shift 2
;;
--wheel)
wheel_path="$2"
shift 2
;;
--assets)
assets_path="$2"
shift 2
;;
--model-dir)
model_source="$2"
shift 2
;;
*)
usage
exit 2
;;
esac
done
if [[ -z "$wheel_path" || -z "$assets_path" || -z "$model_source" ]]; then
usage
exit 2
fi
for required in "$wheel_path" "$assets_path" "$model_source"; do
if [[ ! -e "$required" ]]; then
echo "Missing required input: $required" >&2
exit 2
fi
done
if ! command -v python3.11 >/dev/null 2>&1; then
echo "Python 3.11 is required. Install it with Homebrew first." >&2
exit 2
fi
if ! command -v ffmpeg >/dev/null 2>&1; then
echo "ffmpeg is required and must be available on PATH." >&2
exit 2
fi
if ! command -v whisper >/dev/null 2>&1; then
echo "Whisper is required and must be available on PATH." >&2
exit 2
fi
mkdir -p "$runtime_root/models" "$runtime_root/jobs" "$runtime_root/wheels"
python3.11 -m venv "$runtime_root/.venv"
"$runtime_root/.venv/bin/python" -m pip install --upgrade pip
cp -p "$wheel_path" "$runtime_root/wheels/"
"$runtime_root/.venv/bin/python" -m pip install "$wheel_path"
"$runtime_root/.venv/bin/python" -m pip install numpy==2.4.6 soundfile==0.14.0
tar -xzf "$assets_path" -C "$runtime_root"
model_target="$runtime_root/models/CosyVoice3-0.5B-Candle"
mkdir -p "$model_target"
rsync -a "$model_source/" "$model_target/"
echo "Runtime installed at: $runtime_root"
echo "Run scripts/verify_install.py with:"
echo "\"$runtime_root/.venv/bin/python\" scripts/verify_install.py --runtime-root \"$runtime_root\" --device metal"
+1320
View File
File diff suppressed because it is too large Load Diff
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
"""Run a deterministic Local Voice installation preflight."""
from __future__ import annotations
import argparse
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
RENDERER = ROOT / "scripts" / "local_voice.py"
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--runtime-root")
parser.add_argument("--device", choices=("metal", "cpu", "cuda"), default="metal")
args = parser.parse_args()
command = [
sys.executable,
str(RENDERER),
"doctor",
"--device",
args.device,
]
if args.runtime_root:
command.extend(["--runtime-root", args.runtime_root])
completed = subprocess.run(command, check=False)
if completed.returncode:
return completed.returncode
completed = subprocess.run(
[sys.executable, str(RENDERER), "list"],
check=False,
)
if completed.returncode:
return completed.returncode
print("Local Voice installation preflight passed.")
return 0
if __name__ == "__main__":
raise SystemExit(main())