[Bugfix] Fix padding bug in 12Hz tokenizer ConvTranspose1d decode (#1241)

Signed-off-by: linyueqian <linyueqian@outlook.com>
This commit is contained in:
Yueqian Lin authored and GitHub committed 2026-02-08 00:35:49 +08:00
1 parent a43dbdc064
commit 53a44c56fe
1 file changed
+4 -3
@@ -197,12 +197,13 @@ class Qwen3TTSTokenizerV2CausalTransConvNet(nn.Module):
self.conv = nn.ConvTranspose1d(in_channels, out_channels, kernel_size, stride=stride)
pad = kernel_size - stride
self.left_pad = math.ceil(pad)
self.right_pad = pad = self.left_pad
self.left_pad = 0
self.right_pad = int(pad)
def forward(self, hidden_state):
hidden_state = self.conv(hidden_state)
hidden_state = hidden_state[..., self.left_pad : hidden_state.shape[-1] - self.right_pad]
if self.right_pad > 0:
hidden_state = hidden_state[..., : hidden_state.shape[-1] - self.right_pad]
return hidden_state.contiguous()