Fix dynatemp parameters always visible

This commit is contained in:
oobabooga 2024-01-08 19:42:31 -08:00
parent 29c2693ea0
commit 372ef5e2d8
2 changed files with 14 additions and 6 deletions

View file

@ -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):

View file

@ -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'))