Add generate_streaming for Streaming Audio Generation#262
Open
balalofernandez wants to merge 13 commits into
Open
Add generate_streaming for Streaming Audio Generation#262balalofernandez wants to merge 13 commits into
balalofernandez wants to merge 13 commits into
Conversation
buttercrab
suggested changes
Jul 22, 2025
| ) | ||
| start_time = time.time() | ||
|
|
||
| if current_step_idx - last_yield_step >= chunk_size: |
Contributor
There was a problem hiding this comment.
Due to delay patterns, the first chunk is smaller than other chunks
| for i in range(batch_size): | ||
| generated_codes[i, : total_lens[i], :] = all_tokens[i] | ||
| lengths_Bx = torch.tensor(total_lens, device=self.device) | ||
| audio_chunks = self._generate_output(generated_codes, lengths_Bx) |
Contributor
There was a problem hiding this comment.
This is inefficient. Only process newly generate tokens.
Author
There was a problem hiding this comment.
I noticed some artifacts when passing only the new tokens to the vocoder.
Contributor
There was a problem hiding this comment.
Okay can you fix the delay pattern problem?
|
Thanks a ton ! |
Awaiskhan404
approved these changes
Aug 19, 2025
|
Thanks, when will this feature be release? |
|
When Can we expect this feature? |
|
any update? |
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.
This PR introduces the
generate_streamingfunction, which enables streaming audio generation. As soon as audio tokens are generated by the model, the vocoder is run on the entire sequence (using the full sentence as context for best quality), and only the newly generated audio chunk is yielded. The implementation closely mirrors the existinggeneratefunction, but is kept as a separate function (without extracting shared logic) to make the review process easier.Hopefully adding support for #11, #93, #237, making it usable in conversational use cases #181 and accelerating ttfb #153.