具体代码为:
`import paddle
from paddlespeech.cli.tts import TTSExecutor
def tts(text,output):
#paddle.device.set_device('gpu:0')
tts_executor = TTSExecutor()
wav_file = tts_executor(
text=text,
output=output,
am='fastspeech2_mix',
am_config=None,
am_ckpt=None,
am_stat=None,
spk_id=0,
phones_dict=None,
tones_dict=None,
speaker_dict=None,
voc='hifigan_aishell3',
voc_config=None,
voc_ckpt=None,
voc_stat=None,
lang='mix',
device=paddle.get_device())
if name == "main":
text = "你好我的名字是Peter,你好"
path = "test中英文混合.wav"
tts(text, path)`
其他的voc都尝试了,只要是mix就会报这个错误
报错信息为:
Traceback (most recent call last):
File "/home/hsy/test中英.py", line 30, in
tts(text, path)
File "/home/hsy/test中英.py", line 7, in tts
wav_file = tts_executor(
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/cli/utils.py", line 328, in _warpper
return executor_func(self, *args, **kwargs)
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/cli/tts/infer.py", line 710, in call
self.infer(text=text, lang=lang, am=am, spk_id=spk_id)
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 347, in _decorate_function
return func(*args, **kwargs)
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/cli/tts/infer.py", line 493, in infer
mel = self.am_inference(
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, **kwargs)
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 920, in forward
normalized_mel, d_outs, p_outs, e_outs = self.acoustic_model.inference(
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 810, in inference
_, outs, d_outs, p_outs, e_outs, _ = self._forward(
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 618, in _forward
hs = self._integrate_with_spk_embed(hs, spk_emb)
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 840, in _integrate_with_spk_embed
spk_emb = F.normalize(spk_emb).unsqueeze(1).expand(
File "/home/Lyx/Software/anaconda3/envs/langchain/lib/python3.8/site-packages/paddle/nn/functional/norm.py", line 82, in normalize
out = _C_ops.p_norm(x, float(p), axis, epsilon, True, False)
ValueError: (InvalidArgument) Attr(axis) value should be in range [-R, R-1], R is the rank of Input(X). But received axis: 1, R: 1. Current Input(X)'s shape is=[256].
[Hint: Expected axis < x_rank, but received axis:1 >= x_rank:1.] (at ../paddle/phi/infermeta/unary.cc:2763)
请问该怎么办呢?
加入参数am='fastspeech2_mix'就会出现楼主描述的问题,
am=其它-zh的参数就不会出现这个问题,但是识别不了英文
paddlespeech tts --am fastspeech2_canton --voc pwgan_aishell3 --input "各个国家有各个国家嘅国歌" --lang canton --spk_id 10
我用的官方样例,也出现这个报错
tts = TTSExecutor()
tts(text="你好我的名字是Peter,你好", output="output.wav", am='fastspeech2_mix', lang='mix')
遇到同样错误