2noise / ChatTTS

A generative speech model for daily dialogue.
https://2noise.com
Other
26.57k stars 2.89k forks source link

refactor: remove unnecessary transpositions #488

Closed charSLee013 closed 2 days ago

charSLee013 commented 3 days ago

Content:

This PR addresses the issue of redundant transposition operations:

  1. The original DVAE forward method included a transpose operation:

    dec_out = self.out_conv(
       self.decoder(
           input=vq_feats.transpose_(1, 2), <- here
       ).transpose_(1, 2),   <- and here
    )
  2. This transpose was then repeated in the DVAEDecoder forward method:

def forward(self, input: torch.Tensor, conditioning=None) -> torch.Tensor:
    # B, T, C
    x = input.transpose_(1, 2) <- again
    ...
    return x.transpose_(1, 2) <-  also extraneous transpose