deal with exceptions of link_wav.py

如果遇到已存在的软链接则跳过,如果在dump中找不到这个符号则删除dump_finetune中的文件。
pull/1302/head
Jerryuhoo 3 years ago
parent fcc34e3e95
commit 61b68ed3ef

@ -58,9 +58,15 @@ def main():
mel_path = output_dir / ("raw/" + name) mel_path = output_dir / ("raw/" + name)
gen_mel = np.load(mel_path) gen_mel = np.load(mel_path)
wave_name = utt_id + "_wave.npy" wave_name = utt_id + "_wave.npy"
try:
wav = np.load(old_dump_dir / sub / ("raw/" + wave_name)) wav = np.load(old_dump_dir / sub / ("raw/" + wave_name))
os.symlink(old_dump_dir / sub / ("raw/" + wave_name), os.symlink(old_dump_dir / sub / ("raw/" + wave_name),
output_dir / ("raw/" + wave_name)) output_dir / ("raw/" + wave_name))
except FileNotFoundError:
print("delete " + name + " because it cannot be found in the dump folder")
os.remove(output_dir / "raw" / name)
except FileExistsError:
print("file " + name + " exists, skip.")
num_sample = wav.shape[0] num_sample = wav.shape[0]
num_frames = gen_mel.shape[0] num_frames = gen_mel.shape[0]
wav_path = output_dir / ("raw/" + wave_name) wav_path = output_dir / ("raw/" + wave_name)

Loading…
Cancel
Save