未验证 提交 c4cf7d8a 编写于 作者: A AK391 提交者: GitHub

Merge branch 'PaddlePaddle:develop' into develop

...@@ -405,8 +405,6 @@ class TTSExecutor(BaseExecutor): ...@@ -405,8 +405,6 @@ class TTSExecutor(BaseExecutor):
with open(self.voc_config) as f: with open(self.voc_config) as f:
self.voc_config = CfgNode(yaml.safe_load(f)) self.voc_config = CfgNode(yaml.safe_load(f))
# Enter the path of model root
with open(self.phones_dict, "r") as f: with open(self.phones_dict, "r") as f:
phn_id = [line.strip().split() for line in f.readlines()] phn_id = [line.strip().split() for line in f.readlines()]
vocab_size = len(phn_id) vocab_size = len(phn_id)
...@@ -501,10 +499,10 @@ class TTSExecutor(BaseExecutor): ...@@ -501,10 +499,10 @@ class TTSExecutor(BaseExecutor):
""" """
Model inference and result stored in self.output. Model inference and result stored in self.output.
""" """
model_name = am[:am.rindex('_')] am_name = am[:am.rindex('_')]
dataset = am[am.rindex('_') + 1:] am_dataset = am[am.rindex('_') + 1:]
get_tone_ids = False get_tone_ids = False
if 'speedyspeech' in model_name: if am_name == 'speedyspeech':
get_tone_ids = True get_tone_ids = True
if lang == 'zh': if lang == 'zh':
input_ids = self.frontend.get_input_ids( input_ids = self.frontend.get_input_ids(
...@@ -521,15 +519,14 @@ class TTSExecutor(BaseExecutor): ...@@ -521,15 +519,14 @@ class TTSExecutor(BaseExecutor):
print("lang should in {'zh', 'en'}!") print("lang should in {'zh', 'en'}!")
# am # am
if 'speedyspeech' in model_name: if am_name == 'speedyspeech':
mel = self.am_inference(phone_ids, tone_ids) mel = self.am_inference(phone_ids, tone_ids)
# fastspeech2 # fastspeech2
else: else:
# multi speaker # multi speaker
if dataset in {"aishell3", "vctk"}: if am_dataset in {"aishell3", "vctk"}:
mel = self.am_inference( mel = self.am_inference(
phone_ids, spk_id=paddle.to_tensor(spk_id)) phone_ids, spk_id=paddle.to_tensor(spk_id))
else: else:
mel = self.am_inference(phone_ids) mel = self.am_inference(phone_ids)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册