Skip to content

Commit

Permalink
improve change info
Browse files Browse the repository at this point in the history
  • Loading branch information
blaisewf committed Dec 3, 2024
1 parent aa92b3e commit 2b87871
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions rvc/train/process/change_info.py
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit 2b87871

Please sign in to comment.