new command line parser

This commit is contained in:
Vladimir Mandic
2023-04-30 10:54:59 -04:00
parent 917ecad43c
commit 682330b172
8 changed files with 118 additions and 110 deletions
+8 -8
View File
@@ -49,7 +49,7 @@ ui_reorder_categories = [
"scripts",
]
cmd_opts.disable_extension_access = (cmd_opts.share or cmd_opts.listen or cmd_opts.server_name) and not cmd_opts.enable_insecure
cmd_opts.disable_extension_access = (cmd_opts.share or cmd_opts.listen or cmd_opts.server_name) and not cmd_opts.insecure
devices.device, devices.device_interrogate, devices.device_gfpgan, devices.device_esrgan, devices.device_codeformer = (devices.cpu if any(y in cmd_opts.use_cpu for y in [x, 'all']) else devices.get_optimal_device() for x in ['sd', 'interrogate', 'gfpgan', 'esrgan', 'codeformer'])
device = devices.device
is_device_dml = False
@@ -59,7 +59,7 @@ clip_model = None
if device.type == 'privateuseone':
import modules.dml
import modules.dml # pylint: disable=ungrouped-imports
is_device_dml = True
@@ -324,9 +324,9 @@ options_templates.update(options_section(('cuda', "CUDA Settings"), {
"cuda_allow_tf32": OptionInfo(True, "Allow TF32 math ops"),
"cuda_allow_tf16_reduced": OptionInfo(True, "Allow TF16 reduced precision math ops"),
"cuda_compile": OptionInfo(False, "Enable model compile (experimental)"),
"cuda_compile_mode": OptionInfo("none", "Model compile mode (experimental)", gr.Radio, lambda: {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser']}),
"cuda_compile_verbose": OptionInfo(True, "Compile verbose mode"),
"cuda_compile_errors": OptionInfo(True, "Compile suppress errors"),
"cuda_compile_mode": OptionInfo("none", "Model compile mode (experimental)", gr.Radio, lambda: {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser', 'hidet']}),
"cuda_compile_verbose": OptionInfo(True, "Model compile verbose mode"),
"cuda_compile_errors": OptionInfo(True, "Model compile suppress errors"),
}))
options_templates.update(options_section(('upscaling', "Upscaling"), {
@@ -468,7 +468,7 @@ class Options:
def __setattr__(self, key, value):
if self.data is not None:
if key in self.data or key in self.data_labels:
if cmd_opts.freeze_settings:
if cmd_opts.freeze:
print(f'Settings are frozen: {key}')
return
if cmd_opts.hide_ui_dir_config and key in restricted_opts:
@@ -514,7 +514,7 @@ class Options:
return data_label.default
def save(self, filename):
assert not cmd_opts.freeze_settings, "saving settings is disabled"
assert not cmd_opts.freeze, "saving settings is disabled"
with open(filename, "w", encoding="utf8") as file:
json.dump(self.data, file, indent=4)
@@ -587,7 +587,7 @@ opts = Options()
batch_cond_uncond = opts.always_batch_cond_uncond or not (cmd_opts.lowvram or cmd_opts.medvram)
parallel_processing_allowed = not cmd_opts.lowvram and not cmd_opts.medvram
xformers_available = False
config_filename = cmd_opts.ui_settings_file
config_filename = cmd_opts.config
os.makedirs(opts.hypernetwork_dir, exist_ok=True)
hypernetworks = {}
loaded_hypernetworks = []