Fixes #424: "Turbo can only generate small bits of audio (~350 chars) correctly without hallucinating"#457
Open
ahmadshajhan wants to merge 8 commits intoresemble-ai:masterfrom
Open
Fixes #424: "Turbo can only generate small bits of audio (~350 chars) correctly without hallucinating"#457ahmadshajhan wants to merge 8 commits intoresemble-ai:masterfrom
ahmadshajhan wants to merge 8 commits intoresemble-ai:masterfrom
Conversation
…patibility and add documentation for these changes.
…ding for CPU/MPS, and make Hugging Face token optional.
…odule import tests, and integrate `pip-audit` security scanning into CI.
…ations and add a reproduction script.
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
This PR addresses the critical "hallucination" issue (#424) where the Turbo model produces confusing text when handling input longer than about 350 characters.
By using a smart chunking strategy, the system now automatically identifies long input and divides it into clear, sentence-based segments. These segments are processed one at a time and then combined smoothly, allowing for nearly unlimited text length without loss of quality.
Key Changes
Logic & Stability
Automatic Length Detection: The
generate
method now tracks input length. If the text goes over 300 characters, the safety protocol activates.
Context-Aware Chunking: Rather than making random cuts, the text is divided using a regex pattern
([.!?]+(?:\s+|$))
to ensure breaks occur naturally at sentence endings. This maintains prosody and flow.