diff --git a/rvc/train/process/change_info.py b/rvc/train/process/change_info.py index 6e5f680b3..59f976b66 100644 --- a/rvc/train/process/change_info.py +++ b/rvc/train/process/change_info.py @@ -1,14 +1,22 @@ import os import torch - def change_info(path, info, name): try: ckpt = torch.load(path, map_location="cpu") ckpt["info"] = info - if name == "": - name = os.path.basename(path) - torch.save(ckpt, f"logs/{name}/{name}") + + if not name: + name = os.path.splitext(os.path.basename(path))[0] + + target_dir = os.path.join("logs", name) + os.makedirs(target_dir, exist_ok=True) + + torch.save(ckpt, os.path.join(target_dir, f"{name}.pth")) + return "Success." + except Exception as error: - print(f"An error occurred changing the info: {error}") + print(f"An error occurred while changing the info: {error}") + return f"Error: {error}" +