From 581f739b2f1be632b55b51134a12fdfcfd0bbccb Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:38:26 -0300 Subject: [PATCH] Reorganize --- server.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index 582c724..7faf8bc 100644 --- a/server.py +++ b/server.py @@ -186,31 +186,28 @@ def download_model_wrapper(repo_id): # Update the command-line arguments based on the interface values def update_model_parameters(state): elements = ui.list_model_elements() # the names of the parameters - gpu_memories = [] for i, element in enumerate(elements): - if element not in state: continue value = state[element] - if element.startswith('gpu_memory'): gpu_memories.append(value) continue - if element == 'cpu_memory' and value == 0: - value = None if element == 'wbits' and value == 'None': value = 0 if element == 'groupsize' and value == 'None': value = -1 - if element == 'model_type' and value == 'None': - value = None if element in ['wbits', 'groupsize', 'pre_layer']: value = int(value) + if element == 'cpu_memory' and value == 0: + value = None elif element == 'cpu_memory' and value is not None: value = f"{value}MiB" + if element == 'model_type' and value == 'None': + value = None exec(f"shared.args.{element} = value")