[Bug][Qwen3TTS][Streaming] remove dynamic initial chunk and only compute on initial request (#1930)
Signed-off-by: JuanPZuluaga <juanz9312@gmail.com>
This commit is contained in:
1 parent
4036cd547c
commit
cf328eb8e8
2 files changed
+18
-15
No files matched your search
@@ -238,6 +238,9 @@ class OmniChunkTransferAdapter(OmniTransferAdapterBase):
|
|||||||
|
|
||||||
if is_finished:
|
if is_finished:
|
||||||
self.code_prompt_token_ids.pop(request_id, None)
|
self.code_prompt_token_ids.pop(request_id, None)
|
||||||
|
cached_ic = getattr(self, "_cached_ic", None)
|
||||||
|
if cached_ic is not None:
|
||||||
|
cached_ic.pop(request_id, None)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Cleanup
|
# Cleanup
|
||||||
@@ -273,6 +276,10 @@ class OmniChunkTransferAdapter(OmniTransferAdapterBase):
|
|||||||
self.request_payload.pop(external_req_id, None)
|
self.request_payload.pop(external_req_id, None)
|
||||||
self.code_prompt_token_ids.pop(external_req_id, None)
|
self.code_prompt_token_ids.pop(external_req_id, None)
|
||||||
|
|
||||||
|
cached_ic = getattr(self, "_cached_ic", None)
|
||||||
|
if cached_ic is not None:
|
||||||
|
cached_ic.pop(external_req_id, None)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Schedule Helper
|
# Schedule Helper
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|||||||
@@ -115,22 +115,18 @@ def talker2code2wav_async_chunk(
|
|||||||
initial_chunk_size = int(entry.list_data[0])
|
initial_chunk_size = int(entry.list_data[0])
|
||||||
per_request_override = True
|
per_request_override = True
|
||||||
|
|
||||||
# Dynamic IC: always derived from chunk_size, recomputed every call to adapt to load.
|
# Dynamic IC: cache per request so boundaries stay stable for its lifetime.
|
||||||
if not per_request_override:
|
if not per_request_override:
|
||||||
max_ic = max_ic_for_chunk_size(chunk_size)
|
_ic_cache = getattr(transfer_manager, "_cached_ic", None)
|
||||||
active = sum(1 for v in transfer_manager.code_prompt_token_ids.values() if len(v) > 0)
|
if _ic_cache is None:
|
||||||
capacity = getattr(transfer_manager, "scheduler_max_num_seqs", 1)
|
_ic_cache = {}
|
||||||
initial_chunk_size = compute_dynamic_initial_chunk_size(active, capacity, max_ic)
|
transfer_manager._cached_ic = _ic_cache
|
||||||
logger.debug(
|
if request_id not in _ic_cache:
|
||||||
"Dynamic IC: active=%d, capacity=%d, max_ic=%d, ic=%d, cs=%d, req=%s, keys=%d",
|
max_ic = max_ic_for_chunk_size(chunk_size)
|
||||||
active,
|
active = sum(1 for v in transfer_manager.code_prompt_token_ids.values() if len(v) > 0)
|
||||||
capacity,
|
capacity = getattr(transfer_manager, "scheduler_max_num_seqs", 1)
|
||||||
max_ic,
|
_ic_cache[request_id] = compute_dynamic_initial_chunk_size(active, capacity, max_ic)
|
||||||
initial_chunk_size,
|
initial_chunk_size = _ic_cache[request_id]
|
||||||
chunk_size,
|
|
||||||
request_id,
|
|
||||||
len(transfer_manager.code_prompt_token_ids),
|
|
||||||
)
|
|
||||||
|
|
||||||
if chunk_size <= 0 or left_context_size_config < 0 or initial_chunk_size < 0:
|
if chunk_size <= 0 or left_context_size_config < 0 or initial_chunk_size < 0:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
Reference in new issue
Block a user