diff --git a/app.py b/app.py index e1330952..696ac795 100644 --- a/app.py +++ b/app.py @@ -32,8 +32,7 @@ from core import run_prerequisites_script run_prerequisites_script( - pretraineds_v2_f0=True, - pretraineds_v2_nof0=False, + pretraineds_hifigan=True, models=True, exe=True, ) diff --git a/core.py b/core.py index 5f92460a..ee2e6bee 100644 --- a/core.py +++ b/core.py @@ -602,14 +602,12 @@ def run_download_script(model_link: str): # Prerequisites def run_prerequisites_script( - pretraineds_v2_f0: bool, - pretraineds_v2_nof0: bool, + pretraineds_hifigan: bool, models: bool, exe: bool, ): prequisites_download_pipeline( - pretraineds_v2_f0, - pretraineds_v2_nof0, + pretraineds_hifigan, models, exe, ) @@ -2152,19 +2150,12 @@ def parse_arguments(): "prerequisites", help="Install prerequisites for RVC." ) prerequisites_parser.add_argument( - "--pretraineds_v2_f0", + "--pretraineds_hifigan", type=lambda x: bool(strtobool(x)), choices=[True, False], default=True, help="Download pretrained models for RVC v2.", ) - prerequisites_parser.add_argument( - "--pretraineds_v2_nof0", - type=lambda x: bool(strtobool(x)), - choices=[True, False], - default=False, - help="Download non f0 pretrained models for RVC v2.", - ) prerequisites_parser.add_argument( "--models", type=lambda x: bool(strtobool(x)), @@ -2423,8 +2414,7 @@ def main(): ) elif args.mode == "prerequisites": run_prerequisites_script( - pretraineds_v2_f0=args.pretraineds_v2_f0, - pretraineds_v2_nof0=args.pretraineds_v2_nof0, + pretraineds_hifigan=args.pretraineds_hifigan, models=args.models, exe=args.exe, ) diff --git a/rvc/infer/pipeline.py b/rvc/infer/pipeline.py index 2ff06ea8..6352a9a4 100644 --- a/rvc/infer/pipeline.py +++ b/rvc/infer/pipeline.py @@ -687,15 +687,6 @@ def pipeline( audio_opt = AudioProcessor.change_rms( audio, self.sample_rate, audio_opt, self.sample_rate, volume_envelope ) - # if resample_sr >= self.sample_rate and tgt_sr != resample_sr: - # audio_opt = librosa.resample( - # audio_opt, orig_sr=tgt_sr, target_sr=resample_sr - # ) - # audio_max = np.abs(audio_opt).max() / 0.99 - # max_int16 = 32768 - # if audio_max > 1: - # max_int16 /= audio_max - # audio_opt = (audio_opt * 32768).astype(np.int16) audio_max = np.abs(audio_opt).max() / 0.99 if audio_max > 1: audio_opt /= audio_max diff --git a/rvc/lib/tools/model_download.py b/rvc/lib/tools/model_download.py index a3428f5e..f795a201 100644 --- a/rvc/lib/tools/model_download.py +++ b/rvc/lib/tools/model_download.py @@ -15,14 +15,7 @@ from rvc.lib.tools import gdown -def find_folder_parent(search_dir, folder_name): - for dirpath, dirnames, _ in os.walk(search_dir): - if folder_name in dirnames: - return os.path.abspath(dirpath) - return None - - -file_path = find_folder_parent(now_dir, "logs") +file_path = os.path.join(now_dir, "logs") zips_path = os.path.join(file_path, "zips") os.makedirs(zips_path, exist_ok=True) diff --git a/rvc/lib/tools/prerequisites_download.py b/rvc/lib/tools/prerequisites_download.py index cafa261b..fce71427 100644 --- a/rvc/lib/tools/prerequisites_download.py +++ b/rvc/lib/tools/prerequisites_download.py @@ -9,12 +9,6 @@ ( "pretrained_v2/", [ - "D32k.pth", - "D40k.pth", - "D48k.pth", - "G32k.pth", - "G40k.pth", - "G48k.pth", "f0D32k.pth", "f0D40k.pth", "f0D48k.pth", @@ -106,14 +100,11 @@ def split_pretraineds(pretrained_list): return f0_list, non_f0_list -pretraineds_v2_f0_list, pretraineds_v2_nof0_list = split_pretraineds( - pretraineds_hifigan_list -) +pretraineds_hifigan_list, _ = split_pretraineds(pretraineds_hifigan_list) def calculate_total_size( - pretraineds_v2_f0, - pretraineds_v2_nof0, + pretraineds_hifigan, models, exe, ): @@ -126,14 +117,12 @@ def calculate_total_size( total_size += get_file_size_if_missing(embedders_list) if exe and os.name == "nt": total_size += get_file_size_if_missing(executables_list) - total_size += get_file_size_if_missing(pretraineds_v2_f0) - total_size += get_file_size_if_missing(pretraineds_v2_nof0) + total_size += get_file_size_if_missing(pretraineds_hifigan) return total_size def prequisites_download_pipeline( - pretraineds_v2_f0, - pretraineds_v2_nof0, + pretraineds_hifigan, models, exe, ): @@ -141,8 +130,7 @@ def prequisites_download_pipeline( Manage the download pipeline for different categories of files. """ total_size = calculate_total_size( - pretraineds_v2_f0_list if pretraineds_v2_f0 else [], - pretraineds_v2_nof0_list if pretraineds_v2_nof0 else [], + pretraineds_hifigan_list if pretraineds_hifigan else [], models, exe, ) @@ -159,9 +147,7 @@ def prequisites_download_pipeline( download_mapping_files(executables_list, global_bar) else: print("No executables needed") - if pretraineds_v2_f0: - download_mapping_files(pretraineds_v2_f0_list, global_bar) - if pretraineds_v2_nof0: - download_mapping_files(pretraineds_v2_nof0_list, global_bar) + if pretraineds_hifigan: + download_mapping_files(pretraineds_hifigan_list, global_bar) else: pass diff --git a/rvc/lib/tools/pretrained_selector.py b/rvc/lib/tools/pretrained_selector.py index d4062a24..94d67e96 100644 --- a/rvc/lib/tools/pretrained_selector.py +++ b/rvc/lib/tools/pretrained_selector.py @@ -1,12 +1,11 @@ import os -def pretrained_selector(vocoder, pitch_guidance, sample_rate): +def pretrained_selector(vocoder, sample_rate): base_path = os.path.join("rvc", "models", "pretraineds", f"{vocoder.lower()}") - f0 = "f0" if pitch_guidance else "" - path_g = os.path.join(base_path, f"{f0}G{str(sample_rate)[:2]}k.pth") - path_d = os.path.join(base_path, f"{f0}D{str(sample_rate)[:2]}k.pth") + path_g = os.path.join(base_path, f"f0G{str(sample_rate)[:2]}k.pth") + path_d = os.path.join(base_path, f"f0D{str(sample_rate)[:2]}k.pth") if os.path.exists(path_g) and os.path.exists(path_d): return path_g, path_d diff --git a/rvc/train/process/extract_model.py b/rvc/train/process/extract_model.py index 14d97d22..09bef31d 100644 --- a/rvc/train/process/extract_model.py +++ b/rvc/train/process/extract_model.py @@ -27,7 +27,6 @@ def replace_keys_in_dict(d, old_key_part, new_key_part): def extract_model( ckpt, sr, - pitch_guidance, name, model_path, epoch, @@ -35,6 +34,7 @@ def extract_model( hps, overtrain_info, vocoder, + pitch_guidance=True, version="v2", ): try: diff --git a/rvc/train/train.py b/rvc/train/train.py index 72917d2a..6b78f4d4 100644 --- a/rvc/train/train.py +++ b/rvc/train/train.py @@ -999,7 +999,6 @@ def train_and_evaluate( extract_model( ckpt=ckpt, sr=sample_rate, - pitch_guidance=True, name=model_name, model_path=m, epoch=epoch, diff --git a/tabs/train/train.py b/tabs/train/train.py index 87bd03dd..b561965c 100644 --- a/tabs/train/train.py +++ b/tabs/train/train.py @@ -876,8 +876,7 @@ def download_prerequisites(): "Checking for prerequisites with pitch guidance... Missing files will be downloaded. If you already have them, this step will be skipped." ) run_prerequisites_script( - pretraineds_v2_f0=True, - pretraineds_v2_nof0=False, + pretraineds_hifigan=True, models=False, exe=False, )