fatchord / WaveRNN

WaveRNN Vocoder + TTS

Home Page:https://fatchord.github.io/model_outputs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'librosa' has no attribute 'output'

ljy-002 opened this issue · comments

"librosa.output" was removed in librosa version 0.8.0. This is documented in their changelog


F:\【密】AI-人工智能\WaveRNN>python quick_start.py
Using device: cpu

Initialising WaveRNN Model...

Trainable Parameters: 4.234M

Initialising Tacotron Model...

Trainable Parameters: 11.088M
F:\【密】AI-人工智能\WaveRNN\models\tacotron.py:308: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than tensor.new_tensor(sourceTensor).
self.decoder.r = self.decoder.r.new_tensor(value, requires_grad=False)
+---------+---------------+-----------------+----------------+-----------------+
| WaveRNN | Tacotron(r=2) | Generation Mode | Target Samples | Overlap Samples |
+---------+---------------+-----------------+----------------+-----------------+
| 797k | 180k | Unbatched | N/A | N/A |
+---------+---------------+-----------------+----------------+-----------------+

| Generating 1/6
| ████████████████ 87400/87450 | Batch Size: 1 | Gen Rate: 0.0kHz | Traceback (most recent call last):
File "F:\【密】AI-人工智能\WaveRNN\quick_start.py", line 120, in
voc_model.generate(m, save_path, batched, 11_000, 550, hp.mu_law)
File "F:\【密】AI-人工智能\WaveRNN\models\fatchord_version.py", line 260, in generate
save_wav(output, save_path)
File "F:\【密】AI-人工智能\WaveRNN\utils\dsp.py", line 23, in save_wav
librosa.output.write_wav(path, x.astype(np.float32), sr=hp.sample_rate)
AttributeError: module 'librosa' has no attribute 'output'

I forgot what I spent an hour doing on the computer


The error changed:
cmd: python quick_start.py -u --input_text "如果我运行这个命令会发生什么?"
error:
Traceback (most recent call last):
File "F:\【密】AI-人工智能\WaveRNN\quick_start.py", line 2, in
from models.fatchord_version import WaveRNN
File "F:\【密】AI-人工智能\WaveRNN\models\fatchord_version.py", line 6, in
from utils.dsp import *
File "F:\【密】AI-人工智能\WaveRNN\utils\dsp.py", line 3, in
import librosa
File "D:\PROG\Python\Python-3.9.10\lib\site-packages\librosa_init_.py", line 12, in
from . import core
File "D:\PROG\Python\Python-3.9.10\lib\site-packages\librosa\core_init_.py", line 109, in
from .time_frequency import * # pylint: disable=wildcard-import
File "D:\PROG\Python\Python-3.9.10\lib\site-packages\librosa\core\time_frequency.py", line 10, in
from ..util.exceptions import ParameterError
File "D:\PROG\Python\Python-3.9.10\lib\site-packages\librosa\util_init_.py", line 71, in
from . import decorators
File "D:\PROG\Python\Python-3.9.10\lib\site-packages\librosa\util\decorators.py", line 9, in
from numba.decorators import jit as optional_jit
ModuleNotFoundError: No module named 'numba.decorators'

Oh, I remembered, I changed the requirements.txt
Changed from numpy==xxx to numpy==1.21.5

哦,我想起来了,我把requirements.txt 从numpy==xxx改成了numpy==1.21.5

Numpy-Issuse

  1. First install suondfile
    pip install soundfile

Update the save_wav function:
2. Now, you need to update the save_wav function in your dsp.py file to use the soundfile.write function instead of the deprecated librosa.output.write_wav function.

3.Open your dsp.py file and locate the save_wav function. Replace its content with the following updated code:
dsp.py <- it's located in utils\dsp.py

import numpy as np
import soundfile as sf  # Import soundfile module

# ... (other functions remain the same) ...

def save_wav(x, path): #22 line
    sf.write(path, x.astype(np.float32), hp.sample_rate, format='wav')

# ... (other functions remain the same) ...