From 494cc3c5b009b9187a6facd449910890d8eb28c9 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 6 Feb 2024 07:05:32 -0800 Subject: [PATCH] Handle empty sampler priority field, use default values --- modules/text_generation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/text_generation.py b/modules/text_generation.py index 1917a0c1..c62b9b01 100644 --- a/modules/text_generation.py +++ b/modules/text_generation.py @@ -290,9 +290,9 @@ def generate_reply_HF(question, original_question, seed, state, stopping_strings if k in state: 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'] - 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()] if state['negative_prompt'] != '':