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.
This commit is contained in:
gabby committed 2026-10-08 22:37:34 +00:00
1 parent aa25693091
commit b7d405454a
10 files changed
+2778 -6

No files matched your search

+8 -1
View File
@@ -1,5 +1,5 @@
{
"_comment": "Committed pin manifest for the external artifacts this repo downloads: the SemIf engine ref, the pinned GGUF, the HF tokenizer revision, and the simplex-chat binary. These are code-owned, deployment-independent values bumped by a git change and picked up on the next `scripts/bootstrap.sh` run. They are deliberately NOT in config.json (per-machine user config): a ref that changes with every update is not user configuration. The agent reads engine.source/revision from here; the GGUF path is derived from engine.gguf_url unless config.json overrides engine.gguf.",
"_comment": "Committed pin manifest for the external artifacts this repo downloads: the SemIf engine ref, the pinned GGUF, the HF tokenizer revision, the simplex-chat binary, and the voice-training toolchain/checkpoint. These are code-owned, deployment-independent values bumped by a git change and picked up on the next `scripts/bootstrap.sh` run (the voice refs by `scripts/voice-train.sh`). They are deliberately NOT in config.json (per-machine user config): a ref that changes with every update is not user configuration. The agent reads engine.source/revision from here; the GGUF path is derived from engine.gguf_url unless config.json overrides engine.gguf.",
"engine": {
"semif_repo": "https://github.com/TheoLeeCJ/SemIf.git",
"semif_ref": "23cf1f39fc9534fe81437200959b6dfc7106e45a",
@@ -12,5 +12,12 @@
"version": "v7.0.3",
"bin_url": "https://github.com/simplex-chat/simplex-chat/releases/download/v7.0.3/simplex-chat-ubuntu-24_04-x86_64",
"sha256": "895fb14cfaa662d1c0947f2f871141fc89680fe3e70bff64c366cbe9e59aa4f0"
},
"voice": {
"_comment": "Piper TTS voice-training refs used by scripts/voice-train.sh (optional, off-bootstrap): the piper1-gpl training toolchain commit and the medium base checkpoint it fine-tunes from. See docs/VOICE-TRAIN.md.",
"piper_train_repo": "https://github.com/OHF-Voice/piper1-gpl.git",
"piper_train_ref": "efffbfb226bfb511ebbcf55d0cecd8b35a89743d",
"base_checkpoint_url": "https://huggingface.co/datasets/rhasspy/piper-checkpoints/resolve/main/en/en_US/lessac/medium/epoch=2164-step=1355540.ckpt",
"base_checkpoint_sha256": "ab7e5b8dab40f834b7cc58ae4ad7b7009c954b901e4ddbb784bbe11ce379a1cd"
}
}