From 7a118eeb15232a710cb25f719e84e7bb56ddd189 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 31 Aug 2023 19:20:26 +0530 Subject: [PATCH] Rename the test_diffusers config key to upgrade all the existing users to the v3 engine. Users can now opt to disable v3. This upgrades existing users who had maybe tried diffusers many months ago (when it was still unstable) and decided against it (at that time). --- ui/easydiffusion/app.py | 10 +++++----- ui/easydiffusion/runtime.py | 2 +- ui/easydiffusion/server.py | 4 ++-- ui/easydiffusion/utils/save_utils.py | 2 +- ui/media/js/parameters.js | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ui/easydiffusion/app.py b/ui/easydiffusion/app.py index 91608dfb..2edf544f 100644 --- a/ui/easydiffusion/app.py +++ b/ui/easydiffusion/app.py @@ -61,7 +61,7 @@ APP_CONFIG_DEFAULTS = { "ui": { "open_browser_on_start": True, }, - "test_diffusers": True, + "use_v3_engine": True, } IMAGE_EXTENSIONS = [ @@ -116,9 +116,9 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): shutil.move(config_legacy_yaml, config_yaml_path) def set_config_on_startup(config: dict): - if getConfig.__test_diffusers_on_startup is None: - getConfig.__test_diffusers_on_startup = config.get("test_diffusers", True) - config["config_on_startup"] = {"test_diffusers": getConfig.__test_diffusers_on_startup} + if getConfig.__use_v3_engine_on_startup is None: + getConfig.__use_v3_engine_on_startup = config.get("use_v3_engine", True) + config["config_on_startup"] = {"use_v3_engine": getConfig.__use_v3_engine_on_startup} if os.path.isfile(config_yaml_path): try: @@ -166,7 +166,7 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): return default_val -getConfig.__test_diffusers_on_startup = None +getConfig.__use_v3_engine_on_startup = None def setConfig(config): diff --git a/ui/easydiffusion/runtime.py b/ui/easydiffusion/runtime.py index 38c56e40..78d90f60 100644 --- a/ui/easydiffusion/runtime.py +++ b/ui/easydiffusion/runtime.py @@ -30,7 +30,7 @@ def init(device): from easydiffusion import app app_config = app.getConfig() - context.test_diffusers = app_config.get("test_diffusers", True) + context.test_diffusers = app_config.get("use_v3_engine", True) log.info("Device usage during initialization:") get_device_usage(device, log_info=True, process_usage_only=False) diff --git a/ui/easydiffusion/server.py b/ui/easydiffusion/server.py index b8a7b3ff..f0aacd15 100644 --- a/ui/easydiffusion/server.py +++ b/ui/easydiffusion/server.py @@ -66,7 +66,7 @@ class SetAppConfigRequest(BaseModel, extra=Extra.allow): ui_open_browser_on_start: bool = None listen_to_network: bool = None listen_port: int = None - test_diffusers: bool = True + use_v3_engine: bool = True def init(): @@ -175,7 +175,7 @@ def set_app_config_internal(req: SetAppConfigRequest): config["net"] = {} config["net"]["listen_port"] = int(req.listen_port) - config["test_diffusers"] = req.test_diffusers + config["use_v3_engine"] = req.use_v3_engine for property, property_value in req.dict().items(): if property_value is not None and property not in req.__fields__ and property not in PROTECTED_CONFIG_KEYS: diff --git a/ui/easydiffusion/utils/save_utils.py b/ui/easydiffusion/utils/save_utils.py index 95bb37c5..0694ca33 100644 --- a/ui/easydiffusion/utils/save_utils.py +++ b/ui/easydiffusion/utils/save_utils.py @@ -230,7 +230,7 @@ def get_printable_request( task_data_metadata.update(save_data.dict()) app_config = app.getConfig() - using_diffusers = app_config.get("test_diffusers", True) + using_diffusers = app_config.get("use_v3_engine", True) # Save the metadata in the order defined in TASK_TEXT_MAPPING metadata = {} diff --git a/ui/media/js/parameters.js b/ui/media/js/parameters.js index fcbcf8a8..d71022ac 100644 --- a/ui/media/js/parameters.js +++ b/ui/media/js/parameters.js @@ -238,7 +238,7 @@ var PARAMETERS = [ default: false, }, { - id: "test_diffusers", + id: "use_v3_engine", type: ParameterType.checkbox, label: "Use the new v3 engine (diffusers)", note: @@ -420,7 +420,7 @@ let listenPortField = document.querySelector("#listen_port") let useBetaChannelField = document.querySelector("#use_beta_channel") let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_start") let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_actions") -let testDiffusers = document.querySelector("#test_diffusers") +let testDiffusers = document.querySelector("#use_v3_engine") let profileNameField = document.querySelector("#profileName") let saveSettingsBtn = document.querySelector("#save-system-settings-btn") @@ -465,13 +465,13 @@ async function getAppConfig() { } let testDiffusersEnabled = true - if (config.test_diffusers === false) { + if (config.use_v3_engine === false) { testDiffusersEnabled = false } testDiffusers.checked = testDiffusersEnabled if (config.config_on_startup) { - if (config.config_on_startup?.test_diffusers) { + if (config.config_on_startup?.use_v3_engine) { document.body.classList.add("diffusers-enabled-on-startup") document.body.classList.remove("diffusers-disabled-on-startup") } else {