Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.604 seconds.
Prefix dict has been built successfully.
Traceback (most recent call last):
File "tts.py", line 201, in
emotivoice_tts(speaker, text, audio_name + "." + audio_type)
File "tts.py", line 184, in emotivoice_tts
data = tts(speaker, text, prompt, text, speaker, models)
File "tts.py", line 129, in tts
content_embedding = get_style_embedding(content, tokenizer, style_encoder)
File "tts.py", line 116, in get_style_embedding
output = style_encoder(
File "/root/anaconda3/envs/meta_human/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, kwargs)
File "/aidb/code/meta_human/tts/EmotiVoice-main/models/prompt_tts_modified/simbert.py", line 49, in forward
outputs = self.bert(
File "/root/anaconda3/envs/meta_human/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, *kwargs)
File "/root/anaconda3/envs/meta_human/lib/python3.8/site-packages/transformers/models/bert/modeling_bert.py", line 1006, in forward
embedding_output = self.embeddings(
File "/root/anaconda3/envs/meta_human/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(input, kwargs)
File "/root/anaconda3/envs/meta_human/lib/python3.8/site-packages/transformers/models/bert/modeling_bert.py", line 238, in forward
embeddings += position_embeddings
RuntimeError: The size of tensor a (536) must match the size of tensor b (512) at non-singleton dimension 1
python tts.py \
代码是基于demo_page.py做了一点修改: def emotivoice_tts(speaker, text, filename , prompt='开心', lang='zh_us'): text = g2p_cn_en(text, g2p, lexicon) data = tts(speaker, text, prompt, text, speaker, models) sample_rate=config.sampling_rate write('/aidb/code/meta_human/tts/EmotiVoice-main/tts_output/' + filename, sample_rate, data.astype(np.int16))
if name == 'main':
1. get params