[babysor/MockingBird]预处理ppg模型时出错

2024-07-16 93 views
4

Globbed 891 wav files. Loaded encoder "pretrained_bak_5805000.pt" trained to step 5805001 Preprocessing: 0%| | 0/891 [00:00<?, ?wav/s]multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "Z:\deeplearing_project\MockingBird-main\ppg2mel\preprocess.py", line 72, in preprocess_one wav = resampy.resample(wav, sr, SAMPLE_RATE) File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\site-packages\resampy\core.py", line 97, in resample raise ValueError('Input signal length={} is too small to ' ValueError: Input signal length=2 is too small to resample from 44100->16000 """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "Z:\deeplearing_project\MockingBird-main\pre4ppg.py", line 49, in preprocess_dataset(**vars(args)) File "Z:\deeplearing_project\MockingBird-main\ppg2mel\preprocess.py", line 96, in preprocess_dataset list(tqdm(job, "Preprocessing", len(wav_file_list), unit="wav")) File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\site-packages\tqdm_tqdm.py", line 1017, in iter for obj in iterable: File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 870, in next raise value ValueError: Input signal length=2 is too small to resample from 44100->16000

看起来好像是采样率的原因 但我又从格式工厂看了 是44100的采样率,必须要转换成16000才能训练吗?但是好像转换不了16000的 14afc659eace1962d17ca4289f5a159

回答

2

22050试试

3

顶 一样的问题

7

Globbed 891 wav files. Loaded encoder "pretrained_bak_5805000.pt" trained to step 5805001 Preprocessing: 0%| | 0/891 [00:00<?, ?wav/s]multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "Z:\deeplearing_project\MockingBird-main\ppg2mel\preprocess.py", line 77, in preprocessone , length_f0 = _compute_f0_from_wav(output_fpath=f"{out_dir}/f0/{utt_id}.f0.npy", wav=wav) File "Z:\deeplearing_project\MockingBird-main\ppg2mel\preprocess.py", line 41, in _compute_f0_from_wav f0 = compute_f0(wav, SAMPLE_RATE) File "Z:\deeplearing_project\MockingBird-main\utils\f0_utils.py", line 17, in computef0 f0, = pyworld.harvest( File "pyworld/pyworld.pyx", line 154, in pyworld.pyworld.harvest ValueError: Buffer has wrong number of dimensions (expected 1, got 2) """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "Z:\deeplearing_project\MockingBird-main\pre4ppg.py", line 49, in preprocess_dataset(**vars(args)) File "Z:\deeplearing_project\MockingBird-main\ppg2mel\preprocess.py", line 96, in preprocess_dataset list(tqdm(job, "Preprocessing", len(wav_file_list), unit="wav")) File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\site-packages\tqdm_tqdm.py", line 1017, in iter for obj in iterable: File "C:\Users\CHOPY\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 870, in next raise value ValueError: Buffer has wrong number of dimensions (expected 1, got 2)

转换好了之后是这样的

4

已解决 我通过Audacity将要处理的音频重采样到16000Hz,然后修改了ppg2mel/preprocess.py第68行wav, sr = soundfile.read(str(wav_path))即可正常进行预处理。值得一提的是ppg预处理确实很慢。。吃内存和cpu,内存不够可以通过添加虚拟内存来解决 image

9

image 修改了 ppg2mel/preprocess.py第68行wav, sr = soundfile.read(str(wav_path)) 仍然存在 Buffer has wrong number of dimensions 这个问题呢?

0

感谢 我确实是只转换成了16KHz 没有转成单声道 问题解决了

9

贴一段自动处理的代码

import librosa
import soundfile
import os

root = "aidatatang_200zh/corpus/train/"
output_dir = "rsample"
for file in os.listdir(root):
    file = os.path.join(root, file)
    y, sr = librosa.load(file, sr=48000)
    y_16 = librosa.resample(y, sr, 16000)
    soundfile.write(file, y_16, 16000)