Conversation
This branch has not been deployed
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.
Long inputs to
/v1/audio/speechare synthesized as ordered sentence chunks.speech_chunking.split_sentencesgroups sentences (Latin and CJK terminators, paragraph breaks, over-long sentences wrap at clauses and then spaces) into pieces of aboutspeech_chunk_max_chars.serving_speechsubmits one engine request per piece, keepsspeech_chunk_lookaheadpieces in flight while the current one streams, and concatenates the PCM in order for both streaming and non-streaming responses. Each autoregressive request stays within the length its model was trained for, the engine batches the pieces like independent requests, and a client seed advances per piece.Opt-in per adapter (
speech_chunk_min_chars, off by default) and overridable per request withsentence_chunking: true|false. Adapters that keep the default behave as before. Qwen3-TTS turns it on for inputs of 600+ characters.Also in here: a streaming request now looks at its first engine result before answering 200, so a rejected request (bad voice, dead worker) comes back with its error status instead of an empty WAV, and a mid-stream error closes the stream.
Six commits, one per file. Tests in
test/modular/test_speech_chunking.pycover the splitter and the handler on the stubbed router (ordered ids and playback, per-chunk seeds, streaming concatenation, opt-out, forced chunking, error status). Fulltest/modularpasses.