欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

librosa.util.exceptions.ParameterError: Audio buffer is not finite everywhere问题

程序员文章站 2022-03-09 16:33:19
...
Traceback (most recent call last):
  File "pl_one_lstm_lps_separate.py", line 126, in <module>
    separate(args)
  File "pl_one_lstm_lps_separate.py", line 115, in separate
    write(lstm_est_speech.cuda().data.cpu().detach().numpy(), filename + '_en.wav')
  File "pl_one_lstm_lps_separate.py", line 72, in write
    librosa.output.write_wav(filename, inputs, sr)# norm=True)
  File "<decorator-gen-10>", line 2, in write_wav
  File "/home/limiao/.conda/envs/Pytorch/lib/python3.7/site-packages/librosa/util/decorators.py", line 58, in __wrapper
    return func(*args, **kwargs)
  File "/home/limiao/.conda/envs/Pytorch/lib/python3.7/site-packages/librosa/output.py", line 239, in write_wav
    util.valid_audio(y, mono=False)
  File "/home/limiao/.conda/envs/Pytorch/lib/python3.7/site-packages/librosa/util/utils.py", line 275, in valid_audio
    raise ParameterError('Audio buffer is not finite everywhere')
librosa.util.exceptions.ParameterError: Audio buffer is not finite everywhere

问题出现是因为est_amplitude = torch.sqrt(torch.exp(lstm_out1) - 1.0)这行代码中torch.exp(lstm_out1) - 1.0会出现负数的情况,然后我又需要将est_amplitude结果写入音频,才导致出现这个Bug,所以微调因子还需要再调整!