From 79e8dbe45f51135c54ad4d8427a9eca9d9544c3f Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 21 Jul 2024 22:06:49 -0700 Subject: [PATCH] UI: minor optimization --- modules/ui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index b1e4edaf..0b56c20b 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -116,6 +116,7 @@ def list_model_elements(): 'hqq_backend', 'cpp_runner', ] + if is_torch_xpu_available(): for i in range(torch.xpu.device_count()): elements.append(f'gpu_memory_{i}') @@ -214,9 +215,11 @@ def list_interface_input_elements(): def gather_interface_values(*args): + interface_elements = list_interface_input_elements() + output = {} - for i, element in enumerate(list_interface_input_elements()): - output[element] = args[i] + for element, value in zip(interface_elements, args): + output[element] = value if not shared.args.multi_user: shared.persistent_interface_state = output