Skip to content

Commit

Permalink
Merge pull request #964 from IAHispano/formatter/main
Browse files Browse the repository at this point in the history
chore(format): run black on main
  • Loading branch information
blaisewf authored Feb 1, 2025
2 parents 0fcd2d8 + d2ae08d commit 16019be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion rvc/lib/predictors/FCPE.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,9 @@ def __init__(self, model_path, device=None, dtype=torch.float32):
if device is None:
device = "cuda" if torch.cuda.is_available() else "cpu"
self.device = device
ckpt = torch.load(model_path, map_location=torch.device(self.device), weights_only=True)
ckpt = torch.load(
model_path, map_location=torch.device(self.device), weights_only=True
)
self.args = DotDict(ckpt["config"])
self.dtype = dtype
model = FCPE(
Expand Down
16 changes: 12 additions & 4 deletions rvc/train/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,23 +469,31 @@ def run(
print(f"Loaded pretrained (G) '{pretrainG}'")
if hasattr(net_g, "module"):
net_g.module.load_state_dict(
torch.load(pretrainG, map_location="cpu", weights_only=True)["model"]
torch.load(pretrainG, map_location="cpu", weights_only=True)[
"model"
]
)
else:
net_g.load_state_dict(
torch.load(pretrainG, map_location="cpu", weights_only=True)["model"]
torch.load(pretrainG, map_location="cpu", weights_only=True)[
"model"
]
)

if pretrainD != "" and pretrainD != "None":
if rank == 0:
print(f"Loaded pretrained (D) '{pretrainD}'")
if hasattr(net_d, "module"):
net_d.module.load_state_dict(
torch.load(pretrainD, map_location="cpu", weights_only=True)["model"]
torch.load(pretrainD, map_location="cpu", weights_only=True)[
"model"
]
)
else:
net_d.load_state_dict(
torch.load(pretrainD, map_location="cpu", weights_only=True)["model"]
torch.load(pretrainD, map_location="cpu", weights_only=True)[
"model"
]
)

# Initialize schedulers
Expand Down

0 comments on commit 16019be

Please sign in to comment.