# Aletheia Russian Piper/VITS training

The selected deployment format is a single-speaker Piper/VITS model exported to ONNX. Piper's current official
training interface consumes `wav-file|text` CSV rows, supports Russian through the `ru` espeak-ng voice, and
exports a checkpoint with `python3 -m piper.train.export_onnx`.

## GPU host prerequisites

- Windows or Linux with an NVIDIA CUDA GPU and a working `nvidia-smi`.
- Git, Python 3, build-essential, CMake, and Ninja.
- A checkout of `https://github.com/OHF-Voice/piper1-gpl` with the `[train]` dependencies installed and
  `build_monotonic_align.sh` completed.
- The generated Aletheia dataset directory containing `metadata.csv` and `wav/`.

## Scratch training

```bash
git clone https://github.com/OHF-Voice/piper1-gpl.git
cd piper1-gpl
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e '.[train]'
./build_monotonic_align.sh
python3 setup.py build_ext --inplace

/path/to/Aletheia/tools/tts/train_piper.sh \
  /path/to/tts-dataset \
  /path/to/tts-training \
  "$PWD" \
  2000
```

No `--ckpt_path` is passed: the Aletheia acoustic model is initialized from scratch. This is intentionally slower
than Piper's recommended checkpoint fine-tuning. The exported deliverables are `aletheia_ru.onnx`,
`aletheia_ru.onnx.json`, and `artifacts.json` with byte counts and SHA-256 hashes.

Before accepting the model, synthesize a held-out Russian validation list at multiple `length_scale`,
`noise_scale`, and `noise_scale_w` settings, measure real-time factor on the target phone, and listen for skipped
words, unstable stress, clicks, and repeated phonemes. A successful export alone is not a quality gate.

On native Windows, first run the one-batch CUDA check:

```powershell
.\train_piper_windows.ps1 `
  -DatasetDir C:\path\to\tts-dataset `
  -OutputDir C:\path\to\tts-smoke `
  -PythonExe C:\path\to\.venv\Scripts\python.exe `
  -SmokeTest
```

The default Windows batch size is 4 so the smoke test can establish actual memory use before increasing it.
