Fix setting pre_layer from within the ui

This commit is contained in:
oobabooga 2023-05-17 23:17:44 -03:00
parent b667ffa51d
commit f052ab9c8f

View File

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