jpc commited on
Commit
ae73f04
1 Parent(s): e315c05

Fixed stoks padding

Browse files

This fixes the strange vocalizations at the end of many generations

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -80,7 +80,8 @@ def generate_audio(pipe, segments, speaker, speaker_url, cps=14):
80
  else: speaker = pipe.default_speaker
81
  langs, texts = [list(x) for x in zip(*segments)]
82
  print(texts, langs)
83
- stoks = pipe.t2s.generate(texts, cps=cps, lang=langs)[0]
 
84
  atoks = pipe.s2a.generate(stoks, speaker.unsqueeze(0))
85
  audio = pipe.vocoder.decode(atoks)
86
  return audio.cpu()
 
80
  else: speaker = pipe.default_speaker
81
  langs, texts = [list(x) for x in zip(*segments)]
82
  print(texts, langs)
83
+ stoks = pipe.t2s.generate(texts, cps=cps, lang=langs)
84
+ stoks = stoks[stoks!=512]
85
  atoks = pipe.s2a.generate(stoks, speaker.unsqueeze(0))
86
  audio = pipe.vocoder.decode(atoks)
87
  return audio.cpu()