buddi-asr-source-code / docs /RASPBERRY_PI.md
mrchatgpt's picture
Initial commit of buddi-asr source
f4931e8 verified
|
Raw History Blame Contribute Delete
3.08 kB
# Raspberry Pi 5 deployment
## Target
- Raspberry Pi 5, 16 GB, 64-bit Raspberry Pi OS;
- active cooling and the official power supply;
- NVMe storage and Ethernet;
- `whisper.cpp` kept warm as a local HTTP service;
- Q5 Tiny and Base compared on the same held-out child manifest.
The 16 GB board adds model/context headroom but does not add CPU cores. Benchmark one and two active conversations; do not infer multi-user capacity from idle WebSocket counts.
## Build runtime
Install system packages:
```bash
sudo apt update
sudo apt install -y git cmake build-essential libopenblas-dev ffmpeg
```
Build a fresh, pinned runtime directory:
```bash
./scripts/build_pi_runtime.sh /opt/buddi/whisper.cpp
```
The script defaults to `v1.9.2`; override explicitly if you have validated another revision:
```bash
WHISPER_CPP_REF=v1.9.2 ./scripts/build_pi_runtime.sh /opt/buddi/whisper.cpp
```
Copy the exported model and its JSON metadata into `/opt/buddi/models/`, then verify the SHA-256 printed by the export metadata:
```bash
sha256sum /opt/buddi/models/buddi-asr-tiny-argulf-v1-q5_0.bin
```
## Run locally
```bash
/opt/buddi/whisper.cpp/build/bin/whisper-server \
--host 127.0.0.1 \
--port 8080 \
--model /opt/buddi/models/buddi-asr-tiny-argulf-v1-q5_0.bin \
--threads 4
```
Keep the service on `127.0.0.1`. Put the Buddi API on the same device, or use a private authenticated tunnel. Do not expose the inference endpoint directly to the public internet.
## systemd
Create a dedicated unprivileged user and install the included unit after reviewing paths:
```bash
sudo useradd --system --home /nonexistent --shell /usr/sbin/nologin buddi
sudo cp deploy/systemd/buddi-asr.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now buddi-asr
sudo systemctl status buddi-asr
```
## Measure real capacity
Use the persistent server so model-loading time is excluded. Run identical samples at concurrency one and two:
```bash
buddi-asr benchmark-server data/manifests/splits/test.jsonl reports/pi-c1 \
--concurrency 1 --limit 100
buddi-asr benchmark-server data/manifests/splits/test.jsonl reports/pi-c2 \
--concurrency 2 --limit 100
```
Compare:
- p50 and p95 ASR latency;
- p50 and p95 real-time factor;
- WER/CER, to catch export/quantization regressions;
- CPU temperature, throttling, memory, and request failures.
Suggested monitoring commands:
```bash
vcgencmd measure_temp
vcgencmd get_throttled
systemd-cgtop
```
A real-time factor below `1.0` means transcription is faster than audio duration. Voice UX also includes VAD endpointing, network, LLM first-token latency, and TTS startup; measure the whole Buddi turn separately.
## Operational rules
- Rate-limit by child/session in the parent Buddi API.
- Cap upload duration and body size before forwarding to ASR.
- Avoid logging raw audio or full child transcripts.
- Use an outbound Tailscale/Cloudflare tunnel if remote access is required; do not depend on public IPv4 or port forwarding.
- Keep Tiny as a fallback if Base misses latency or thermal targets.