From f052ab9c8fed3dedc446c3847f10ab22e42bfb37 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 17 May 2023 23:17:44 -0300 Subject: [PATCH] Fix setting pre_layer from within the ui --- server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 43cd062..c8cb0d3 100644 --- a/server.py +++ b/server.py @@ -229,6 +229,9 @@ def update_model_parameters(state, initial=False): elif element == 'cpu_memory' and value is not None: value = f"{value}MiB" + if element in ['pre_layer']: + value = [value] if value > 0 else None + setattr(shared.args, element, value) found_positive = False @@ -360,7 +363,7 @@ def create_model_menus(): with gr.Column(): shared.gradio['model_type'] = gr.Dropdown(label="model_type", choices=["None", "llama", "opt", "gptj"], value=shared.args.model_type or "None") - shared.gradio['pre_layer'] = gr.Slider(label="pre_layer", minimum=0, maximum=100, value=shared.args.pre_layer) + shared.gradio['pre_layer'] = gr.Slider(label="pre_layer", minimum=0, maximum=100, value=shared.args.pre_layer[0] if shared.args.pre_layer is not None else 0) with gr.Row(): with gr.Column():