paddle.signal.istft

eyh26e7m  于 5个月前  发布在  其他
关注(0)|答案(5)|浏览(55)

bug描述 Describe the Bug

我们尝试使用https://github.com/PaddlePaddle/PaddleSpeech/blob/aae9fa7f3cb9f4daefa422fd3613d15a46e43038/paddlespeech/t2s/exps/syn_utils.py#L473 进行声码器的模型转静态图,paddle.signal.istft 报错,但我们在训练和测试过程中从未遇到过这个问题,是否是paddle.signal.istft 在做静态图转换时产生错误

其他补充信息 Additional Supplementary Information

File "/home/aistudio/PaddleSpeech/paddlespeech/t2s/models/hifigan/hifigan.py", line 199, in forward

print("*****************")

print(c.shape)

c = paddle.signal.istft(c , self.gen_istft_n_fft, hop_length=self.gen_istft_hop_size, win_length=self.gen_istft_n_fft)

c = c.unsqueeze(1)
else:

```
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/signal.py", line 561, in istft
   1]).transpose(perm=[1, 0]),  # (n_fft, num_frames)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/manipulation.py", line 3201, in tile
   attrs['repeat_times'] = get_attr_repeat_times(repeat_times)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/manipulation.py", line 3193, in get_attr_repeat_times
   ), "All elements in repeat_times must be positive for tile."

AssertionError: All elements in repeat_times must be positive for tile.
```
jjhzyzn0

jjhzyzn01#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档常见问题历史IssueAI社区 来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

c3frrgcw

c3frrgcw2#

istft函数中,参数shape或size分别设置的多少呢?c , n_fft, hop_length, win_length

x6492ojm

x6492ojm3#

istft函数中,参数shape或size分别设置的多少呢?c , n_fft, hop_length, win_length

在istft函数中,n_fft= 48, hop_length=12,win_length=48, 当输入数据c的shape为[1, 25, 9026],输出数据c的shape为[1, 108300],该数据为在模型测试阶段在forward函数中的打印输出,能够正常执行。

进行声码器的模型转静态图时,打印的c.shape 为[1, 25, var shape_0.tmp_0_slice_0 : LOD_TENSOR.shape(1,).dtype(int32).stop_gradient(False)],n_fft= 48, hop_length=12,win_length=48 ,输出c的c.shape无法打印。

其他补充信息 Additional Supplementary Information

这里是我们采用的声码器动转静代码:

from paddlespeech.t2s.exps.syn_utils import voc_to_static
from paddlespeech.t2s.exps.syn_utils import get_voc_inference
def voc_static(args):
    # Init body.
    print(args)
    print(args.voc_config)
    with open(args.voc_config) as f:
        voc_config = CfgNode(yaml.safe_load(f))

    print("========Args========")
    print(yaml.safe_dump(vars(args)))
    print("========Config========")

    # vocoder
    voc_inference = get_voc_inference(
        voc=args.voc,
        voc_config=voc_config,
        voc_ckpt=args.voc_ckpt,
        voc_stat=args.voc_stat)
    print("voc done!")

    # whether dygraph to static
    print(args.inference_dir)
    if args.inference_dir:
        # vocoder
        voc_inference = voc_to_static(
            voc_inference=voc_inference,
            voc=args.voc,
            inference_dir=args.inference_dir)
def voc_to_static(voc_inference,
                  voc: str='pwgan_csmsc',
                  inference_dir=Optional[os.PathLike]):
    voc_inference = jit.to_static(
        voc_inference, input_spec=[
            InputSpec([-1, 80], dtype=paddle.float32),
        ])

    paddle.jit.save(voc_inference, os.path.join(inference_dir, voc))
    voc_inference = paddle.jit.load(os.path.join(inference_dir, voc))
    return voc_inference

在执行原版hifigan代码(没有采用istft函数)时,正常运行,在inference文件夹下生成hifigan_csmsc.pdiparams,hifigan_csmsc.pdiparams.info,hifigan_csmsc.pdmodel。

但当我们使用了带有istft函数对应的代码和训练后的模型进行静态图转换时,在执行voc_to_static时失败。

332nm8kg

332nm8kg4#

@longRookie "但当我们使用了带有istft函数对应的代码和训练后的模型进行静态图转换时" 我是否可以理解为你在复现 istftNet 然后动转静失败了?如果是 istft 模块动转静有问题,请提供最小可复现代码(仅有 istft 模块的组网代码),否则无法确定是 istft 的问题还是你的写法问题

iswrvxsc

iswrvxsc5#

@longRookie "但当我们使用了带有istft函数对应的代码和训练后的模型进行静态图转换时" 我是否可以理解为你在复现 istftNet 然后动转静失败了?如果是 istft 模块动转静有问题,请提供最小可复现代码(仅有 istft 模块的组网代码),否则无法确定是 istft 的问题还是你的写法问题

可复现代码:
https://github.com/longRookie/PaddleSpeech/blob/27bcd7b2cb9dece65667e8b90fb105f8518cd858/paddlespeech/t2s/models/hifigan/hifigan.py#L192

相关问题