Skip to content

Commit

Permalink
Merge pull request #252 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 Jan 28, 2024
2 parents 546324b + 34d60b7 commit 5f0111f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions rvc/configs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,16 @@ def device_config(self) -> tuple:

return x_pad, x_query, x_center, x_max


def max_vram_gpu(gpu):
if torch.cuda.is_available():
gpu_properties = torch.cuda.get_device_properties(gpu)
total_memory_gb = round(gpu_properties.total_memory / 1024 / 1024 / 1024)
return total_memory_gb
else:
return "0"



def get_gpu_info():
ngpu = torch.cuda.device_count()
gpu_infos = []
Expand All @@ -159,7 +161,5 @@ def get_gpu_info():
if len(gpu_infos) > 0:
gpu_info = "\n".join(gpu_infos)
else:
gpu_info = (
"Unfortunately, there is no compatible GPU available to support your training."
)
return gpu_info
gpu_info = "Unfortunately, there is no compatible GPU available to support your training."
return gpu_info
8 changes: 5 additions & 3 deletions rvc/train/extract/extract_f0_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ def mncrepe(self, method, x, p_len, hop_length):
torch_device = (
torch.device(f"cuda:{torch_device_index % torch.cuda.device_count()}")
if torch.cuda.is_available()
else torch.device("mps")
if torch.backends.mps.is_available()
else torch.device("cpu")
else (
torch.device("mps")
if torch.backends.mps.is_available()
else torch.device("cpu")
)
)

audio = torch.from_numpy(x.astype(np.float32)).to(torch_device, copy=True)
Expand Down
1 change: 1 addition & 0 deletions rvc/train/losses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import torch


def feature_loss(fmap_r, fmap_g):
loss = 0
for dr, dg in zip(fmap_r, fmap_g):
Expand Down
3 changes: 2 additions & 1 deletion rvc/train/process/change_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import torch


def change_info(path, info, name):
try:
ckpt = torch.load(path, map_location="cpu")
Expand All @@ -10,4 +11,4 @@ def change_info(path, info, name):
torch.save(ckpt, f"logs/{name}/{name}")
return "Success."
except Exception as error:
print(error)
print(error)

0 comments on commit 5f0111f

Please sign in to comment.