mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-23 00:18:20 +01:00
Reorganize
This commit is contained in:
parent
7d7d122edb
commit
581f739b2f
11
server.py
11
server.py
@ -186,31 +186,28 @@ def download_model_wrapper(repo_id):
|
|||||||
# Update the command-line arguments based on the interface values
|
# Update the command-line arguments based on the interface values
|
||||||
def update_model_parameters(state):
|
def update_model_parameters(state):
|
||||||
elements = ui.list_model_elements() # the names of the parameters
|
elements = ui.list_model_elements() # the names of the parameters
|
||||||
|
|
||||||
gpu_memories = []
|
gpu_memories = []
|
||||||
for i, element in enumerate(elements):
|
for i, element in enumerate(elements):
|
||||||
|
|
||||||
if element not in state:
|
if element not in state:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
value = state[element]
|
value = state[element]
|
||||||
|
|
||||||
if element.startswith('gpu_memory'):
|
if element.startswith('gpu_memory'):
|
||||||
gpu_memories.append(value)
|
gpu_memories.append(value)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if element == 'cpu_memory' and value == 0:
|
|
||||||
value = None
|
|
||||||
if element == 'wbits' and value == 'None':
|
if element == 'wbits' and value == 'None':
|
||||||
value = 0
|
value = 0
|
||||||
if element == 'groupsize' and value == 'None':
|
if element == 'groupsize' and value == 'None':
|
||||||
value = -1
|
value = -1
|
||||||
if element == 'model_type' and value == 'None':
|
|
||||||
value = None
|
|
||||||
if element in ['wbits', 'groupsize', 'pre_layer']:
|
if element in ['wbits', 'groupsize', 'pre_layer']:
|
||||||
value = int(value)
|
value = int(value)
|
||||||
|
if element == 'cpu_memory' and value == 0:
|
||||||
|
value = None
|
||||||
elif element == 'cpu_memory' and value is not None:
|
elif element == 'cpu_memory' and value is not None:
|
||||||
value = f"{value}MiB"
|
value = f"{value}MiB"
|
||||||
|
if element == 'model_type' and value == 'None':
|
||||||
|
value = None
|
||||||
|
|
||||||
exec(f"shared.args.{element} = value")
|
exec(f"shared.args.{element} = value")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user