Handle empty sampler priority field, use default values

This commit is contained in:
oobabooga 2024-02-06 07:05:32 -08:00
parent 775902c1f2
commit 494cc3c5b0

View File

@ -290,9 +290,9 @@ def generate_reply_HF(question, original_question, seed, state, stopping_strings
if k in state: if k in state:
generate_params[k] = state[k] generate_params[k] = state[k]
if isinstance(state['sampler_priority'], list): if isinstance(state['sampler_priority'], list) and len(state['sampler_priority']) > 0:
generate_params['sampler_priority'] = state['sampler_priority'] generate_params['sampler_priority'] = state['sampler_priority']
elif isinstance(state['sampler_priority'], str): elif isinstance(state['sampler_priority'], str) and state['sampler_priority'].strip() != '':
generate_params['sampler_priority'] = [x.strip() for x in state['sampler_priority'].replace('\n', ',').split(',') if x.strip()] generate_params['sampler_priority'] = [x.strip() for x in state['sampler_priority'].replace('\n', ',').split(',') if x.strip()]
if state['negative_prompt'] != '': if state['negative_prompt'] != '':