minor fixes

This commit is contained in:
Vladimir Mandic
2023-08-30 09:45:47 -04:00
parent d45e6a04cd
commit df65df3f36
4 changed files with 19 additions and 8 deletions
+11
View File
@@ -33,6 +33,16 @@ def init_modules():
extensions_dir = modules.paths_internal.extensions_dir
def get_custom_args():
custom = {}
for arg in vars(args):
default = parser.get_default(arg)
current = getattr(args, arg)
if current != default:
custom[arg] = getattr(args, arg)
installer.log.info(f'Command line args: {custom}')
@lru_cache()
def commit_hash(): # compatbility function
global stored_commit_hash # pylint: disable=global-statement
@@ -133,6 +143,7 @@ def start_server(immediate=True, server=None):
server = importlib.util.module_from_spec(module_spec)
installer.log.debug(f'Starting module: {server}')
installer.log.info(f"Server arguments: {sys.argv[1:]}")
get_custom_args()
module_spec.loader.exec_module(server)
if args.test:
installer.log.info("Test only")
+4 -4
View File
@@ -62,7 +62,10 @@ def torch_gc(force=False):
mem = memstats.memory_stats()
gpu = mem.get('gpu', {})
oom = gpu.get('oom', 0)
used = round(100 * gpu.get('used', 0) / gpu.get('total', 1))
if backend == "directml":
used = round(100 * torch.cuda.memory_allocated() / (1 << 30) / gpu.get('total', 1)) if gpu.get('total', 1) > 1 else 0
else:
used = round(100 * gpu.get('used', 0) / gpu.get('total', 1)) if gpu.get('total', 1) > 1 else 0
global previous_oom # pylint: disable=global-statement
if oom > previous_oom:
previous_oom = oom
@@ -70,9 +73,6 @@ def torch_gc(force=False):
if used > 95:
shared.log.info(f'GPU high memory utilization: {used}% {mem}')
force = True
if backend == "directml":
practical_used = round(100 * torch.cuda.memory_allocated() / (1 << 30) / gpu.get('total', 1))
shared.log.info(f'Practical GPU memory utilization: {practical_used}%')
if not force:
return
collected = gc.collect()
+2 -2
View File
@@ -518,9 +518,9 @@ options_templates.update(options_section(('ui', "User Interface"), {
"keyedit_precision_extra": OptionInfo(0.05, "Ctrl+up/down precision when editing <extra networks:0.9>", gr.Slider, {"minimum": 0.01, "maximum": 0.2, "step": 0.001}),
"keyedit_delimiters": OptionInfo(".,\/!?%^*;:{}=`~()", "Ctrl+up/down word delimiters"), # pylint: disable=anomalous-backslash-in-string
"quicksettings_list": OptionInfo(["sd_model_checkpoint"], "Quicksettings list", ui_components.DropdownMulti, lambda: {"choices": list(opts.data_labels.keys())}),
"hidden_tabs": OptionInfo([], "Hidden UI tabs", ui_components.DropdownMulti, lambda: {"choices": list(tab_names)}),
# "hidden_tabs": OptionInfo([], "Hidden UI tabs", ui_components.DropdownMulti, lambda: {"choices": list(tab_names)}),
# "ui_tab_reorder": OptionInfo("From Text, From Image, Process Image", "UI tabs order"),
"ui_scripts_reorder": OptionInfo("Enable Dynamic Thresholding, ControlNet", "UI scripts order"),
"ui_scripts_reorder": OptionInfo("", "UI scripts order"),
}))
options_templates.update(options_section(('live-preview', "Live Previews"), {
+2 -2
View File
@@ -1112,8 +1112,8 @@ def create_ui(startup_timer = None):
for interface, label, ifid in interfaces:
if interface is None:
continue
if label in modules.shared.opts.hidden_tabs or label == '':
continue
# if label in modules.shared.opts.hidden_tabs or label == '':
# continue
with gr.TabItem(label, id=ifid, elem_id=f"tab_{ifid}"):
interface.render()
for interface, _label, ifid in interfaces: