[Bugfix] Fix padding bug in 12Hz tokenizer ConvTranspose1d decode#1241
Open
linyueqian wants to merge 1 commit intovllm-project:mainfrom
Open
[Bugfix] Fix padding bug in 12Hz tokenizer ConvTranspose1d decode#1241linyueqian wants to merge 1 commit intovllm-project:mainfrom
linyueqian wants to merge 1 commit intovllm-project:mainfrom
Conversation
Signed-off-by: linyueqian <linyueqian@outlook.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes two critical bugs in the Qwen3-TTS 12Hz tokenizer's ConvTranspose1d decoder (Qwen3TTSTokenizerV2CausalTransConvNet), syncing with an upstream fix from the official QwenLM/Qwen3-TTS repository.
Changes:
- Fixed chained assignment bug that incorrectly set
left_padandright_padto the same value - Fixed slicing bug that trimmed from both sides and caused empty tensor returns when
right_pad == 0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Purpose
Fix padding bugs in the 12Hz speech tokenizer decoder (
Qwen3TTSTokenizerV2CausalTransConvNet), syncing with the upstream fix from QwenLM/Qwen3-TTS@5f8581d.Two bugs in
__init__andforward:self.right_pad = pad = self.left_padis a chained assignment that sets bothpadandself.right_padtoself.left_pad, making them always equal. The intended behavior isleft_pad = 0andright_pad = kernel_size - stride.forwardtrimmed from both left and right unconditionally. Additionally, ifright_padis 0,hidden_state[..., :-0]returns an empty tensor (Python gotcha:x[:-0]==x[:0]). The fix only trims from the right and guards againstright_pad == 0.Test Plan
Test Result
Offline inference with
Qwen3-TTS-12Hz-1.7B-CustomVoicecompleted successfully, producing valid audio output (shape=(247680,), sr=24000, ~10.3s).output_0_94945aa2-880b-4966-8a44-a52f3147e11d.wav
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.