Commit Graph
4 Commits
Author SHA1 Message Date
gabby ec39a990e4 voice: default wake word to "Hey Computer", capture command after a pause
openWakeWord ships no "computer" model, so pin a community
openWakeWord-compatible ONNX (Apache-2.0, sha256 in pins.json `wake_word`) and
fetch it into .runtime/voice/wake from scripts/voice-models.py. Its scores run
lower than the official models (~0.26-0.82 on the phrase, <0.02 on negatives),
so the seeded wake.threshold is 0.2 (the official models score ~0.99 at 0.5).

Also fix command capture: after the wake word the daemon now waits
listen_timeout_s (default 3s) for the command's speech to begin instead of
assuming it is glued to the wake word, so a natural pause while the cue beep
plays no longer truncates the command.
2026-10-09 08:19:36 +00:00
gabby b7d405454a voice: add custom Piper voice training pipeline
Record an LJSpeech dataset from the microphone, fine-tune a Piper voice
from the pinned base checkpoint on a GPU host, and verify every take
against its prompt with Whisper before training.

- semif_agent/voice_train.py: neutral, stdlib-only recording helpers
  (LJSpeech dataset writer, prompt loading, WAV I/O, mic-check level
  math, silence-endpointing capture loop) plus transcript-fidelity
  helpers (normalize_text, word_error_rate, compare_transcript).
- scripts/voice-record.py: interactive + hands-free (--speak-prompts /
  --read-prompts) recording; resumes by prompt id and announces how many
  of the 720 prompts remain, so a resume is never mistaken for a rerun.
- scripts/voice-train.sh: piper1-gpl checkout + venv, warmstart
  fine-tune of the pinned medium checkpoint, ONNX export. Handles
  torch>=2.6 weights_only (PosixPath allowlist), the older checkpoint's
  hyperparameters (--model.warmstart_ckpt, not --ckpt_path), the
  espeakbridge in-place dev build, and piper's validation/test splits
  (needed for the default checkpoint callbacks).
- scripts/voice-verify.py: transcribe-and-compare fidelity check
  (empty/mismatch/review/ok), --json report, --from-json + --prune to
  mark bad takes for re-recording without deleting them.
- pins.json: voice block (piper1-gpl ref + medium base checkpoint).
- voice_transport.py: WhisperTranscriber beam_size/vad_filter knobs;
  SoundDeviceAudio.read(timeout=) so a dropped device ends a take
  instead of hanging.
- AGENTS.md: architecture map + roadmap entries; docs/VOICE-TRAIN.md
  the end-to-end guide; tests/test_voice_record.py the helper tests.
2026-10-08 22:37:34 +00:00
gabby 17f16a6bfc engine: opt-in GPU offload for the decision engine
Let the SemIf decision engine run on a GPU via llama.cpp. SemIf's llamacpp
backend is CPU-only by construction (it hardcodes n_gpu_layers=0), so the
agent wraps `_cpu_model_params` for the duration of the load and restores it
after — no patch to the re-cloned engine source.

- `engine.gpu_layers` / `gpu_device` / `gpu_split` in config (default 0 = CPU).
- On the GPU path, force a full cache reset (`llama_memory_clear(mem, True)`):
  SemIf's metadata-only clear leaves stale hybrid-attention state on Vulkan,
  so repeated scores drift (0.08 -> 0.36 -> 0.43) and return wrong
  probabilities.
- Fail loudly when `gpu_layers` is set but the build has no GPU backend.
- bootstrap.sh: opt-in `--gpu auto|vulkan|rocm|cuda|cpu`. A GPU build is
  opt-in because llama.cpp's Vulkan backend splits the graph across CPU and
  Vulkan even at `n_gpu_layers=0`, roughly halving CPU throughput, so a CPU-only
  host must keep the CPU wheel. Detects the backend, installs the Vulkan build
  prereqs, and rebuilds when offload support disagrees (pip's wheel cache
  otherwise serves the CPU wheel back).
- Bump the SemIf pin 1f2dea3 -> 23cf1f3.
- Tests: unit coverage for the config mapping + loader patches; an integration
  test asserting GPU determinism and CPU parity.
- Offload needs the accelerator to itself (~2.9 GiB for the 4B Q4 model): a GPU
  already holding another model makes the engine slower than CPU and can abort
  with `vk::DeviceLostError`.
2026-10-07 05:21:21 +00:00
gabby 43ece0cfd6 bootstrap: seed config.json once; move refs to committed pins.json
config.json is now per-machine USER config that no code writes: bootstrap
seeds it from config.example.json only when absent, then reads every
per-machine value from it. Flags override those values for the run only and
are never written back.

External refs (engine commit, GGUF url+sha256, HF tokenizer revision,
simplex-chat version/url+sha256) move out of config into a committed,
code-owned pins.json, so a git pull bump propagates on the next bootstrap
run instead of being frozen per machine. The agent reads engine
source/revision from pins.json and derives the GGUF path from engine.gguf_url
under .runtime/models/ (an explicit engine.gguf in config.json overrides it).

- config.example.json: drop all refs; ship the provisioned defaults
  (codegen.timeout 3600, gateway/bridge enabled, dashboard 127.0.0.1)
- scripts/bootstrap.sh: seed config.json if absent, read pins from pins.json
  and per-machine values from config.json, never write config.json; drop the
  flags that only existed to populate config.json; US-delimit read fields so
  empty values do not shift later fields
- semif_agent/cli.py: add load_pins / build_engine_config; load_config
  hard-errors when config.json is missing
- tests/integration + README/AGENTS updated
2026-10-02 19:47:56 +00:00