favor existing arguments from parameters (kwargs) over global (args)

This commit is contained in:
ben_mkiv 2023-08-22 23:09:42 +02:00
parent 5d73d9e71c
commit 89102347a9

View File

@ -1015,7 +1015,7 @@ def generate_tortoise(**kwargs):
'cond_free_k': float(parameters['cond_free_k']), 'cond_free_k': float(parameters['cond_free_k']),
'num_autoregressive_samples': parameters['num_autoregressive_samples'], 'num_autoregressive_samples': parameters['num_autoregressive_samples'],
'sample_batch_size': args.sample_batch_size, 'sample_batch_size': parameters['sample_batch_size'] if parameters.get('sample_batch_size') else args.sample_batch_size,
'diffusion_iterations': parameters['diffusion_iterations'], 'diffusion_iterations': parameters['diffusion_iterations'],
'voice_samples': None, 'voice_samples': None,
@ -1030,9 +1030,9 @@ def generate_tortoise(**kwargs):
'cond_free': "Conditioning-Free" in parameters['experimentals'], 'cond_free': "Conditioning-Free" in parameters['experimentals'],
'cvvp_amount': parameters['cvvp_weight'], 'cvvp_amount': parameters['cvvp_weight'],
'autoregressive_model': args.autoregressive_model, 'autoregressive_model': parameters['autoregressive_model'] if parameters.get('autoregressive_model') else args.autoregressive_model,
'diffusion_model': args.diffusion_model, 'diffusion_model': parameters['diffusion_model'] if parameters.get('diffusion_model') else args.diffusion_model,
'tokenizer_json': args.tokenizer_json, 'tokenizer_json': parameters['tokenizer_json'] if parameters.get('tokenizer_json') else args.tokenizer_json,
} }
# could be better to just do a ternary on everything above, but i am not a professional # could be better to just do a ternary on everything above, but i am not a professional
@ -1046,6 +1046,7 @@ def generate_tortoise(**kwargs):
continue continue
settings[k] = override[k] settings[k] = override[k]
if settings['autoregressive_model'] is not None: if settings['autoregressive_model'] is not None:
if settings['autoregressive_model'] == "auto": if settings['autoregressive_model'] == "auto":
settings['autoregressive_model'] = deduce_autoregressive_model(selected_voice) settings['autoregressive_model'] = deduce_autoregressive_model(selected_voice)