From d30a55e5239e875c03b90c9f987053b4aac2ed0c Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 5 Jul 2023 11:54:49 -0400 Subject: [PATCH] fix settings again --- DIFFUSERS.md | 10 +++++----- modules/shared.py | 28 ++++++++++++++-------------- modules/ui.py | 8 ++++++-- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/DIFFUSERS.md b/DIFFUSERS.md index bd7699f97..79eeb951e 100644 --- a/DIFFUSERS.md +++ b/DIFFUSERS.md @@ -59,9 +59,8 @@ whats implemented so far? ## Todo - sdxl model -- new schedulers -- settings -> schedulers - no idea if sd21 works out-of-the-box +- hires fix? ## Limitations @@ -143,15 +142,16 @@ will need to handle in the code before we get out of alpha | --- | --- | --- | | original | 7.99 / 7.93 / 8.83 / 9.14 / 9.2 | 6.7 / 7.2 | | original medvram | 6.23 / 7.16 / 8.41 / 9.24 / 9.68 | 8.4 / 6.8 | -| original lowvram | | | +| original lowvram | 1.05 / 1.94 / 3.2 / 4.81 / 6.46 | 8.8 / 5.2 | +| original compile inductor | | | | diffusers | 9 / 7.4 / 8.2 / 8.4 / 7.0 | 4.3 / 9.0 | | diffusers medvram | 7.5 / 6.7 / 7.5 / 7.8 / 7.2 | 6.6 / 8.2 | | diffusers lowvram | 7.0 / 7.0 / 7.4 / 7.7 / 7.8 | 4.3 / 7.2 | | diffusers with safetensors | 8.9 / 7.3 / 8.1 / 8.4 / 7.1 | 5.9 / 9.0 | - +| diffusers compile | | | Notes: -- Performance is measured for batch sizes 1, 2, 4, 8 16 +- Performance is measured for `batch-size` 1, 2, 4, 8 16 - Test environment: - nVidia RTX 3060 GPU - Torch 2.1-nightly with CUDA 12.1 diff --git a/modules/shared.py b/modules/shared.py index 29cb28fe0..e02fadac3 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -495,21 +495,21 @@ if backend == Backend.ORIGINAL: elif backend == Backend.DIFFUSERS: options_templates.update(options_section(('sampler-params', "Sampler Settings"), { # hidden - included for compatibility only - "always_batch_cond_uncond": OptionInfo(False, "Disable conditional batching enabled on low memory systems", { "visible": False}), - "enable_quantization": OptionInfo(True, "Enable samplers quantization for sharper and cleaner results", { "visible": False}), - "eta_ancestral": OptionInfo(1.0, "Noise multiplier for ancestral samplers (eta)", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}, { "visible": False}), - "eta_ddim": OptionInfo(0.0, "Noise multiplier for DDIM (eta)", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}, { "visible": False}), - "ddim_discretize": OptionInfo('uniform', "DDIM discretize img2img", gr.Radio, {"choices": ['uniform', 'quad']}, { "visible": False}), - 's_churn': OptionInfo(0.0, "sigma churn", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}, { "visible": False}), - 's_min_uncond': OptionInfo(0, "sigma negative guidance minimum ", gr.Slider, {"minimum": 0.0, "maximum": 4.0, "step": 0.01}, { "visible": False}), - 's_tmin': OptionInfo(0.0, "sigma tmin", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}, { "visible": False}), - 's_noise': OptionInfo(1.0, "sigma noise", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}, { "visible": False}), + "always_batch_cond_uncond": OptionInfo(False, "Disable conditional batching enabled on low memory systems", gr.Checkbox, { "visible": False}), + "enable_quantization": OptionInfo(True, "Enable samplers quantization for sharper and cleaner results", gr.Checkbox, { "visible": False}), + "eta_ancestral": OptionInfo(1.0, "Noise multiplier for ancestral samplers (eta)", gr.Number, { "visible": False}), + "eta_ddim": OptionInfo(0.0, "Noise multiplier for DDIM (eta)", gr.Number, { "visible": False}), + "ddim_discretize": OptionInfo('uniform', "", gr.Text, { "visible": False}), + 's_churn': OptionInfo(0.0, "sigma churn", gr.Number, { "visible": False}), + 's_min_uncond': OptionInfo(0, "sigma negative guidance minimum ", gr.Number, { "visible": False}), + 's_tmin': OptionInfo(0.0, "sigma tmin", gr.Number, { "visible": False}), + 's_noise': OptionInfo(1.0, "sigma noise", gr.Number, { "visible": False}), 'eta_noise_seed_delta': OptionInfo(0, "Noise seed delta (eta)", gr.Number, {"precision": 0}, { "visible": False}), - 'always_discard_next_to_last_sigma': OptionInfo(False, "Always discard next-to-last sigma", { "visible": False}), - 'uni_pc_variant': OptionInfo("bh1", "UniPC variant", gr.Radio, {"choices": ["bh1", "bh2", "vary_coeff"]}, { "visible": False}), - 'uni_pc_skip_type': OptionInfo("time_uniform", "UniPC skip type", gr.Radio, {"choices": ["time_uniform", "time_quadratic", "logSNR"]}, { "visible": False}), - 'uni_pc_order': OptionInfo(3, "UniPC order (must be < sampling steps)", gr.Slider, {"minimum": 1, "maximum": 10, "step": 1}, { "visible": False}), - 'uni_pc_lower_order_final': OptionInfo(True, "UniPC lower order final", { "visible": False}), + 'always_discard_next_to_last_sigma': OptionInfo(False, "Always discard next-to-last sigma", gr.Checkbox, { "visible": False}), + #'uni_pc_variant': OptionInfo("bh1", "UniPC variant", gr.Radio, {"choices": ["bh1", "bh2", "vary_coeff"]}, { "visible": False}), + #'uni_pc_skip_type': OptionInfo("time_uniform", "UniPC skip type", gr.Radio, {"choices": ["time_uniform", "time_quadratic", "logSNR"]}, { "visible": False}), + #'uni_pc_order': OptionInfo(3, "UniPC order (must be < sampling steps)", gr.Slider, {"minimum": 1, "maximum": 10, "step": 1}, { "visible": False}), + #'uni_pc_lower_order_final': OptionInfo(True, "UniPC lower order final", { "visible": False}), # diffuser specific "schedulers_prediction_type": OptionInfo("default", "Samplers override model prediction type", gr.Radio, lambda: {"choices": ['default', 'epsilon', 'sample', 'v-prediction']}), "schedulers_beta_schedule": OptionInfo("default", "Samplers override beta schedule", gr.Radio, lambda: {"choices": ['default', 'linear', 'scaled_linear', 'squaredcos_cap_v2']}), diff --git a/modules/ui.py b/modules/ui.py index 42378732b..36c99b559 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -903,9 +903,13 @@ def create_ui(startup_timer): res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {})) create_refresh_button(res, info.refresh, info.component_args, f"refresh_{key}") else: - res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {})) + try: + res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {})) + except Exception as e: + modules.shared.log.error(f'Error creating setting: {key} {e}') + res = None - if not is_quicksettings: + if res is not None and not is_quicksettings: res.change(fn=None, inputs=res, _js=f'(val) => markIfModified("{key}", val)') dirty_indicator.click(fn=lambda: getattr(opts, key), outputs=res, show_progress=False) dirtyable_setting.__exit__()