Skip to content

Commit

Permalink
optimize: mps audio quality by contiguous scores
Browse files Browse the repository at this point in the history
Ensuring logits scores are contiguous resolved the bug on MPS

2noise/ChatTTS#373
  • Loading branch information
zhzLuke96 committed Jun 20, 2024
1 parent 4adc29e commit 1e4d79f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/ChatTTS/ChatTTS/utils/infer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __call__(
freq = F.one_hot(input_ids, scores.size(1)).sum(1)
freq[self.max_input_ids :] = 0
alpha = self.penalty**freq
scores = scores.contiguous()
scores = torch.where(scores < 0, scores * alpha, scores / alpha)

return scores
Expand Down

0 comments on commit 1e4d79f

Please sign in to comment.