fix: auto-download dicta ONNX model for Hebrew diacritization#512
Open
voidborne-d wants to merge 1 commit intoresemble-ai:masterfrom
Open
fix: auto-download dicta ONNX model for Hebrew diacritization#512voidborne-d wants to merge 1 commit intoresemble-ai:masterfrom
voidborne-d wants to merge 1 commit intoresemble-ai:masterfrom
Conversation
…le-ai#467) `add_hebrew_diacritics()` called `Dicta()` with no arguments, but `dicta_onnx.Dicta.__init__` requires a `model_path` argument pointing to an ONNX model file. The resulting `TypeError` was swallowed by the `except Exception` handler, so Hebrew TTS silently received un-voweled text and produced gibberish speech output. Changes: - Add `_get_dicta_model_path()` that auto-downloads the int8 ONNX model (~300 MB) from the official dicta-onnx GitHub release on first use, caching it under `$XDG_CACHE_HOME/chatterbox/dicta/` (or `~/.cache/chatterbox/dicta/`) - Support `DICTA_MODEL_PATH` env-var to override auto-download with a local .onnx file (for airgapped/Docker environments) - Atomic write (tmpfile + os.replace) prevents partial downloads from poisoning the cache - Improved warning messages: tell users exactly how to install dicta-onnx or set the env-var, instead of a generic 'failed' message - 17 regression tests covering env-var override, cache creation, download, cache hit, partial cleanup, model_path passing to Dicta(), missing dependency warnings, source-code audit (no bare Dicta() calls), and full round-trip integration
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
Fixes #467 — Hebrew diacritization silently fails because
add_hebrew_diacritics()callsDicta()with no arguments, butdicta_onnx.Dicta.__init__requires amodel_pathargument.Problem
dicta_onnx.Dictarequires a path to a separately-downloaded ONNX model file (~300 MB). The current code:The
TypeErroris caught by theexcept Exceptionhandler and logged as a warning. Hebrew TTS receives bare consonants with no niqqud, producing gibberish speech output.Fix
_get_dicta_model_path()function auto-downloads the int8 ONNX model from the official dicta-onnx GitHub release on first use, caching it under$XDG_CACHE_HOME/chatterbox/dicta/(or~/.cache/chatterbox/dicta/)DICTA_MODEL_PATHlets users point to a local.onnxfile (useful for airgapped/Docker environments)os.replaceso a partial download never poisons the cachedicta-onnxor set the env-var, instead of a generic 'failed' messageTests
17 regression tests in
tests/test_hebrew_diacritization.pycovering:model_pathcorrectly passed toDicta()dicta_onnxor model file is missingDicta()calls remainAll tests are lightweight (no GPU, no real model download, no torch/torchaudio dependency).