From fcdc3f2dd0402cca7c8c52f529e523f8c23cb179 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Tue, 11 Jun 2024 18:27:21 +0530 Subject: [PATCH 01/44] Don't crash if psutils fails to get cpu or memory usage --- scripts/check_modules.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 85c6036c..755841bf 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -128,10 +128,10 @@ def update_modules(): # if sdkit is 2.0.15.x (or lower), then diffusers should be restricted to 0.21.4 (see below for the reason) # otherwise use the current sdkit version (with the corresponding diffusers version) - expected_sdkit_version_str = "2.0.20.3" + expected_sdkit_version_str = "2.0.20.4" expected_diffusers_version_str = "0.28.2" - legacy_sdkit_version_str = "2.0.15.6" + legacy_sdkit_version_str = "2.0.15.7" legacy_diffusers_version_str = "0.21.4" sdkit_version_str = version("sdkit") @@ -413,9 +413,17 @@ def launch_uvicorn(): setup_amd_environment() print("\nLaunching uvicorn\n") - + import uvicorn - uvicorn.run("main:server_api", port=listen_port, log_level="error", app_dir=os.environ["SD_UI_PATH"], host=bind_ip, access_log=False) + + uvicorn.run( + "main:server_api", + port=listen_port, + log_level="error", + app_dir=os.environ["SD_UI_PATH"], + host=bind_ip, + access_log=False, + ) ### Start From d062c2149a0cdf975e3dfb2f5c0dde29cd069155 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 13 Jun 2024 14:05:11 +0530 Subject: [PATCH 02/44] temp hotfix for rocm torch --- scripts/check_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 755841bf..7d86c133 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -141,7 +141,6 @@ def update_modules(): else: sdkit_version = version_str_to_tuple(sdkit_version_str) legacy_sdkit_version = version_str_to_tuple(legacy_sdkit_version_str) - torch_version = version_str_to_tuple(version("torch")) if sdkit_version[:3] <= legacy_sdkit_version[:3]: # and torch_version < (0, 13): # stick to diffusers 0.21.4, since it preserves torch 0.11+ compatibility. @@ -152,6 +151,7 @@ def update_modules(): install_pkg_if_necessary("sdkit", legacy_sdkit_version_str) install_pkg_if_necessary("diffusers", legacy_diffusers_version_str) else: + torch_version = version_str_to_tuple(version("torch")) if torch_version < (1, 13): # install the gpu-compatible torch (if necessary), instead of the default CPU-only one # from the diffusers dependency chain From a261a2d47dfbd455b3d9005f56dd4806c6df268e Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Fri, 14 Jun 2024 09:43:30 +0530 Subject: [PATCH 03/44] Fix #1779 - add to PATH only if it isn't present, to avoid exploding the PATH variable each time the function is called --- ui/easydiffusion/device_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/easydiffusion/device_manager.py b/ui/easydiffusion/device_manager.py index dc705927..9b0f3f5e 100644 --- a/ui/easydiffusion/device_manager.py +++ b/ui/easydiffusion/device_manager.py @@ -243,7 +243,8 @@ def get_processor_name(): if platform.system() == "Windows": return platform.processor() elif platform.system() == "Darwin": - os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin" + if "/usr/sbin" not in os.environ["PATH"].split(os.pathsep): + os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin" command = "sysctl -n machdep.cpu.brand_string" return subprocess.check_output(command, shell=True).decode().strip() elif platform.system() == "Linux": From 364902f8a1b99f4a3af4454122f8559ec06905e3 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Fri, 14 Jun 2024 09:48:49 +0530 Subject: [PATCH 04/44] Ignore text in the version string when comparing them --- scripts/check_modules.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 7d86c133..9a067e68 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -15,6 +15,7 @@ import traceback import shutil from pathlib import Path from pprint import pprint +import re os_name = platform.system() @@ -225,6 +226,7 @@ def install_pkg_if_necessary(pkg_name, required_version): def version_str_to_tuple(ver_str): ver_str = ver_str.split("+")[0] + ver_str = re.sub("[^0-9.]", "", ver_str) ver = ver_str.split(".") return tuple(map(int, ver)) From 5fe3acd44bfa1927de6dcdd6d9576ca89a8a847a Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 9 Sep 2024 18:34:32 +0530 Subject: [PATCH 05/44] Use 1.4 by default, instead of 1.5 --- ui/easydiffusion/model_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/easydiffusion/model_manager.py b/ui/easydiffusion/model_manager.py index f6e1e2d0..26f05242 100644 --- a/ui/easydiffusion/model_manager.py +++ b/ui/easydiffusion/model_manager.py @@ -37,7 +37,7 @@ MODEL_EXTENSIONS = { } DEFAULT_MODELS = { "stable-diffusion": [ - {"file_name": "sd-v1-5.safetensors", "model_id": "1.5-pruned-emaonly-fp16"}, + {"file_name": "sd-v1-4.ckpt", "model_id": "1.4"}, ], "gfpgan": [ {"file_name": "GFPGANv1.4.pth", "model_id": "1.4"}, From 0c8410c371d5f473d133659eabcb42fd37ed1d72 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Wed, 13 Nov 2024 21:36:35 +0530 Subject: [PATCH 06/44] Pin huggingface-hub to 0.23.2 to fix broken deployments --- scripts/check_modules.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 9a067e68..45fb107d 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -34,6 +34,7 @@ modules_to_check = { "sqlalchemy": "2.0.19", "python-multipart": "0.0.6", # "xformers": "0.0.16", + "huggingface-hub": "0.23.2", } modules_to_log = ["torch", "torchvision", "sdkit", "stable-diffusion-sdkit", "diffusers"] From b3a961fc82d9e27ef627084d482c66b8837c1163 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Wed, 13 Nov 2024 21:49:17 +0530 Subject: [PATCH 07/44] Update check_modules.py --- scripts/check_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 45fb107d..951ca868 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -34,7 +34,7 @@ modules_to_check = { "sqlalchemy": "2.0.19", "python-multipart": "0.0.6", # "xformers": "0.0.16", - "huggingface-hub": "0.23.2", + "huggingface-hub": "0.21.4", } modules_to_log = ["torch", "torchvision", "sdkit", "stable-diffusion-sdkit", "diffusers"] From 74b05022f4ed7050bc3c853f97cd6ef21e759d64 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Wed, 11 Dec 2024 11:20:17 +0530 Subject: [PATCH 08/44] Merge pull request #1867 from tjcomserv/tjcomserv-patch-1-pydantic Tjcomserv patch 1 pydantic --- scripts/check_modules.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 951ca868..d695ee03 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -28,7 +28,7 @@ modules_to_check = { "stable-diffusion-sdkit": "2.1.5", "rich": "12.6.0", "uvicorn": "0.19.0", - "fastapi": "0.85.1", + "fastapi": "0.115.6", "pycloudflared": "0.2.0", "ruamel.yaml": "0.17.21", "sqlalchemy": "2.0.19", @@ -100,8 +100,8 @@ def update_modules(): allowed_versions = ("59.8.0",) latest_version = "59.8.0" else: - allowed_versions = ("69.0.0",) - latest_version = "69.0.0" + allowed_versions = ("69.5.1",) + latest_version = "69.5.1" requires_install = False if module_name in ("torch", "torchvision"): From 77a9226720a6bd8b578a12920a2bce32116f22d8 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Wed, 11 Dec 2024 11:47:18 +0530 Subject: [PATCH 09/44] Annotate with types for pydantic --- ui/easydiffusion/types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/easydiffusion/types.py b/ui/easydiffusion/types.py index f16e9aa3..2da62537 100644 --- a/ui/easydiffusion/types.py +++ b/ui/easydiffusion/types.py @@ -20,8 +20,8 @@ class GenerateImageRequest(BaseModel): control_image: Any = None control_alpha: Union[float, List[float]] = None prompt_strength: float = 0.8 - preserve_init_image_color_profile = False - strict_mask_border = False + preserve_init_image_color_profile: bool = False + strict_mask_border: bool = False sampler_name: str = None # "ddim", "plms", "heun", "euler", "euler_a", "dpm2", "dpm2_a", "lms" hypernetwork_strength: float = 0 @@ -100,7 +100,7 @@ class MergeRequest(BaseModel): model1: str = None ratio: float = None out_path: str = "mix" - use_fp16 = True + use_fp16: bool = True class Image: From c246c7456afb176a04c3a900a154d41b2dd4db8a Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Wed, 11 Dec 2024 11:59:09 +0530 Subject: [PATCH 10/44] Pin wandb --- scripts/check_modules.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index d695ee03..bf8e74af 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -35,6 +35,7 @@ modules_to_check = { "python-multipart": "0.0.6", # "xformers": "0.0.16", "huggingface-hub": "0.21.4", + "wandb": "0.13.7", } modules_to_log = ["torch", "torchvision", "sdkit", "stable-diffusion-sdkit", "diffusers"] From 1a1f8f381ba6c32369fcfe3945fb3139bc04abdb Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 12 Dec 2024 00:15:31 +0530 Subject: [PATCH 11/44] winter is coming --- ui/plugins/ui/snow.plugin.js | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ui/plugins/ui/snow.plugin.js diff --git a/ui/plugins/ui/snow.plugin.js b/ui/plugins/ui/snow.plugin.js new file mode 100644 index 00000000..6299a038 --- /dev/null +++ b/ui/plugins/ui/snow.plugin.js @@ -0,0 +1,71 @@ +// temp christmas hack, courtesy: https://pajasevi.github.io/CSSnowflakes/ + +;(function(){ + "use strict"; + const styleSheet = document.createElement("style") + styleSheet.textContent = ` + /* customizable snowflake styling */ + .snowflake { + color: #fff; + font-size: 1em; + font-family: Arial, sans-serif; + text-shadow: 0 0 5px #000; + } + + .snowflake,.snowflake .inner{animation-iteration-count:infinite;animation-play-state:running}@keyframes snowflakes-fall{0%{transform:translateY(0)}100%{transform:translateY(110vh)}}@keyframes snowflakes-shake{0%,100%{transform:translateX(0)}50%{transform:translateX(80px)}}.snowflake{position:fixed;top:-10%;z-index:9999;-webkit-user-select:none;user-select:none;cursor:default;animation-name:snowflakes-shake;animation-duration:3s;animation-timing-function:ease-in-out}.snowflake .inner{animation-duration:10s;animation-name:snowflakes-fall;animation-timing-function:linear}.snowflake:nth-of-type(0){left:1%;animation-delay:0s}.snowflake:nth-of-type(0) .inner{animation-delay:0s}.snowflake:first-of-type{left:10%;animation-delay:1s}.snowflake:first-of-type .inner,.snowflake:nth-of-type(8) .inner{animation-delay:1s}.snowflake:nth-of-type(2){left:20%;animation-delay:.5s}.snowflake:nth-of-type(2) .inner,.snowflake:nth-of-type(6) .inner{animation-delay:6s}.snowflake:nth-of-type(3){left:30%;animation-delay:2s}.snowflake:nth-of-type(11) .inner,.snowflake:nth-of-type(3) .inner{animation-delay:4s}.snowflake:nth-of-type(4){left:40%;animation-delay:2s}.snowflake:nth-of-type(10) .inner,.snowflake:nth-of-type(4) .inner{animation-delay:2s}.snowflake:nth-of-type(5){left:50%;animation-delay:3s}.snowflake:nth-of-type(5) .inner{animation-delay:8s}.snowflake:nth-of-type(6){left:60%;animation-delay:2s}.snowflake:nth-of-type(7){left:70%;animation-delay:1s}.snowflake:nth-of-type(7) .inner{animation-delay:2.5s}.snowflake:nth-of-type(8){left:80%;animation-delay:0s}.snowflake:nth-of-type(9){left:90%;animation-delay:1.5s}.snowflake:nth-of-type(9) .inner{animation-delay:3s}.snowflake:nth-of-type(10){left:25%;animation-delay:0s}.snowflake:nth-of-type(11){left:65%;animation-delay:2.5s} + ` + document.head.appendChild(styleSheet) + + const snowflakes = document.createElement("div") + snowflakes.innerHTML = ` + ` + + document.body.appendChild(snowflakes) + + const script = document.createElement("script") + script.innerHTML = ` + $(document).ready(function() { + setTimeout(function() { + $(".snowflakes").fadeOut("slow") + }, 10 * 1000) + }) + ` + document.body.appendChild(script) +})() From 28badd53190fd319ef7b5d701444cd8a1b9a2bde Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 12 Dec 2024 00:26:16 +0530 Subject: [PATCH 12/44] =?UTF-8?q?=E2=9D=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/plugins/ui/snow.plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/plugins/ui/snow.plugin.js b/ui/plugins/ui/snow.plugin.js index 6299a038..6bdcf0f8 100644 --- a/ui/plugins/ui/snow.plugin.js +++ b/ui/plugins/ui/snow.plugin.js @@ -17,6 +17,7 @@ document.head.appendChild(styleSheet) const snowflakes = document.createElement("div") + snowflakes.id = "snowflakes-container" snowflakes.innerHTML = `