Skip to content

fix: use local token_hop_len in streaming loop to avoid concurrent st…#1849

Open
Caxson wants to merge 1 commit intoFunAudioLLM:mainfrom
Caxson:fix_streaming_bug
Open

fix: use local token_hop_len in streaming loop to avoid concurrent st…#1849
Caxson wants to merge 1 commit intoFunAudioLLM:mainfrom
Caxson:fix_streaming_bug

Conversation

@Caxson
Copy link
Copy Markdown

@Caxson Caxson commented Mar 12, 2026

…ate mutation

The streaming loop in CosyVoice2Model.tts() mutates self.token_hop_len each iteration (via stream_scale_factor). When multiple requests share the same model instance, this shared state is corrupted across concurrent inferences.

Use a local variable token_hop_len initialized from self.token_hop_len and update only the local copy inside the loop, so each streaming session has its own hop length progression. Behavior is unchanged for single-request usage.

…ate mutation

The streaming loop in CosyVoice2Model.tts() mutates self.token_hop_len each
iteration (via stream_scale_factor). When multiple requests share the same
model instance, this shared state is corrupted across concurrent inferences.

Use a local variable token_hop_len initialized from self.token_hop_len
and update only the local copy inside the loop, so each streaming session
has its own hop length progression. Behavior is unchanged for single-request
usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant