Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix CosyVoice missing output #2320

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions xinference/model/audio/cosyvoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def _generator_stream():
last_pos = new_last_pos

def _generator_block():
chunk = next(output)
assert isinstance(chunk, dict), "Expected data to be of type dict"
chunks = [o["tts_speech"] for o in output]
t = torch.cat(chunks, dim=1)
with BytesIO() as out:
torchaudio.save(out, chunk["tts_speech"], 22050, format=response_format)
torchaudio.save(out, t, 22050, format=response_format)
return out.getvalue()

return _generator_stream() if stream else _generator_block()
Expand Down
Loading