diff --git a/rvc/train/extract/preparing_files.py b/rvc/train/extract/preparing_files.py index 3956eb0c..f861f0dd 100644 --- a/rvc/train/extract/preparing_files.py +++ b/rvc/train/extract/preparing_files.py @@ -21,47 +21,30 @@ def generate_filelist( feature_dir = os.path.join(model_path, f"{rvc_version}_extracted") f0_dir, f0nsf_dir = None, None - if pitch_guidance: - f0_dir = os.path.join(model_path, "f0") - f0nsf_dir = os.path.join(model_path, "f0_voiced") + f0_dir = os.path.join(model_path, "f0") + f0nsf_dir = os.path.join(model_path, "f0_voiced") gt_wavs_files = set(name.split(".")[0] for name in os.listdir(gt_wavs_dir)) feature_files = set(name.split(".")[0] for name in os.listdir(feature_dir)) - if pitch_guidance: - f0_files = set(name.split(".")[0] for name in os.listdir(f0_dir)) - f0nsf_files = set(name.split(".")[0] for name in os.listdir(f0nsf_dir)) - names = gt_wavs_files & feature_files & f0_files & f0nsf_files - else: - names = gt_wavs_files & feature_files + f0_files = set(name.split(".")[0] for name in os.listdir(f0_dir)) + f0nsf_files = set(name.split(".")[0] for name in os.listdir(f0nsf_dir)) + names = gt_wavs_files & feature_files & f0_files & f0nsf_files options = [] mute_base_path = os.path.join(current_directory, "logs", "mute") for name in names: - if pitch_guidance: - options.append( - f"{gt_wavs_dir}/{name}.wav|{feature_dir}/{name}.npy|{f0_dir}/{name}.wav.npy|{f0nsf_dir}/{name}.wav.npy|0" - ) - else: - options.append(f"{gt_wavs_dir}/{name}.wav|{feature_dir}/{name}.npy|0") + options.append(f"{gt_wavs_dir}/{name}.wav|{feature_dir}/{name}.npy|{f0_dir}/{name}.wav.npy|{f0nsf_dir}/{name}.wav.npy|0") - mute_audio_path = os.path.join( - mute_base_path, "sliced_audios", f"mute{sample_rate}.wav" - ) - mute_feature_path = os.path.join( - mute_base_path, f"{rvc_version}_extracted", "mute.npy" - ) + mute_audio_path = os.path.join(mute_base_path, "sliced_audios", f"mute{sample_rate}.wav") + mute_feature_path = os.path.join(mute_base_path, f"{rvc_version}_extracted", "mute.npy") + mute_f0_path = os.path.join(mute_base_path, "f0", "mute.wav.npy") + mute_f0nsf_path = os.path.join(mute_base_path, "f0_voiced", "mute.wav.npy") - for _ in range(2): - if pitch_guidance: - mute_f0_path = os.path.join(mute_base_path, "f0", "mute.wav.npy") - mute_f0nsf_path = os.path.join(mute_base_path, "f0_voiced", "mute.wav.npy") - options.append( - f"{mute_audio_path}|{mute_feature_path}|{mute_f0_path}|{mute_f0nsf_path}|0" - ) - else: - options.append(f"{mute_audio_path}|{mute_feature_path}|0") + # always adding two files + options.append(f"{mute_audio_path}|{mute_feature_path}|{mute_f0_path}|{mute_f0nsf_path}|0") + options.append(f"{mute_audio_path}|{mute_feature_path}|{mute_f0_path}|{mute_f0nsf_path}|0") shuffle(options) diff --git a/rvc/train/train.py b/rvc/train/train.py index 4f4ce221..99e82fff 100644 --- a/rvc/train/train.py +++ b/rvc/train/train.py @@ -410,7 +410,7 @@ def run( config.data.filter_length // 2 + 1, config.train.segment_size // config.data.hop_length, **config.model, - use_f0=pitch_guidance, + use_f0=pitch_guidance==True, # converting 1/0 to True/False is_half=config.train.fp16_run and device.type == "cuda", sr=sample_rate, ).to(device) @@ -926,7 +926,7 @@ def train_and_evaluate( extract_model( ckpt=ckpt, sr=sample_rate, - pitch_guidance=pitch_guidance, + pitch_guidance=pitch_guidance==True, # converting 1/0 to True/False, name=model_name, model_dir=m, epoch=epoch,