From df004be2fc4b2c68adfb75565d97551a1a5e7ed6 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 21 May 2023 00:26:16 +0300 Subject: Add a couple `from __future__ import annotations`es for Py3.9 compat --- webui.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'webui.py') diff --git a/webui.py b/webui.py index a76e377c..d4402f55 100644 --- a/webui.py +++ b/webui.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os import sys import time -- cgit v1.2.3 From 8faac8b96313c6c4bf0a81bddecff4d6ba22ac25 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 21 May 2023 21:55:14 +0300 Subject: run basic torch calculation at startup in parallel to reduce the performance impact of first generation --- webui.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'webui.py') diff --git a/webui.py b/webui.py index d4402f55..07c70c46 100644 --- a/webui.py +++ b/webui.py @@ -20,7 +20,7 @@ import logging logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage()) -from modules import paths, timer, import_hook, errors # noqa: F401 +from modules import paths, timer, import_hook, errors, devices # noqa: F401 startup_timer = timer.Timer() @@ -295,6 +295,8 @@ def initialize_rest(*, reload_script_modules=False): # (when reloading, this does nothing) Thread(target=lambda: shared.sd_model).start() + Thread(target=devices.first_time_calculation).start() + shared.reload_hypernetworks() startup_timer.record("reload hypernetworks") -- cgit v1.2.3 From 47b669bc9ff3df73f58b675abaffbdfd84771a67 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 22 May 2023 09:53:24 +0300 Subject: Upgrade Gradio, remove docs URL hack --- webui.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'webui.py') diff --git a/webui.py b/webui.py index d4402f55..2d2c1134 100644 --- a/webui.py +++ b/webui.py @@ -370,17 +370,6 @@ def webui(): gradio_auth_creds = list(get_gradio_auth_creds()) or None - # this restores the missing /docs endpoint - if launch_api and not hasattr(FastAPI, 'original_setup'): - # TODO: replace this with `launch(app_kwargs=...)` if https://github.com/gradio-app/gradio/pull/4282 gets merged - def fastapi_setup(self): - self.docs_url = "/docs" - self.redoc_url = "/redoc" - self.original_setup() - - FastAPI.original_setup = FastAPI.setup - FastAPI.setup = fastapi_setup - app, local_url, share_url = shared.demo.launch( share=cmd_opts.share, server_name=server_name, @@ -393,6 +382,10 @@ def webui(): inbrowser=cmd_opts.autolaunch, prevent_thread_lock=True, allowed_paths=cmd_opts.gradio_allowed_path, + app_kwargs={ + "docs_url": "/docs", + "redoc_url": "/redoc", + }, ) if cmd_opts.add_stop_route: app.add_route("/_stop", stop_route, methods=["POST"]) -- cgit v1.2.3 From a6e653be26cc05f4438145fa0082816e9fbbf5fc Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Tue, 23 May 2023 18:02:09 +0300 Subject: possible fix for empty list of optimizations #10605 --- webui.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'webui.py') diff --git a/webui.py b/webui.py index 6933473d..f9210f41 100644 --- a/webui.py +++ b/webui.py @@ -291,9 +291,20 @@ def initialize_rest(*, reload_script_modules=False): modules.sd_hijack.list_optimizers() startup_timer.record("scripts list_optimizers") - # load model in parallel to other startup stuff - # (when reloading, this does nothing) - Thread(target=lambda: shared.sd_model).start() + def load_model(): + """ + Accesses shared.sd_model property to load model. + After it's available, if it has been loaded before this access by some extension, + its optimization may be None because the list of optimizaers has neet been filled + by that time, so we apply optimization again. + """ + + shared.sd_model # noqa: B018 + + if modules.sd_hijack.current_optimizer is None: + modules.sd_hijack.apply_optimizations() + + Thread(target=load_model).start() Thread(target=devices.first_time_calculation).start() -- cgit v1.2.3 From 339b5315700a469f4a9f0d5afc08ca2aca60c579 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 27 May 2023 15:47:33 +0300 Subject: custom unet support --- webui.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'webui.py') diff --git a/webui.py b/webui.py index f9210f41..1e3ff061 100644 --- a/webui.py +++ b/webui.py @@ -58,6 +58,7 @@ import modules.sd_hijack import modules.sd_hijack_optimizations import modules.sd_models import modules.sd_vae +import modules.sd_unet import modules.txt2img import modules.script_callbacks import modules.textual_inversion.textual_inversion @@ -291,6 +292,9 @@ def initialize_rest(*, reload_script_modules=False): modules.sd_hijack.list_optimizers() startup_timer.record("scripts list_optimizers") + modules.sd_unet.list_unets() + startup_timer.record("scripts list_unets") + def load_model(): """ Accesses shared.sd_model property to load model. -- cgit v1.2.3 From cf07983a6e5aa2cf131a75e5b974c25c171a7126 Mon Sep 17 00:00:00 2001 From: Sakura-Luna <53183413+Sakura-Luna@users.noreply.github.com> Date: Sun, 28 May 2023 20:42:19 +0800 Subject: Upgrade xformers --- webui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui.py') diff --git a/webui.py b/webui.py index 1e3ff061..3df2cd1a 100644 --- a/webui.py +++ b/webui.py @@ -135,7 +135,7 @@ there are reports of issues with training tab on the latest version. Use --skip-version-check commandline argument to disable this check. """.strip()) - expected_xformers_version = "0.0.17" + expected_xformers_version = "0.0.20" if shared.xformers_available: import xformers -- cgit v1.2.3