feat: gpu-check probe + resident TTS daemon (serve)
Add two subcommands and the deps they need, shipped as madcat-say 0.1.0.
gpu-check (Sources/GpuCheck.swift)
Queries the Metal device and runs a small MLX compute probe to verify
the GPU pipeline + bundled mlx.metallib resolve before synth.
serve (Sources/Serve.swift)
Loopback HTTP daemon (default 127.0.0.1:8765, Hummingbird). Loads
VoxCPM2 once behind an actor (serializes the single GPU), warms the
pipeline at boot, caches the last reference voice. Routes:
GET /health -> {status,model,ready,uptime_s}
POST /v1/audio/speech {input|text, voice?, language?, timesteps?,
cfg?, prepad?} -> audio/wav
Cuts warm synth to ~3.2s vs ~6.3s cold (in-process model load).
speak (Sources/MadcatSay.swift)
Probes the daemon /health (0.6s) and forwards over HTTP when up;
falls back to in-process load otherwise. New flags --daemon-port,
--no-daemon.
Package.swift: add mlx-swift (GPU probe) and hummingbird 2.5..<2.17
(HTTP only, no WebSocket — avoids the swift-websocket pin).
Makefile: resolve the metallib via `swift build --show-bin-path` on
both packages instead of the triple-prefixed/symlink path, which is
not always present in speech-swift.
This commit is contained in:
@@ -7,6 +7,12 @@ let package = Package(
|
||||
dependencies: [
|
||||
.package(path: "../speech-swift"),
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
|
||||
// MLX core — used by `gpu-check` to query the Metal device and run a
|
||||
// GPU compute probe. Same package speech-swift resolves (pinned 0.31.x).
|
||||
.package(url: "https://github.com/ml-explore/mlx-swift", from: "0.30.0"),
|
||||
// Hummingbird — loopback HTTP server for the `serve` resident TTS daemon.
|
||||
// Same range speech-swift pins; HTTP only, no WebSocket.
|
||||
.package(url: "https://github.com/hummingbird-project/hummingbird.git", "2.5.0"..<"2.17.0"),
|
||||
],
|
||||
targets: [
|
||||
.executableTarget(
|
||||
@@ -15,6 +21,8 @@ let package = Package(
|
||||
.product(name: "VoxCPM2TTS", package: "speech-swift"),
|
||||
.product(name: "AudioCommon", package: "speech-swift"),
|
||||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||
.product(name: "MLX", package: "mlx-swift"),
|
||||
.product(name: "Hummingbird", package: "hummingbird"),
|
||||
],
|
||||
path: "Sources",
|
||||
swiftSettings: [.swiftLanguageMode(.v5)]
|
||||
|
||||
Reference in New Issue
Block a user