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

---
 modules/launch_utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 35a52310..6eb3ea11 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -223,7 +223,7 @@ def prepare_environment():
     torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url {torch_index_url}")
     requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
 
-    xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17')
+    xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.20')
     gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip")
     clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip")
     openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")
-- 
cgit v1.2.3


From 00dfe27f59727407c5b408a80ff2a262934df495 Mon Sep 17 00:00:00 2001
From: Aarni Koskela <akx@iki.fi>
Date: Mon, 29 May 2023 08:54:13 +0300
Subject: Add & use modules.errors.print_error where currently printing
 exception info by hand

---
 modules/launch_utils.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 35a52310..22edc106 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -8,6 +8,7 @@ import json
 from functools import lru_cache
 
 from modules import cmd_args
+from modules.errors import print_error
 from modules.paths_internal import script_path, extensions_dir
 
 args, _ = cmd_args.parser.parse_known_args()
@@ -188,7 +189,7 @@ def run_extension_installer(extension_dir):
 
         print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {extension_dir}", custom_env=env))
     except Exception as e:
-        print(e, file=sys.stderr)
+        print_error(str(e))
 
 
 def list_extensions(settings_file):
@@ -198,8 +199,8 @@ def list_extensions(settings_file):
         if os.path.isfile(settings_file):
             with open(settings_file, "r", encoding="utf8") as file:
                 settings = json.load(file)
-    except Exception as e:
-        print(e, file=sys.stderr)
+    except Exception:
+        print_error("Could not load settings", exc_info=True)
 
     disabled_extensions = set(settings.get('disabled_extensions', []))
     disable_all_extensions = settings.get('disable_all_extensions', 'none')
-- 
cgit v1.2.3


From 5fcdaa6a7f19d083a6393cc0d2b933ff5080f5b3 Mon Sep 17 00:00:00 2001
From: Aarni Koskela <akx@iki.fi>
Date: Tue, 30 May 2023 12:36:55 +0300
Subject: Vendor in the single module used from taming_transformers; remove
 taming_transformers dependency

(and fix the two ruff complaints)
---
 modules/launch_utils.py | 3 ---
 1 file changed, 3 deletions(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 35a52310..ca089674 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -229,13 +229,11 @@ def prepare_environment():
     openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")
 
     stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://github.com/Stability-AI/stablediffusion.git")
-    taming_transformers_repo = os.environ.get('TAMING_TRANSFORMERS_REPO', "https://github.com/CompVis/taming-transformers.git")
     k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'https://github.com/crowsonkb/k-diffusion.git')
     codeformer_repo = os.environ.get('CODEFORMER_REPO', 'https://github.com/sczhou/CodeFormer.git')
     blip_repo = os.environ.get('BLIP_REPO', 'https://github.com/salesforce/BLIP.git')
 
     stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf")
-    taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6")
     k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "c9fe758757e022f05ca5a53fa8fac28889e4f1cf")
     codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
     blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
@@ -286,7 +284,6 @@ def prepare_environment():
     os.makedirs(os.path.join(script_path, dir_repos), exist_ok=True)
 
     git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash)
-    git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
     git_clone(k_diffusion_repo, repo_dir('k-diffusion'), "K-diffusion", k_diffusion_commit_hash)
     git_clone(codeformer_repo, repo_dir('CodeFormer'), "CodeFormer", codeformer_commit_hash)
     git_clone(blip_repo, repo_dir('BLIP'), "BLIP", blip_commit_hash)
-- 
cgit v1.2.3


From 05933840f0676dd1a90a7e2ad3f2a0672624b2cd Mon Sep 17 00:00:00 2001
From: AUTOMATIC <16777216c@gmail.com>
Date: Wed, 31 May 2023 19:56:37 +0300
Subject: rename print_error to report, use it with together with package name

---
 modules/launch_utils.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 0bf4cb7e..6e9bb770 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -7,8 +7,7 @@ import platform
 import json
 from functools import lru_cache
 
-from modules import cmd_args
-from modules.errors import print_error
+from modules import cmd_args, errors
 from modules.paths_internal import script_path, extensions_dir
 
 args, _ = cmd_args.parser.parse_known_args()
@@ -189,7 +188,7 @@ def run_extension_installer(extension_dir):
 
         print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {extension_dir}", custom_env=env))
     except Exception as e:
-        print_error(str(e))
+        errors.report(str(e))
 
 
 def list_extensions(settings_file):
@@ -200,7 +199,7 @@ def list_extensions(settings_file):
             with open(settings_file, "r", encoding="utf8") as file:
                 settings = json.load(file)
     except Exception:
-        print_error("Could not load settings", exc_info=True)
+        errors.report("Could not load settings", exc_info=True)
 
     disabled_extensions = set(settings.get('disabled_extensions', []))
     disable_all_extensions = settings.get('disable_all_extensions', 'none')
-- 
cgit v1.2.3


From 0dd6bca4f1a449b7ad9fa77fab0037aa98d21ced Mon Sep 17 00:00:00 2001
From: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date: Fri, 2 Jun 2023 21:50:08 +0900
Subject: fallback version info form CHANGELOG.md

---
 modules/launch_utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 6e9bb770..e7dbc5b2 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -68,7 +68,8 @@ def git_tag():
     try:
         return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip()
     except Exception:
-        return "<none>"
+        with open(os.path.dirname(os.path.abspath(__file__)) + "/../CHANGELOG.md") as file:
+            return next((line.strip() for line in file if line.strip()), "<none>")
 
 
 def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live) -> str:
-- 
cgit v1.2.3


From d1bfc86ffcbe64eea7642ed1292ac89199beb0dc Mon Sep 17 00:00:00 2001
From: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date: Sat, 3 Jun 2023 13:07:07 +0900
Subject: Update modules/launch_utils.py

Co-authored-by: Aarni Koskela <akx@iki.fi>
---
 modules/launch_utils.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index e7dbc5b2..9c3af12f 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -68,8 +68,12 @@ def git_tag():
     try:
         return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip()
     except Exception:
-        with open(os.path.dirname(os.path.abspath(__file__)) + "/../CHANGELOG.md") as file:
-            return next((line.strip() for line in file if line.strip()), "<none>")
+        try:
+            changelog_md = pathlib.Path(__file__).parent.parent / "CHANGELOG.md"
+            with changelog_md.open(encoding="utf-8") as file:
+                return next((line.strip() for line in file if line.strip()), "<none>")
+        except Exception:
+            return "<none>"
 
 
 def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_command_live) -> str:
-- 
cgit v1.2.3


From df5a3cbefe46dbd6b5eb5b6a62e66d5b7378d4ee Mon Sep 17 00:00:00 2001
From: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date: Sat, 3 Jun 2023 13:33:23 +0900
Subject: fallback version info form CHANGELOG.md

---
 modules/launch_utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 9c3af12f..0c8c4db0 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -69,7 +69,8 @@ def git_tag():
         return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip()
     except Exception:
         try:
-            changelog_md = pathlib.Path(__file__).parent.parent / "CHANGELOG.md"
+            from pathlib import Path
+            changelog_md = Path(__file__).parent.parent / "CHANGELOG.md"
             with changelog_md.open(encoding="utf-8") as file:
                 return next((line.strip() for line in file if line.strip()), "<none>")
         except Exception:
-- 
cgit v1.2.3


From 333e63c0911c148ea306d7b72580d5c6d2f2c41a Mon Sep 17 00:00:00 2001
From: AUTOMATIC <16777216c@gmail.com>
Date: Sat, 3 Jun 2023 09:59:56 +0300
Subject: a yet another method to restart webui

---
 modules/launch_utils.py | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 0c8c4db0..af8d8b37 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -244,6 +244,12 @@ def prepare_environment():
     codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
     blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
 
+    try:
+        # the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
+        os.remove(os.path.join(script_path, "tmp", "restart"))
+    except OSError:
+        pass
+
     if not args.skip_python_version_check:
         check_python_version()
 
-- 
cgit v1.2.3


From 1411a6e74b2fa07ecfc2117d774520f957651145 Mon Sep 17 00:00:00 2001
From: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date: Tue, 6 Jun 2023 00:25:28 +0900
Subject: rework-disable-autolaunch

---
 modules/launch_utils.py | 1 +
 1 file changed, 1 insertion(+)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index af8d8b37..59008385 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -247,6 +247,7 @@ def prepare_environment():
     try:
         # the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
         os.remove(os.path.join(script_path, "tmp", "restart"))
+        os.environ.setdefault('SD_WEBUI_DISABLE_AUTOLAUNCH', '1')
     except OSError:
         pass
 
-- 
cgit v1.2.3


From c2808f3040babbb5b9456d15aa2a9354c1c64d23 Mon Sep 17 00:00:00 2001
From: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date: Tue, 6 Jun 2023 02:52:05 +0900
Subject: SD_WEBUI_RESTARTING

---
 modules/launch_utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 59008385..609a181e 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -247,7 +247,7 @@ def prepare_environment():
     try:
         # the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
         os.remove(os.path.join(script_path, "tmp", "restart"))
-        os.environ.setdefault('SD_WEBUI_DISABLE_AUTOLAUNCH', '1')
+        os.environ.setdefault('SD_WEBUI_RESTARTING ', '1')
     except OSError:
         pass
 
-- 
cgit v1.2.3


From 376f793bded0e7df40eafcacfd086e4e4d218bc5 Mon Sep 17 00:00:00 2001
From: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date: Thu, 15 Jun 2023 04:23:52 +0900
Subject: git clone show progress

---
 modules/launch_utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'modules/launch_utils.py')

diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 609a181e..97539e68 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -147,10 +147,10 @@ def git_clone(url, dir, name, commithash=None):
             return
 
         run(f'"{git}" -C "{dir}" fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")
-        run(f'"{git}" -C "{dir}" checkout {commithash}', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}")
+        run(f'"{git}" -C "{dir}" checkout {commithash}', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}", live=True)
         return
 
-    run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}")
+    run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
 
     if commithash is not None:
         run(f'"{git}" -C "{dir}" checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
-- 
cgit v1.2.3