chat.infer 并行生成异常 #907
Labels
documentation
Improvements or additions to documentation
enhancement
New feature or request
help wanted
Extra attention is needed
问题:
更新到最新版本后,当textx是个list时chat.infer(texts)的并行推理似乎有问题:运行以下代码时,只会生成一条音频,内容是两句话拼起来,显存也是生成一条音频的水平。
以前textx是个list时会生成多条语音,显存占用也是跟texts长度成正比的
代码:
import ChatTTS
import torch
import torchaudio
chat = ChatTTS.Chat()
chat.load(compile=False) # Set to True for better performance
texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"]
wavs = chat.infer(texts)
for i in range(len(wavs)):
"""
In some versions of torchaudio, the first line works but in other versions, so does the second line.
"""
try:
torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000)
except:
torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000)
The text was updated successfully, but these errors were encountered: