Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

预处理pre.py报错 #994

Open
gaoyiyao opened this issue Apr 20, 2024 · 3 comments
Open

预处理pre.py报错 #994

gaoyiyao opened this issue Apr 20, 2024 · 3 comments

Comments

@gaoyiyao
Copy link

Traceback (most recent call last):
File "/home_1/gaoyiyao/MockingBird-main/pre.py", line 74, in
preprocess_dataset(**vars(args))
File "/home_1/gaoyiyao/MockingBird-main/models/synthesizer/preprocess.py", line 86, in preprocess_dataset
for speaker_metadata in tqdm(job, dataset, len(speaker_dirs), unit="speakers"):
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/tqdm/std.py", line 1181, in iter
for obj in iterable:
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
FileNotFoundError: [Errno 2] No such file or directory: 'data/SV2TTS/synthesizer/audio/audio-SSB03850064.wav_00.npy'
哪位大佬知道怎么解决

@gaoyiyao
Copy link
Author

pre.py运行报错
Using data from:
data/aishell3/train/wav
aishell3: 0%| | 0/174 [00:00<?, ?speakers/s]/home_1/gaoyiyao/MockingBird-main/models/synthesizer/preprocess_audio.py:88: UserWarning: PySoundFile failed. Trying audioread instead.
wav, _ = librosa.load(wav_fpath, sr= hparams.sample_rate)
/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/librosa/core/audio.py:183: FutureWarning: librosa.core.audio.__audioread_load
Deprecated as of librosa version 0.10.0.
It will be removed in librosa version 1.0.
y, sr_native = __audioread_load(path, offset, duration, dtype)
aishell3: 0%| | 0/174 [01:26<?, ?speakers/s]
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/librosa/core/audio.py", line 175, in load
y, sr_native = __soundfile_load(path, offset, duration, dtype)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/librosa/core/audio.py", line 208, in __soundfile_load
context = sf.SoundFile(path)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/soundfile.py", line 658, in init
self._file = self._open(file, mode_int, closefd)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/soundfile.py", line 1216, in _open
raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening 'data/SV2TTS/synthesizer/audio/audio-SSB03850064.wav_00.npy': System error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home_1/gaoyiyao/MockingBird-main/models/synthesizer/preprocess_audio.py", line 124, in preprocess_general
wav, text = _split_on_silences(wav_fpath, words, hparams)
File "/home_1/gaoyiyao/MockingBird-main/models/synthesizer/preprocess_audio.py", line 88, in _split_on_silences
wav, _ = librosa.load(wav_fpath, sr= hparams.sample_rate)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/librosa/core/audio.py", line 183, in load
y, sr_native = __audioread_load(path, offset, duration, dtype)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/librosa/util/decorators.py", line 59, in __wrapper
return func(*args, **kwargs)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/librosa/core/audio.py", line 239, in __audioread_load
reader = audioread.audio_open(path)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/audioread/init.py", line 127, in audio_open
return BackendClass(path)
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/audioread/rawread.py", line 59, in init
self._fh = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'data/SV2TTS/synthesizer/audio/audio-SSB03850064.wav_00.npy'
"""

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

Traceback (most recent call last):
File "/home_1/gaoyiyao/MockingBird-main/pre.py", line 74, in
preprocess_dataset(**vars(args))
File "/home_1/gaoyiyao/MockingBird-main/models/synthesizer/preprocess.py", line 86, in preprocess_dataset
for speaker_metadata in tqdm(job, dataset, len(speaker_dirs), unit="speakers"):
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/tqdm/std.py", line 1181, in iter
for obj in iterable:
File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
FileNotFoundError: [Errno 2] No such file or directory: 'data/SV2TTS/synthesizer/audio/audio-SSB03850064.wav_00.npy'

@coreeey
Copy link

coreeey commented Apr 25, 2024

Traceback (most recent call last): File "/home_1/gaoyiyao/MockingBird-main/pre.py", line 74, in preprocess_dataset(**vars(args)) File "/home_1/gaoyiyao/MockingBird-main/models/synthesizer/preprocess.py", line 86, in preprocess_dataset for speaker_metadata in tqdm(job, dataset, len(speaker_dirs), unit="speakers"): File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/site-packages/tqdm/std.py", line 1181, in iter for obj in iterable: File "/home_1/gaoyiyao/anaconda3/envs/sound/lib/python3.9/multiprocessing/pool.py", line 870, in next raise value FileNotFoundError: [Errno 2] No such file or directory: 'data/SV2TTS/synthesizer/audio/audio-SSB03850064.wav_00.npy' 哪位大佬知道怎么解决

把preprocess_general函数修改一下试试, 参考这条issue #963

def preprocess_general(speaker_dir, out_dir: Path, skip_existing: bool, hparams, dict_info, no_alignments: bool, encoder_model_fpath: Path):
    metadata = []
    extensions = ("*.wav", "*.flac", "*.mp3")
    for extension in extensions:
        wav_fpath_list = speaker_dir.glob(extension)
        # Iterate over each wav
        for wav_fpath in wav_fpath_list:
            words = dict_info.get(wav_fpath.name.split(".")[0])
            if not words:
                words = dict_info.get(wav_fpath.name) # try with extension 
                if not words:
                    print(f"No word found in dict_info for {wav_fpath.name}, skip it")
                    continue
            sub_basename = "%s_%02d" % (wav_fpath.name, 0)
            # mel_fpath = out_dir.joinpath("mels", f"mel-{sub_basename}.npy")
            # wav_fpath = out_dir.joinpath("audio", f"audio-{sub_basename}.npy")
            mel_fpath_out = out_dir.joinpath("mels", f"mel-{sub_basename}.npy")
            wav_fpath_out = out_dir.joinpath("audio", f"audio-{sub_basename}.npy")
            
            # if skip_existing and mel_fpath.exists() and wav_fpath.exists():
            if skip_existing and mel_fpath_out.exists() and wav_fpath_out.exists():
                continue
            wav, text = _split_on_silences(wav_fpath, words, hparams)
            # result = _process_utterance(wav, text, out_dir, sub_basename,
                                                # False, hparams, encoder_model_fpath) # accelarate
            result = _process_utterance(wav, text, out_dir, sub_basename, mel_fpath_out, wav_fpath_out, hparams, encoder_model_fpath)

            if result is None:
                continue
            wav_fpath_name, mel_fpath_name, embed_fpath_name, wav, mel_frames, text = result
            metadata.append ((wav_fpath_name, mel_fpath_name, embed_fpath_name, len(wav), mel_frames, text))

    return metadata

@gaoyiyao
Copy link
Author

多谢你,已经解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants