-
Notifications
You must be signed in to change notification settings - Fork 1k
[Bugfix] Fix left_context_size type mismatch in non-async Base Code2Wav path #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,7 +219,14 @@ def forward( | |
| if i >= len(left_context_size): | ||
| break | ||
| if "left_context_size" in info: | ||
| left_context_size[i] = info["left_context_size"] | ||
| val = info["left_context_size"] | ||
| # Non-async path sends a list (required by | ||
| # serialize_additional_information which drops | ||
| # plain ints); async chunk path sends a plain int. | ||
| # Handle both. | ||
| if isinstance(val, list): | ||
| val = val[0] if val else 0 | ||
| left_context_size[i] = int(val) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: the |
||
| for i, req_ids in enumerate(request_ids_list): | ||
| if req_ids.numel() < 1: | ||
| parsed.append((0, 0)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,9 @@ def talker2code2wav( | |
| ref_code_len = 0 | ||
| # Code2Wav expects codebook-major flat: [Q*num_frames] | ||
| codec_codes = audio_codes.transpose(0, 1).cpu().reshape(-1).tolist() | ||
| # Wrap ref_code_len in a list: serialize_additional_information() | ||
| # only preserves tensor and list values; plain ints are dropped. | ||
| # The consumer (Qwen3TTSCode2Wav.forward) unwraps the list. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The real fix should be in |
||
| additional_information = {"left_context_size": [ref_code_len]} if ref_code_len > 0 else None | ||
| code2wav_inputs.append( | ||
| OmniTokensPrompt( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This silently discards extra elements if the list has
len > 1. Not currently possible, but a defensiveassertor warning would save debugging time if the producer changes.Actually, simpler — just index
[0]and let it raiseIndexErroron empty rather than silently returning 0: