From 372ef5e2d87d8c21ff565f9014459cb9b2368426 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:42:31 -0800 Subject: [PATCH] Fix dynatemp parameters always visible --- modules/loaders.py | 18 +++++++++++++----- modules/ui_parameters.py | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/loaders.py b/modules/loaders.py index 4b30dbf9..9423b231 100644 --- a/modules/loaders.py +++ b/modules/loaders.py @@ -356,12 +356,20 @@ def list_all_samplers(): return sorted(all_samplers) -def blacklist_samplers(loader): +def blacklist_samplers(loader, dynamic_temperature): all_samplers = list_all_samplers() - if loader == 'All': - return [gr.update(visible=True) for sampler in all_samplers] - else: - return [gr.update(visible=True) if sampler in loaders_samplers[loader] else gr.update(visible=False) for sampler in all_samplers] + output = [] + + for sampler in all_samplers: + if loader == 'All' or sampler in loaders_samplers[loader]: + if sampler.startswith('dynatemp'): + output.append(gr.update(visible=dynamic_temperature)) + else: + output.append(gr.update(visible=True)) + else: + output.append(gr.update(visible=False)) + + return output def get_model_types(loader): diff --git a/modules/ui_parameters.py b/modules/ui_parameters.py index 11af715f..07108553 100644 --- a/modules/ui_parameters.py +++ b/modules/ui_parameters.py @@ -95,7 +95,7 @@ def create_ui(default_preset): def create_event_handlers(): - shared.gradio['filter_by_loader'].change(loaders.blacklist_samplers, gradio('filter_by_loader'), gradio(loaders.list_all_samplers()), show_progress=False) + shared.gradio['filter_by_loader'].change(loaders.blacklist_samplers, gradio('filter_by_loader', 'dynamic_temperature'), gradio(loaders.list_all_samplers()), show_progress=False) shared.gradio['preset_menu'].change(presets.load_preset_for_ui, gradio('preset_menu', 'interface_state'), gradio('interface_state') + gradio(presets.presets_params())) shared.gradio['random_preset'].click(presets.random_preset, gradio('interface_state'), gradio('interface_state') + gradio(presets.presets_params())) shared.gradio['grammar_file'].change(load_grammar, gradio('grammar_file'), gradio('grammar_string'))