diff --git a/infer/lib/rvcmd.py b/infer/lib/rvcmd.py index b49ffd4..439e346 100644 --- a/infer/lib/rvcmd.py +++ b/infer/lib/rvcmd.py @@ -198,44 +198,10 @@ def download_all_assets(tmpdir: str, version="0.2.5"): suffix = "zip" if is_win else "tar.gz" RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}" cmdfile = os.path.join(tmpdir, "rvcmd") - try: - if is_win: - download_and_extract_zip(RVCMD_URL, tmpdir) - cmdfile += ".exe" - else: - download_and_extract_tar_gz(RVCMD_URL, tmpdir) - os.chmod(cmdfile, 0o755) - subprocess.run([cmdfile, "-notui", "-w", "0", "assets/rvc"]) - except Exception: - BASE_URL = "https://raw.gitcode.com/u011570312/RVC-Models-Downloader/assets/" - suffix = { - "darwin_amd64": "555", - "darwin_arm64": "556", - "linux_386": "557", - "linux_amd64": "558", - "linux_arm64": "559", - "windows_386": "562", - "windows_amd64": "563", - }[f"{system_type}_{architecture}"] - RVCMD_URL = BASE_URL + suffix - download_dns_yaml( - "https://raw.gitcode.com/u011570312/RVC-Models-Downloader/raw/main/dns.yaml", - tmpdir, - ) - if is_win: - download_and_extract_zip(RVCMD_URL, tmpdir) - cmdfile += ".exe" - else: - download_and_extract_tar_gz(RVCMD_URL, tmpdir) - os.chmod(cmdfile, 0o755) - subprocess.run( - [ - cmdfile, - "-notui", - "-w", - "0", - "-dns", - os.path.join(tmpdir, "dns.yaml"), - "assets/rvc", - ] - ) + if is_win: + download_and_extract_zip(RVCMD_URL, tmpdir) + cmdfile += ".exe" + else: + download_and_extract_tar_gz(RVCMD_URL, tmpdir) + os.chmod(cmdfile, 0o755) + subprocess.run([cmdfile, "-notui", "-w", "0", "assets/rvc"]) diff --git a/infer/lib/train/data_utils.py b/infer/lib/train/data_utils.py index a5e4a93..da2a923 100644 --- a/infer/lib/train/data_utils.py +++ b/infer/lib/train/data_utils.py @@ -303,7 +303,7 @@ class TextAudioLoader(torch.utils.data.Dataset): spec_filename = filename.replace(".wav", ".spec.pt") if os.path.exists(spec_filename): try: - spec = torch.load(spec_filename) + spec = torch.load(spec_filename, weights_only=True) except: logger.warning("%s %s", spec_filename, traceback.format_exc()) spec = spectrogram_torch( diff --git a/infer/lib/train/process_ckpt.py b/infer/lib/train/process_ckpt.py index cf9697f..8688a17 100644 --- a/infer/lib/train/process_ckpt.py +++ b/infer/lib/train/process_ckpt.py @@ -59,7 +59,7 @@ def save_small_model(ckpt, sr, if_f0, name, epoch, version, hps): def extract_small_model(path, name, author, sr, if_f0, info, version): try: - ckpt = torch.load(path, map_location="cpu") + ckpt = torch.load(path, map_location="cpu", weights_only=True) if "model" in ckpt: ckpt = ckpt["model"] opt = OrderedDict() @@ -196,7 +196,7 @@ def extract_small_model(path, name, author, sr, if_f0, info, version): def change_info(path, info, name): try: - ckpt = torch.load(path, map_location="cpu") + ckpt = torch.load(path, map_location="cpu", weights_only=True) ckpt["info"] = info if name == "": name = os.path.basename(path) @@ -229,8 +229,8 @@ def merge(path1, path2, alpha1, sr, f0, info, name, version): a2 = "Unknown" return f"{a1} & {a2}" - ckpt1 = torch.load(path1, map_location="cpu") - ckpt2 = torch.load(path2, map_location="cpu") + ckpt1 = torch.load(path1, map_location="cpu", weights_only=True) + ckpt2 = torch.load(path2, map_location="cpu", weights_only=True) cfg = ckpt1["config"] if "model" in ckpt1: ckpt1 = extract(ckpt1) diff --git a/infer/modules/uvr5/vr.py b/infer/modules/uvr5/vr.py index 999bc19..6c0bf42 100644 --- a/infer/modules/uvr5/vr.py +++ b/infer/modules/uvr5/vr.py @@ -37,7 +37,7 @@ class AudioPre: else: mp = ModelParameters("infer/lib/uvr5_pack/lib_v5/modelparams/4band_v2.json") model = Nets.CascadedASPPNet(mp.param["bins"] * 2) - cpk = torch.load(model_path, map_location="cpu") + cpk = torch.load(model_path, map_location="cpu", weights_only=True) model.load_state_dict(cpk) model.eval() if is_half: diff --git a/infer/modules/vc/hash.py b/infer/modules/vc/hash.py index 77b6ae1..6a3561b 100644 --- a/infer/modules/vc/hash.py +++ b/infer/modules/vc/hash.py @@ -152,7 +152,7 @@ def model_hash_ckpt(cpt): def model_hash_from(path): - cpt = torch.load(path, map_location="cpu") + cpt = torch.load(path, map_location="cpu", weights_only=True) h = model_hash_ckpt(cpt) del cpt return h diff --git a/infer/modules/vc/info.py b/infer/modules/vc/info.py index 14a7346..c16a8f1 100644 --- a/infer/modules/vc/info.py +++ b/infer/modules/vc/info.py @@ -75,7 +75,7 @@ def show_info(path): try: if hasattr(path, "name"): path = path.name - a = torch.load(path, map_location="cpu") + a = torch.load(path, map_location="cpu", weights_only=True) txt = show_model_info(a, show_long_id=True) del a except: