From fb1374791bf4b4c9b49de5378f29b12fdabcac97 Mon Sep 17 00:00:00 2001 From: Billy Cao Date: Thu, 3 Nov 2022 13:08:11 +0800 Subject: Fix --nowebui argument being ineffective --- launch.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 958336f2..b061bce6 100644 --- a/launch.py +++ b/launch.py @@ -217,12 +217,15 @@ def tests(argv): proc.kill() -def start_webui(): - print(f"Launching Web UI with arguments: {' '.join(sys.argv[1:])}") +def start(): + print(f"Launching {'API server' if '--nowebui' in sys.argv else 'Web UI'} with arguments: {' '.join(sys.argv[1:])}") import webui - webui.webui() + if '--nowebui' in sys.argv: + webui.api_only() + else: + webui.webui() if __name__ == "__main__": prepare_enviroment() - start_webui() + start() -- cgit v1.2.1 From c0f7dbda3361daaa3e315e747fe5bebb75ea55d0 Mon Sep 17 00:00:00 2001 From: hentailord85ez <112723046+hentailord85ez@users.noreply.github.com> Date: Fri, 4 Nov 2022 23:01:58 +0000 Subject: Update k-diffusion to release 0.0.10 --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 2a51f20e..5fa11560 100644 --- a/launch.py +++ b/launch.py @@ -142,7 +142,7 @@ def prepare_enviroment(): stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc") taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6") - k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "f4e99857772fc3a126ba886aadf795a332774878") + k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "60e5042ca0da89c14d1dd59d73883280f8fce991") codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af") blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9") -- cgit v1.2.1 From 98947d173e3f1667eba29c904f681047dea9de90 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 12 Nov 2022 11:11:47 +0300 Subject: run installers for newly installed extensions --- launch.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 5fa11560..8e65676d 100644 --- a/launch.py +++ b/launch.py @@ -105,22 +105,26 @@ def version_check(commit): print("version check failed", e) +def run_extension_installer(extension_dir): + path_installer = os.path.join(extension_dir, "install.py") + if not os.path.isfile(path_installer): + return + + try: + env = os.environ.copy() + env['PYTHONPATH'] = os.path.abspath(".") + + 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) + + def run_extensions_installers(): if not os.path.isdir(dir_extensions): return for dirname_extension in os.listdir(dir_extensions): - path_installer = os.path.join(dir_extensions, dirname_extension, "install.py") - if not os.path.isfile(path_installer): - continue - - try: - env = os.environ.copy() - env['PYTHONPATH'] = os.path.abspath(".") - - print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env)) - except Exception as e: - print(e, file=sys.stderr) + run_extension_installer(os.path.join(dir_extensions, dirname_extension)) def prepare_enviroment(): -- cgit v1.2.1 From 007f4f7314eabd9cc3a2b0d11889de49ad3c682a Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Sat, 12 Nov 2022 15:12:15 +0300 Subject: Tests cleaned up --- launch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 8e65676d..6822a01d 100644 --- a/launch.py +++ b/launch.py @@ -229,6 +229,9 @@ def prepare_enviroment(): def tests(argv): if "--api" not in argv: argv.append("--api") + if "--ckpt" not in argv: + argv.append("--ckpt") + argv.append("./test/test_files/empty.pt") print(f"Launching Web UI in another process for testing with arguments: {' '.join(argv[1:])}") @@ -236,7 +239,7 @@ def tests(argv): proc = subprocess.Popen([sys.executable, *argv], stdout=stdout, stderr=stderr) import test.server_poll - test.server_poll.run_tests() + test.server_poll.run_tests(proc) print(f"Stopping Web UI process with id {proc.pid}") proc.kill() -- cgit v1.2.1 From 084cf043900bb2c5503155ee2a24a52cc1db3eca Mon Sep 17 00:00:00 2001 From: Anas Abou Allaban Date: Sat, 12 Nov 2022 22:41:22 -0500 Subject: Fix env var names --- launch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 8e65676d..0f84b5d1 100644 --- a/launch.py +++ b/launch.py @@ -139,9 +139,9 @@ def prepare_enviroment(): xformers_windows_package = os.environ.get('XFORMERS_WINDOWS_PACKAGE', 'https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl') stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://github.com/CompVis/stable-diffusion.git") - taming_transformers_repo = os.environ.get('TAMING_REANSFORMERS_REPO', "https://github.com/CompVis/taming-transformers.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('CODEFORMET_REPO', 'https://github.com/sczhou/CodeFormer.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', "69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc") -- cgit v1.2.1 From 93d6c0209ae55632b72751cf82740e32a0cd81bc Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 13:39:22 +0300 Subject: Tests separated for github-actions CI --- launch.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 6822a01d..d0f502c2 100644 --- a/launch.py +++ b/launch.py @@ -17,6 +17,19 @@ def extract_arg(args, name): return [x for x in args if x != name], name in args +def extract_opt(args, name): + opt = None + is_present = False + if name in args: + is_present = True + idx = args.index(name) + del args[idx] + if idx < len(args) and args[idx][0] != "-": + opt = args[idx] + del args[idx] + return args, is_present, opt + + def run(command, desc=None, errdesc=None, custom_env=None): if desc is not None: print(desc) @@ -151,12 +164,11 @@ def prepare_enviroment(): blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9") sys.argv += shlex.split(commandline_args) - test_argv = [x for x in sys.argv if x != '--tests'] sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test') sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers') sys.argv, update_check = extract_arg(sys.argv, '--update-check') - sys.argv, run_tests = extract_arg(sys.argv, '--tests') + sys.argv, run_tests, test_dir = extract_opt(sys.argv, '--tests') xformers = '--xformers' in sys.argv deepdanbooru = '--deepdanbooru' in sys.argv ngrok = '--ngrok' in sys.argv @@ -222,24 +234,24 @@ def prepare_enviroment(): exit(0) if run_tests: - tests(test_argv) + tests(test_dir) exit(0) -def tests(argv): - if "--api" not in argv: - argv.append("--api") - if "--ckpt" not in argv: - argv.append("--ckpt") - argv.append("./test/test_files/empty.pt") +def tests(test_dir): + if "--api" not in sys.argv: + sys.argv.append("--api") + if "--ckpt" not in sys.argv: + sys.argv.append("--ckpt") + sys.argv.append("./test/test_files/empty.pt") - print(f"Launching Web UI in another process for testing with arguments: {' '.join(argv[1:])}") + print(f"Launching Web UI in another process for testing with arguments: {' '.join(sys.argv[1:])}") with open('test/stdout.txt', "w", encoding="utf8") as stdout, open('test/stderr.txt', "w", encoding="utf8") as stderr: - proc = subprocess.Popen([sys.executable, *argv], stdout=stdout, stderr=stderr) + proc = subprocess.Popen([sys.executable, *sys.argv], stdout=stdout, stderr=stderr) import test.server_poll - test.server_poll.run_tests(proc) + test.server_poll.run_tests(proc, test_dir) print(f"Stopping Web UI process with id {proc.pid}") proc.kill() -- cgit v1.2.1 From 0646040667b59526ac8346d53efd14dc0e75b01e Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 14:36:07 +0300 Subject: Propagate test error and try it without localhost --- launch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index d0f502c2..8ed1dffc 100644 --- a/launch.py +++ b/launch.py @@ -234,8 +234,8 @@ def prepare_enviroment(): exit(0) if run_tests: - tests(test_dir) - exit(0) + exitcode = tests(test_dir) + exit(exitcode) def tests(test_dir): @@ -251,10 +251,11 @@ def tests(test_dir): proc = subprocess.Popen([sys.executable, *sys.argv], stdout=stdout, stderr=stderr) import test.server_poll - test.server_poll.run_tests(proc, test_dir) + exitcode = test.server_poll.run_tests(proc, test_dir) print(f"Stopping Web UI process with id {proc.pid}") proc.kill() + return exitcode def start(): -- cgit v1.2.1 From 9e4f68acad4697fdf10004eb85d3f6f769c2c70b Mon Sep 17 00:00:00 2001 From: Vladimir Repin <32306715+mezotaken@users.noreply.github.com> Date: Mon, 14 Nov 2022 18:40:15 +0300 Subject: Stop exporting cl args and upload stdout and stderr as artifacts --- launch.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 8ed1dffc..ed21d0e6 100644 --- a/launch.py +++ b/launch.py @@ -244,6 +244,8 @@ def tests(test_dir): if "--ckpt" not in sys.argv: sys.argv.append("--ckpt") sys.argv.append("./test/test_files/empty.pt") + if "--skip-torch-cuda-test" not in sys.argv: + sys.argv.append("--skip-torch-cuda-test") print(f"Launching Web UI in another process for testing with arguments: {' '.join(sys.argv[1:])}") -- cgit v1.2.1 From c81d440d876dfd2ab3560410f37442ef56fc6632 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 20 Nov 2022 16:39:20 +0300 Subject: moved deepdanbooru to pure pytorch implementation --- launch.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 0f84b5d1..d2f1055c 100644 --- a/launch.py +++ b/launch.py @@ -134,7 +134,6 @@ def prepare_enviroment(): gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379") clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1") - deepdanbooru_package = os.environ.get('DEEPDANBOORU_PACKAGE', "git+https://github.com/KichangKim/DeepDanbooru.git@d91a2963bf87c6a770d74894667e9ffa9f6de7ff") xformers_windows_package = os.environ.get('XFORMERS_WINDOWS_PACKAGE', 'https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl') @@ -158,7 +157,6 @@ def prepare_enviroment(): sys.argv, update_check = extract_arg(sys.argv, '--update-check') sys.argv, run_tests = extract_arg(sys.argv, '--tests') xformers = '--xformers' in sys.argv - deepdanbooru = '--deepdanbooru' in sys.argv ngrok = '--ngrok' in sys.argv try: @@ -193,9 +191,6 @@ def prepare_enviroment(): elif platform.system() == "Linux": run_pip("install xformers", "xformers") - if not is_installed("deepdanbooru") and deepdanbooru: - run_pip(f"install {deepdanbooru_package}#egg=deepdanbooru[tensorflow] tensorflow==2.10.0 tensorflow-io==0.27.0", "deepdanbooru") - if not is_installed("pyngrok") and ngrok: run_pip("install pyngrok", "ngrok") -- cgit v1.2.1 From ce6911158b5b2f9cf79b405a1f368f875492044d Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 26 Nov 2022 16:10:46 +0300 Subject: Add support Stable Diffusion 2.0 --- launch.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index d2f1055c..b1626cb5 100644 --- a/launch.py +++ b/launch.py @@ -134,18 +134,19 @@ def prepare_enviroment(): gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379") clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1") + openclip_package = os.environ.get('OPENCLIP_PACKAGE', "git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b") xformers_windows_package = os.environ.get('XFORMERS_WINDOWS_PACKAGE', 'https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl') - stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://github.com/CompVis/stable-diffusion.git") + 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', "69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc") + stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "47b6b607fdd31875c9279cd2f4f16b92e4ea958e") taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6") - k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "60e5042ca0da89c14d1dd59d73883280f8fce991") + k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "5b3af030dd83e0297272d861c19477735d0317ec") codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af") blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9") @@ -179,6 +180,9 @@ def prepare_enviroment(): if not is_installed("clip"): run_pip(f"install {clip_package}", "clip") + if not is_installed("open_clip"): + run_pip(f"install {openclip_package}", "open_clip") + if (not is_installed("xformers") or reinstall_xformers) and xformers: if platform.system() == "Windows": if platform.python_version().startswith("3.10"): @@ -196,7 +200,7 @@ def prepare_enviroment(): os.makedirs(dir_repos, exist_ok=True) - git_clone(stable_diffusion_repo, repo_dir('stable-diffusion'), "Stable Diffusion", stable_diffusion_commit_hash) + 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) -- cgit v1.2.1 From 89d8804768d4479d72d24ebbbd2bd00650ef5dc7 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 27 Nov 2022 18:48:08 +0300 Subject: only run install.py for enabled extensions --- launch.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index c426e673..ad9ddd5a 100644 --- a/launch.py +++ b/launch.py @@ -5,6 +5,8 @@ import sys import importlib.util import shlex import platform +import argparse +import json dir_repos = "repositories" dir_extensions = "extensions" @@ -132,11 +134,26 @@ def run_extension_installer(extension_dir): print(e, file=sys.stderr) -def run_extensions_installers(): +def list_extensions(settings_file): + settings = {} + + try: + 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) + + disabled_extensions = set(settings.get('disabled_extensions', [])) + + return [x for x in os.listdir(dir_extensions) if x not in disabled_extensions] + + +def run_extensions_installers(settings_file): if not os.path.isdir(dir_extensions): return - for dirname_extension in os.listdir(dir_extensions): + for dirname_extension in list_extensions(settings_file): run_extension_installer(os.path.join(dir_extensions, dirname_extension)) @@ -165,6 +182,10 @@ def prepare_enviroment(): sys.argv += shlex.split(commandline_args) + parser = argparse.ArgumentParser() + parser.add_argument("--ui-settings-file", type=str, help="filename to use for ui settings", default='config.json') + args, _ = parser.parse_known_args(sys.argv) + sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test') sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers') sys.argv, update_check = extract_arg(sys.argv, '--update-check') @@ -223,7 +244,7 @@ def prepare_enviroment(): run_pip(f"install -r {requirements_file}", "requirements for Web UI") - run_extensions_installers() + run_extensions_installers(settings_file=args.ui_settings_file) if update_check: version_check(commit) -- cgit v1.2.1 From 79953e9b8b0d04868b719452a5b250c450f757b6 Mon Sep 17 00:00:00 2001 From: brkirch Date: Thu, 1 Dec 2022 03:38:13 -0500 Subject: Add support for macOS (Darwin) in launch.py --- launch.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index ad9ddd5a..48314264 100644 --- a/launch.py +++ b/launch.py @@ -193,6 +193,20 @@ def prepare_enviroment(): xformers = '--xformers' in sys.argv ngrok = '--ngrok' in sys.argv + if platform.system() == 'Darwin': + os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" + torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1 torchvision==0.13.1") + k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'https://github.com/brkirch/k-diffusion.git') + k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "51c9778f269cedb55a4d88c79c0246d35bdadb71") + if os.environ.get('COMMANDLINE_ARGS') == None: + if '--use-cpu' in sys.argv: + idx = sys.argv.index('--use-cpu') + if idx < len(sys.argv) and sys.argv[idx+1][0] != '-': + sys.argv.insert(idx+1, 'interrogate') + else: + sys.argv += ['--use-cpu', 'interrogate'] + sys.argv.append('--no-half') + try: commit = run(f"{git} rev-parse HEAD").strip() except Exception: @@ -204,7 +218,7 @@ def prepare_enviroment(): if not is_installed("torch") or not is_installed("torchvision"): run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") - if not skip_torch_cuda_test: + if not skip_torch_cuda_test and platform.system() != 'Darwin': run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'") if not is_installed("gfpgan"): @@ -231,6 +245,9 @@ def prepare_enviroment(): if not is_installed("pyngrok") and ngrok: run_pip("install pyngrok", "ngrok") + if platform.system() == 'Darwin' and not is_installed("psutil"): + run_pip("install psutil", "psutil") + os.makedirs(dir_repos, exist_ok=True) git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash) -- cgit v1.2.1 From bef36597cc46671eeb2041b0343bd5e183883eb7 Mon Sep 17 00:00:00 2001 From: brkirch Date: Thu, 1 Dec 2022 04:04:14 -0500 Subject: Fix run as root flag Even though -f enables running webui.sh as root, the -f flag will also be passed to launch.py, causing it to exit with a usage message. This adds a line to launch.py to remove the -f flag if present. In addition to the above, all the letters in the command line arguments after each '-' were being processed for 'f' and "illegal option" was displayed for each letter that didn't match. Instead, this commit silences those errors and stops processing if the first flag doesn't start with '-f'. --- launch.py | 1 + 1 file changed, 1 insertion(+) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 48314264..1661b569 100644 --- a/launch.py +++ b/launch.py @@ -186,6 +186,7 @@ def prepare_enviroment(): parser.add_argument("--ui-settings-file", type=str, help="filename to use for ui settings", default='config.json') args, _ = parser.parse_known_args(sys.argv) + sys.argv, _ = extract_arg(sys.argv, '-f') sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test') sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers') sys.argv, update_check = extract_arg(sys.argv, '--update-check') -- cgit v1.2.1 From b7ef99634c3f862e835527f8d11c4996eb4f4eec Mon Sep 17 00:00:00 2001 From: Hsiang-Cheng Yang Date: Sat, 3 Dec 2022 17:35:17 +0800 Subject: Update launch.py fix a typo --- launch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index ad9ddd5a..90b5d99a 100644 --- a/launch.py +++ b/launch.py @@ -157,7 +157,7 @@ def run_extensions_installers(settings_file): run_extension_installer(os.path.join(dir_extensions, dirname_extension)) -def prepare_enviroment(): +def prepare_environment(): torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") commandline_args = os.environ.get('COMMANDLINE_ARGS', "") @@ -290,5 +290,5 @@ def start(): if __name__ == "__main__": - prepare_enviroment() + prepare_environment() start() -- cgit v1.2.1 From 5ec8981df46ff6e678c09dd2c1bf4d873ac22a46 Mon Sep 17 00:00:00 2001 From: brkirch Date: Sat, 3 Dec 2022 02:28:53 -0500 Subject: Revert most launch.py changes, add mac user script Adds an addition file to read environment variables from when the webui.sh is run from macOS. --- launch.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 1661b569..0e1bbaf2 100644 --- a/launch.py +++ b/launch.py @@ -194,20 +194,6 @@ def prepare_enviroment(): xformers = '--xformers' in sys.argv ngrok = '--ngrok' in sys.argv - if platform.system() == 'Darwin': - os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" - torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1 torchvision==0.13.1") - k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'https://github.com/brkirch/k-diffusion.git') - k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "51c9778f269cedb55a4d88c79c0246d35bdadb71") - if os.environ.get('COMMANDLINE_ARGS') == None: - if '--use-cpu' in sys.argv: - idx = sys.argv.index('--use-cpu') - if idx < len(sys.argv) and sys.argv[idx+1][0] != '-': - sys.argv.insert(idx+1, 'interrogate') - else: - sys.argv += ['--use-cpu', 'interrogate'] - sys.argv.append('--no-half') - try: commit = run(f"{git} rev-parse HEAD").strip() except Exception: @@ -219,7 +205,7 @@ def prepare_enviroment(): if not is_installed("torch") or not is_installed("torchvision"): run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") - if not skip_torch_cuda_test and platform.system() != 'Darwin': + if not skip_torch_cuda_test: run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'") if not is_installed("gfpgan"): @@ -246,9 +232,6 @@ def prepare_enviroment(): if not is_installed("pyngrok") and ngrok: run_pip("install pyngrok", "ngrok") - if platform.system() == 'Darwin' and not is_installed("psutil"): - run_pip("install psutil", "psutil") - os.makedirs(dir_repos, exist_ok=True) git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash) -- cgit v1.2.1