|
Download docs/HANDOFF.md from thucdangvan020999/aurora-wake-model: direct link, hf CLI and curl.
- Browser
- Download file 19.1 kB
-
https://huggingface.co/thucdangvan020999/aurora-wake-model/resolve/main/docs/HANDOFF.md
- Command line
-
hf download hf://thucdangvan020999/aurora-wake-model/docs/HANDOFF.md
-
curl -L -o HANDOFF.md https://huggingface.co/thucdangvan020999/aurora-wake-model/resolve/main/docs/HANDOFF.md
19.1 kB
| # Colleague handoff: complete workflow | |
| Prepared 2026-10-16. This is the current entry point. Numbered Vietnamese documents | |
| are retained research and experiment notes; their original machine paths and | |
| "currently running" statements describe the past. All 14 captured training runs | |
| have summaries, including run 13. The recommended Hey Vita model remains run 5. | |
| ## 1. Repository and environments | |
| Run training and data commands from the repository root. The source is a monorepo: | |
| `src/vitakws` is the training package, `synthesis/` is a separate editable Python | |
| package for Fish generation, and `live/` is a standalone ONNX tester. | |
| Python 3.12 is the reference version. On Ubuntu, install system prerequisites: | |
| ```bash | |
| sudo apt-get install python3-venv python3-dev build-essential libsndfile1 ffmpeg portaudio19-dev | |
| ``` | |
| Create the training environment using pip: | |
| ```bash | |
| python3 -m venv .venv | |
| .venv/bin/python -m pip install --upgrade pip | |
| # For a CPU-only laptop, install CPU torch first: | |
| .venv/bin/python -m pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| .venv/bin/python -m pip install -e '.[all]' | |
| source .venv/bin/activate | |
| make test | |
| ``` | |
| For GPU training, install the CUDA build of PyTorch suitable for the installed | |
| driver before installing the project. `make setup-gpu` is the existing uv-based | |
| alternative. `requirements/training-tested.txt` records key observed versions; | |
| `artifacts/environment_*.json` records full environment version inventories. | |
| These inventories describe the original Linux machine, not portable lockfiles. | |
| Fish's included `uv.lock` is the separate environment lock. | |
| An end-to-end check with synthetic tones needs no real datasets or TTS weights: | |
| ```bash | |
| OMP_NUM_THREADS=2 make smoke | |
| ``` | |
| This generates toy data, trains BC-ResNet-1, evaluates, exports ONNX and mines | |
| negatives. It checks code execution, not speech quality. | |
| ## 2. Serve the included models immediately | |
| No training setup, GPU or dataset is needed. From the repo root: | |
| ```bash | |
| bash live/run.sh | |
| # Windows: live\run.bat | |
| ``` | |
| Open http://localhost:8800 in Chrome/Edge. Select `hey_vita_r5`. Use `--port 8900` | |
| if 8800 is occupied. The launcher installs only `live/requirements.txt`, reads the | |
| shared root `export/` directory, and saves recordings in `live/recordings/`. | |
| The UI supports microphone streaming, file upload, model selection, thresholds, | |
| smoothing, cooldown, and correct/false-accept/missed-keyword labels. Microphone | |
| permission requires localhost or HTTPS. TLS flags are documented in | |
| `live/README.md`. Start with headphones to keep the trigger tone out of the mic. | |
| Training-package alternative after installing `.[live]`: | |
| ```bash | |
| vitakws-live --models export --out data/live --port 8800 | |
| ``` | |
| Both implementations use the same ONNX models. `live/app/features_np.py` is the | |
| standalone frontend; keep it numerically consistent with `src/vitakws/features.py` | |
| when changing feature extraction. | |
| ## 3. Restore existing manifests or start a fresh dataset | |
| ```bash | |
| python3 scripts/restore_manifests.py | |
| ``` | |
| This expands the included reference index, generation plans, original and v4 | |
| training manifests, Piper test manifest, and English comparison manifest. | |
| It replaces portable path tokens with paths on the recipient's machine. It | |
| preserves speaker IDs, split membership, keyword boundaries and metadata. Existing | |
| files are skipped unless `--overwrite` is explicitly passed. | |
| This does not restore audio. See [DATA_TRANSFER.md](DATA_TRANSFER.md) for the | |
| exact audio folders needed to reuse the trained dataset. To use a different disk: | |
| ```bash | |
| python3 scripts/restore_manifests.py --tts-data-root /mnt/tts-data \ | |
| --kws-data-root /mnt/kws-data --bench-data-root /mnt/english-data | |
| ``` | |
| Set `data.manifest` and `augment.rir_dirs` in the training config accordingly. | |
| For a fresh dataset, skip restoring the historical training manifests, and follow | |
| sections 4–6. Restoring only the plans/reference index is optional: a freshly | |
| indexed ViMD dataset creates its own absolute reference paths. | |
| ## 4. Rebuild Fish S2 generation from scratch | |
| Use a separate environment: Fish uses torch/torchaudio 2.8, while training was | |
| tested with a newer PyTorch. Do not install the two into one environment. | |
| Install `uv` through your preferred package manager, then: | |
| ```bash | |
| bash scripts/setup_fish.sh | |
| ``` | |
| This extracts `third_party/fish-speech-source.tar.gz` into | |
| `external-data/src/fish-speech/` and runs `uv sync --frozen --extra cu128`. | |
| The source is commit `bdd39477922a89b904c6f2c7397f2a9bbcc60a0c` of Fish Audio's | |
| repository, including its original license and dependency lock. Override | |
| `FISH_TORCH_EXTRA` for a supported alternative CUDA wheel set if required. | |
| The script creates `synthesis/envs/fish_s2` as a local runtime link; no links are | |
| shipped in the repo or ZIP. | |
| Download weights at the captured revision (about 11 GB, excluded from the repo): | |
| ```bash | |
| external-data/src/fish-speech/.venv/bin/python -c \ | |
| "from huggingface_hub import snapshot_download; snapshot_download('fishaudio/s2-pro', revision='1de9996b6be38b745688de084d87a5633f714e4e', local_dir='external-data/models/s2-pro')" | |
| ``` | |
| Access to that upstream model may require your colleague's own account. The | |
| existing weights can instead be copied to that directory. Required files include | |
| `codec.pth`, both model safetensor shards, model config/index and tokenizer files. | |
| Model weights and corpus licenses are preserved/referenced in `third_party/` | |
| and the numbered dataset notes. | |
| Define paths in the current shell, while at the repository root: | |
| ```bash | |
| export VITA_DATA_ROOT="$PWD/external-data" | |
| export FISH_PY="$VITA_DATA_ROOT/src/fish-speech/.venv/bin/python" | |
| export HF_HOME="$VITA_DATA_ROOT/cache/huggingface" | |
| export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True | |
| ``` | |
| Create one reference WAV per ViMD speaker. This downloads/streams the original | |
| dataset and materializes roughly 45 GB of reference audio: | |
| ```bash | |
| "$FISH_PY" synthesis/scripts/index_vimd_references.py "$VITA_DATA_ROOT/references/vimd" | |
| ``` | |
| Run the positive sets sequentially. The check set reserves speakers 70–99 that | |
| were excluded from the historical bright set; its metadata is used below: | |
| ```bash | |
| "$FISH_PY" synthesis/scripts/generate_fish_s2_check.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/outputs/fish-s2-pro-check-100" \ | |
| --checkpoint "$VITA_DATA_ROOT/models/s2-pro" | |
| "$FISH_PY" synthesis/scripts/generate_fish_s2_matrix.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-matrix-5040" \ | |
| --checkpoint "$VITA_DATA_ROOT/models/s2-pro" --speakers 70 | |
| "$FISH_PY" synthesis/scripts/generate_fish_s2_matrix.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-bright-25000" \ | |
| --checkpoint "$VITA_DATA_ROOT/models/s2-pro" --speakers 12500 \ | |
| --dataset-id fish-s2-pro-vita-bright-25000 --phrase-indices 4 5 --style-indices 9 \ | |
| --exclude-metadata "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-matrix-5040/metadata.jsonl" \ | |
| "$VITA_DATA_ROOT/outputs/fish-s2-pro-check-100/metadata.jsonl" | |
| ``` | |
| Build negatives, then generate each plan: | |
| ```bash | |
| python3 synthesis/scripts/build_fish_negative_plan.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/plans/negatives" | |
| "$FISH_PY" synthesis/scripts/generate_fish_s2_matrix.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-hardneg-30040" \ | |
| --checkpoint "$VITA_DATA_ROOT/models/s2-pro" --dataset-id fish-s2-pro-vita-hardneg-30040 \ | |
| --plan "$VITA_DATA_ROOT/plans/negatives/hard_negative_plan.jsonl" | |
| "$FISH_PY" synthesis/scripts/generate_fish_s2_matrix.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-sentences-10000" \ | |
| --checkpoint "$VITA_DATA_ROOT/models/s2-pro" --dataset-id fish-s2-pro-vita-sentences-10000 \ | |
| --plan "$VITA_DATA_ROOT/plans/negatives/sentence_plan.jsonl" | |
| ``` | |
| Extra "hi" examples use the included original `plans/hi/hi_plan.jsonl` after | |
| restoration. Or create a new reproducible selection with `scripts/build_hi_plan.py` | |
| (its seed/job IDs are new, so use the archived plan for the historical selection): | |
| ```bash | |
| python3 scripts/build_hi_plan.py "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-bright-25000/metadata.jsonl" \ | |
| "$VITA_DATA_ROOT/plans/hi/new_hi_plan.jsonl" | |
| "$FISH_PY" synthesis/scripts/generate_fish_s2_matrix.py \ | |
| "$VITA_DATA_ROOT/references/vimd/references.jsonl" "$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-hi-4000" \ | |
| --checkpoint "$VITA_DATA_ROOT/models/s2-pro" --dataset-id fish-s2-pro-vita-hi-4000 \ | |
| --plan "$VITA_DATA_ROOT/plans/hi/hi_plan.jsonl" | |
| ``` | |
| Use `new_hi_plan.jsonl` in the last command if choosing a new selection. Matrix | |
| generation resumes by job ID; rerun exactly the same command and output folder. | |
| The initial `generate_fish_s2_check.py` resumes by row count. Keep sampling settings, | |
| reference index and plans unchanged during a resumed generation. The source | |
| machine used a 16 GB RTX 4060 Ti with FP16 and a 4096-token cache; do not run GPU | |
| training concurrently. Longer reference encoding can fall back to CPU. | |
| For single-clip generation with UI/API, create a third, lightweight environment: | |
| ```bash | |
| python3 -m venv synthesis/.venv | |
| synthesis/.venv/bin/python -m pip install -e './synthesis[test,audio]' | |
| cd synthesis | |
| export FISH_S2_CHECKPOINT="${VITA_DATA_ROOT}/models/s2-pro" | |
| .venv/bin/vwtts serve --port 7860 | |
| ``` | |
| Return to the repository root for the remaining steps. Batch scripts use Fish's | |
| Python directly; the `vwtts` UI dispatches to the isolated worker environment. | |
| ## 5. ASR screening, resampling, background data and splits | |
| First screen each generated training set with the Vietnamese CTC recognizer. | |
| Run the commands below once per dataset, replacing the example dataset name: | |
| ```bash | |
| export VITA_SET="$VITA_DATA_ROOT/outputs/fish-s2-pro-vita-matrix-5040" | |
| "$FISH_PY" synthesis/scripts/check_fish_asr.py "$VITA_SET" --device cpu | |
| vitakws-data import-fish --metadata "$VITA_SET/metadata.jsonl" \ | |
| --audio-out data/fish_s2/audio --out data/fish_s2/matrix_raw.jsonl | |
| python scripts/apply_asr_screen.py data/fish_s2/matrix_raw.jsonl \ | |
| data/fish_s2/matrix_screened.jsonl "$VITA_SET/asr_check.jsonl" | |
| ``` | |
| Choose distinct raw/screened output names for `bright`, `hardneg`, `sentences` | |
| and `hi`. `import-fish` converts to mono 16 kHz, computes active keyword | |
| boundaries, and filters abnormal durations. `apply_asr_screen.py` removes clear | |
| pronunciation/label errors. For the later clean-negative experiment, pass | |
| `--ambiguous-share 0.002` with all positive/negative ASR check files together. | |
| ASR is a rough screening signal; listen to representative clips using | |
| `synthesis/scripts/build_fish_gallery.py`. Whisper was unreliable for these very | |
| short utterances. The stricter positive-onset filter in | |
| `scripts/filter_positives_by_onset.py` is an optional experiment, not part of r5. | |
| Merge the screened Fish manifests: | |
| ```bash | |
| vitakws-data merge --inputs data/fish_s2/matrix_screened.jsonl \ | |
| data/fish_s2/bright_screened.jsonl data/fish_s2/hardneg_screened.jsonl \ | |
| data/fish_s2/sentences_screened.jsonl data/fish_s2/hi_screened.jsonl \ | |
| --out data/fish_s2/synthetic.jsonl | |
| python scripts/import_vimd_references.py "$VITA_DATA_ROOT/references/vimd/references.jsonl" data/vimd/manifest.jsonl | |
| ``` | |
| Acquire/extract MUSAN and RIRS_NOISES separately using the source links already | |
| recorded in `docs/05_fish_s2_dataset.md`. Directory layout: | |
| `external-data/corpora/musan/{noise,music,speech}` and | |
| `external-data/corpora/RIRS_NOISES/simulated_rirs/{smallroom,mediumroom}`. | |
| Then: | |
| ```bash | |
| vitakws-data add-dir --dir "$VITA_DATA_ROOT/corpora/musan/noise" --label background \ | |
| --source corpus:musan_noise --speaker-from file --speaker-prefix musan_ --out data/musan/background.jsonl | |
| vitakws-data add-dir --dir "$VITA_DATA_ROOT/corpora/musan/music" --label background \ | |
| --source corpus:musan_music --speaker-from file --speaker-prefix musan_ --out data/musan/background.jsonl --append | |
| vitakws-data add-dir --dir "$VITA_DATA_ROOT/corpora/musan/speech" --label negative_speech \ | |
| --source corpus:musan_speech --speaker-from file --speaker-prefix musanspeech_ --out data/musan/speech.jsonl | |
| vitakws-data merge --inputs data/fish_s2/synthetic.jsonl data/vimd/manifest.jsonl \ | |
| data/musan/background.jsonl data/musan/speech.jsonl --out data/fish_s2/new_all.jsonl | |
| vitakws-data split --manifest data/fish_s2/new_all.jsonl --out data/fish_s2/new_split.jsonl \ | |
| --dev 0.1 --test 0.1 --holdout-sources corpus tts | |
| vitakws-data validate --manifest data/fish_s2/new_split.jsonl --classes negative hey_vita --check-audio | |
| vitakws-data stats --manifest data/fish_s2/new_split.jsonl | |
| ``` | |
| Use `--holdout-sources corpus tts` while there are no real keyword recordings; | |
| otherwise dev/test would have no positive examples. Once a split is established, | |
| preserve it when adding clips: | |
| ```bash | |
| python scripts/merge_keep_splits.py --base data/fish_s2/new_split.jsonl \ | |
| --add data/new_recordings.jsonl --out data/fish_s2/next_split.jsonl | |
| ``` | |
| It retains known speakers' splits, hashes new speakers once into 80/10/10, and | |
| rejects duplicate audio/boundaries or conflicting base splits. Supply stable | |
| speaker IDs for every human speaker; the same ViMD speaker must keep the same | |
| `vimd_` prefix for original speech and voice clones. | |
| Optional Piper diversity uses `configs/voices_piper_train.yaml` and | |
| `configs/phrases_piper_train.tsv`; model paths now use `external-data/models/piper`: | |
| ```bash | |
| vitakws-synth --phrases configs/phrases_piper_train.tsv --voices configs/voices_piper_train.yaml \ | |
| --out data/piper_train/new --carrier-prob 0 | |
| python scripts/merge_keep_splits.py --base data/fish_s2/new_split.jsonl \ | |
| --add data/piper_train/new/manifest.jsonl --out data/fish_s2/with_piper.jsonl | |
| ``` | |
| Download the matching `vi_VN-vivos-x_low.onnx` and `.onnx.json` first. Piper | |
| training speakers exclude indices divisible by three; the test voice config | |
| uses the held-out voices. Carrier concatenation is disabled for this recipe. | |
| The historical r5 manifests also contain 664 mined hard negatives. The fresh | |
| recipe above is a new dataset: exact historical membership is in the packed v4 | |
| manifest, not guaranteed by rerunning upstream downloads or stochastic TTS. | |
| ## 6. Train, fine-tune, evaluate, export, collect feedback | |
| Train from scratch on the restored r5 dataset (audio must be present): | |
| ```bash | |
| vitakws-train --config configs/experiments/r5_v4_hi_piper.yaml \ | |
| --set run_name=r5_reproduction wandb.enabled=false | |
| ``` | |
| For the newly generated dataset use that same config with | |
| `data.manifest=data/fish_s2/new_split.jsonl` (or the Piper-augmented manifest). | |
| The architecture is `src/vitakws/models/bcresnet.py`; features, balanced sampling, | |
| waveform/SpecAugment, EMA, LR schedule, and selection metric are in the adjacent | |
| modules and `docs/02_model.md` / `docs/04_training.md`. | |
| Fine-tune the included r5 weights with your combined old+new training data: | |
| ```bash | |
| vitakws-train --config configs/finetune_handoff.yaml \ | |
| --set run_name=hey_vita_field_v1 data.manifest=data/fish_s2/next_split.jsonl | |
| ``` | |
| The checkpoint is a model-weight initialization. Optimizer, AMP scaler, | |
| scheduler, RNG and sampler state were never saved in the original files, so | |
| `last.pt` cannot resume at the exact interrupted step. Fine-tuning starts a new | |
| schedule/run. `best.pt` is the usual initialization; `last.pt` is also retained. | |
| For tau 3/1, change both the checkpoint and `model.tau`. For a new keyword, update | |
| classes, phrase lists and datasets; mismatched classifier shapes are skipped. | |
| Choose thresholds on dev and keep test fixed for final evaluation: | |
| ```bash | |
| python scripts/analyze_run.py --checkpoint runs/hey_vita_field_v1/best.pt \ | |
| --manifest data/fish_s2/next_split.jsonl --split dev \ | |
| --plans "$VITA_DATA_ROOT/plans/negatives/hard_negative_plan.jsonl" | |
| vitakws-eval --checkpoint runs/hey_vita_field_v1/best.pt \ | |
| --manifest data/fish_s2/next_split.jsonl --split test --stream | |
| vitakws-export --checkpoint runs/hey_vita_field_v1/best.pt --out export/hey_vita_field_v1 --threshold 0.45 | |
| ``` | |
| Replace `0.45` with the dev-selected operating threshold for the new model. | |
| `vitakws-eval --stream` computes an operating curve for its input split; it is | |
| not a fixed-dev-threshold acceptance test. Preserve the selected dev threshold | |
| when reporting final deployment quality. The historical test report's 0.74% | |
| miss rate is at its own threshold 0.40; the shipped r5 deployment threshold is | |
| 0.45 from dev. Those are distinct operating points. | |
| Export checks PyTorch/ONNX numerical agreement. Restart either live UI to discover | |
| the new export directory. Keep `model.json` together with `model.onnx`; it defines | |
| the log-mel frontend, window, classes and streaming settings. Architecture-only | |
| ONNX input is log-mel features, not raw audio. | |
| Mine false triggers from train-only negative audio: | |
| ```bash | |
| vitakws-mine --checkpoint checkpoints/r5_v4_hi_piper/best.pt \ | |
| --inputs data/train_negatives.jsonl --out data/mined_next --threshold 0.3 | |
| ``` | |
| Review labels, then merge mined clips and human recordings without moving any | |
| existing speaker across splits. UI `events.jsonl` is a review log, not directly a | |
| training manifest: import each reviewed audio folder with `vitakws-data add-dir`, | |
| stable speaker metadata (`configs/speakers.csv`) and the appropriate labels. | |
| Keep a separate real-microphone test set out of training. Near-name false triggers | |
| remain a known weakness; the project has synthetic evaluation rather than a | |
| validated real-world operating guarantee. | |
| Optional phrase/word alignment for the later customizable-wake-word research uses | |
| the Fish environment's torchaudio/MMS aligner and downloads the aligner on first use: | |
| ```bash | |
| "$FISH_PY" scripts/align_words.py "$VITA_DATA_ROOT/references/vimd/references.jsonl" \ | |
| data/phrases/vimd_words.jsonl | |
| ``` | |
| This is separate from the BC-ResNet recipe. `bench/README.md` describes the | |
| optional DMA-KWS/sherpa comparison environment and model downloads; those larger | |
| alternative-engine weights are not part of the main handoff. | |
| ## 7. Transfer and GitLab | |
| Only this repository or its ZIP is needed for code and serving. It includes four | |
| ONNX exports and eight small model checkpoints, all deliberately tracked without | |
| Git LFS. No remote is configured. Runtime data, environments and new runs are | |
| ignored. There are no credentials or original `.git` directories copied in. | |
| ```bash | |
| python3 scripts/verify_handoff.py | |
| # With the training + live dependencies installed: | |
| python scripts/verify_handoff.py --models | |
| # After editing and staging intended files, regenerate the ZIP and hashes: | |
| git add . | |
| python3 scripts/package_handoff.py | |
| git add artifacts/SHA256SUMS | |
| ``` | |
| `package_handoff.py` packages tracked files only, so an unpacked dataset or local | |
| environment cannot silently inflate the ZIP. `artifacts/provenance.json` records | |
| the original checkpoint hashes and source locations. Keep model-weight and corpus | |
| license terms with the artifacts; this consolidation does not add a new license | |
| to original project code. | |