Skip to content

Commit

Permalink
Fix crash when running multiple rolls with speaker mix
Browse files Browse the repository at this point in the history
  • Loading branch information
yqzhishen committed Jan 24, 2023
1 parent 63675e8 commit 12da2af
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@

spk_mix = parse_commandline_spk_mix(args.spk) if hparams['use_spk_id'] and args.spk is not None else None

for param in params:
if spk_mix is not None:
param['spk_mix'] = spk_mix
elif 'spk_mix' in param:
param_spk_mix = param['spk_mix']
for spk_name in param_spk_mix:
values = str(param_spk_mix[spk_name]).split()
if len(values) == 1:
param_spk_mix[spk_name] = float(values[0])
else:
param_spk_mix[spk_name] = [float(v) for v in values]

if not hparams.get('use_midi', False):
merge_slurs(param)


def infer_once(path: str, save_mel=False):
if save_mel:
Expand Down Expand Up @@ -148,19 +163,6 @@ def infer_once(path: str, save_mel=False):
torch.manual_seed(torch.seed() & 0xffff_ffff)
torch.cuda.manual_seed_all(torch.seed() & 0xffff_ffff)

if spk_mix is not None:
param['spk_mix'] = spk_mix
elif 'spk_mix' in param:
param_spk_mix = param['spk_mix']
for spk_name in param_spk_mix:
values = str(param_spk_mix[spk_name]).split()
if len(values) == 1:
param_spk_mix[spk_name] = float(values[0])
else:
param_spk_mix[spk_name] = [float(v) for v in values]

if not hparams.get('use_midi', False):
merge_slurs(param)
if save_mel:
mel, f0 = infer_ins.infer_once(param, return_mel=True)
result.append({
Expand Down

0 comments on commit 12da2af

Please sign in to comment.