Skip to content

Commit

Permalink
fix: 🐛 Minor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidalnt committed Dec 4, 2024
1 parent e8bed56 commit 345049a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions rvc/lib/algorithm/synthesizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(
n_layers: int,
kernel_size: int,
p_dropout: float,
resblock: str,
resblock_kernel_sizes: list,
resblock_dilation_sizes: list,
upsample_rates: list,
Expand Down
20 changes: 11 additions & 9 deletions tabs/inference/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def change_choices(model):
if model:
speakers = get_speakers_id(model)
else:
speakers = 0
speakers = [0]
names = [
os.path.join(root, file)
for root, _, files in os.walk(model_root_relative, topdown=False)
Expand Down Expand Up @@ -213,15 +213,15 @@ def change_choices(model):
"choices": (
sorted(speakers)
if speakers is not None and isinstance(speakers, (list, tuple))
else []
else [0]
),
"__type__": "update",
},
{
"choices": (
sorted(speakers)
if speakers is not None and isinstance(speakers, (list, tuple))
else []
else [0]
),
"__type__": "update",
},
Expand Down Expand Up @@ -322,16 +322,18 @@ def refresh_embedders_folders():

def get_speakers_id(model):
if model:
model_data = torch.load(os.path.join(now_dir, model), map_location="cpu")
speakers_id = model_data.get("speakers_id")
if speakers_id:
return list(range(speakers_id))
else:
try:
model_data = torch.load(os.path.join(now_dir, model), map_location="cpu")
speakers_id = model_data.get("speakers_id")
if speakers_id:
return list(range(speakers_id))
else:
return [0]
except Exception as e:
return [0]
else:
return [0]


# Inference tab
def inference_tab():
default_weight = names[0] if names else None
Expand Down

0 comments on commit 345049a

Please sign in to comment.