fix: padding bugs in 12Hz tokenizer decode.

This commit is contained in:
Xiong Wang
2026-02-05 14:32:14 +08:00
parent 680d4e9d0e
commit 5f8581d05e
2 changed files with 5 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "qwen-tts"
version = "0.0.6"
version = "0.1.0"
description = "Qwen-TTS python package"
readme = "README.md"
requires-python = ">=3.9"

View File

@@ -198,12 +198,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()