feat(kokoro-tts): dual-engine ONNX support with HuggingFace model download - #1825
Open
Jehu wants to merge 4 commits into
Open
feat(kokoro-tts): dual-engine ONNX support with HuggingFace model download#1825Jehu wants to merge 4 commits into
Jehu wants to merge 4 commits into
Conversation
- Add kokoro_onnx engine alongside existing kokoro_py (KPipeline) - Auto-download ONNX models from HuggingFace repos - Config: engine, lang, onnx_hf_repo, onnx_model_file, onnx_voices_file - WebUI: engine dropdown, language input, ONNX config section - Refactor: extract _encode_wav_base64, _pkg_version helper - Backward compatible: defaults to kokoro_py/en-us
- New API endpoint POST /api/plugins/_kokoro_tts/resolve_hf_repo - Backend auto-detects .onnx and .npz/.bin files from HF repo API - _detect_hf_files() in runtime.py queries HF API when filenames empty - WebUI: "Detect files" button next to repo input with auto-fill - Backward compatible: explicit filenames still take precedence
refreshStatus() dropped engine, lang, onnx_hf_repo, onnx_model_file, onnx_voices_file when rebuilding config, losing ONNX settings on status refresh. Sync all fields now.
- Add optional secondary language term list for ONNX synthesis - Phonemize matched in-sentence terms with the secondary language - Pass composed phonemes to kokoro_onnx with is_phonemes=True - Add WebUI settings and frontend store persistence for mixed terms
Author
|
Added a follow-up commit for intra-sentence mixed-language pronunciation:
Verified locally with German Martin + English technical terms (API, Machine Learning, Performance, Deployment, Kubernetes, Docker, Frontend, React, TypeScript); generated a WAV successfully. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the built-in Kokoro TTS plugin with a second inference engine:
kokoro_onnx(ONNX Runtime) alongside the existingkokoro_py(PyTorch/KPipeline). This enables community ONNX exports from HuggingFace, e.g. the German voice modelGodelaune/Kokoro-82M-ONNX-German-Martin, without touching the default experience.Changes
engineconfig selectskokoro_py(default, backward compatible) orkokoro_onnxlangconfig (espeak-ng code, e.g.en-us,de) mapped to KPipeline lang codes for kokoro_py and passed through to ONNX synthesisusr/models/cache on first usePOST /api/plugins/_kokoro_tts/resolve_hf_repodetects the.onnxmodel and voices (.npz/.bin) filenames from a HF repo ID; runtime auto-detects when filenames are left emptyTesting
Godelaune/Kokoro-82M-ONNX-German-Martin(model=kokoro-martin.onnx, voices=voices-martin.npz)Notes for reviewers
kokoro-onnxandonnxruntimeare optional runtime dependencies for the ONNX engine; the plugin degrades gracefully when only kokoro_py is installedespeak-ngis already required by the existing kokoro pipeline path