From 79d261b7d47e75a93f38e04608508102dded6a6c Mon Sep 17 00:00:00 2001 From: high_byte Date: Wed, 15 Mar 2023 19:44:30 +0200 Subject: disable gradio analytics globally --- launch.py | 1 + 1 file changed, 1 insertion(+) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 0868f8a9..2b2d3128 100644 --- a/launch.py +++ b/launch.py @@ -16,6 +16,7 @@ index_url = os.environ.get('INDEX_URL', "") stored_commit_hash = None skip_install = False +os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False' def check_python_version(): is_windows = platform.system() == "Windows" -- cgit v1.2.3 From b9a66b02d0b8ca1c3364d9410198530682fd2f6c Mon Sep 17 00:00:00 2001 From: nonnonstop <42905588+nonnonstop@users.noreply.github.com> Date: Sun, 19 Mar 2023 01:17:04 +0900 Subject: Fix problem of install.py when data-dir is specified --- launch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index b943fed2..95311d33 100644 --- a/launch.py +++ b/launch.py @@ -14,7 +14,7 @@ parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.real args, _ = parser.parse_known_args(sys.argv) script_path = os.path.dirname(__file__) -data_path = os.getcwd() +data_path = args.data_dir dir_repos = "repositories" dir_extensions = "extensions" @@ -231,7 +231,7 @@ def run_extensions_installers(settings_file): return for dirname_extension in list_extensions(settings_file): - run_extension_installer(os.path.join(dir_extensions, dirname_extension)) + run_extension_installer(os.path.join(data_path, dir_extensions, dirname_extension)) def prepare_environment(): -- cgit v1.2.3 From c1294d849a50b9b2995aa257adbb918837c4b384 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 25 Mar 2023 12:21:18 +0300 Subject: make it possible for user to enable gradio analytics by setting GRADIO_ANALYTICS_ENABLED=True --- launch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 0397ca06..5f836d22 100644 --- a/launch.py +++ b/launch.py @@ -24,7 +24,8 @@ index_url = os.environ.get('INDEX_URL', "") stored_commit_hash = None skip_install = False -os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False' +if 'GRADIO_ANALYTICS_ENABLED' not in os.environ: + os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False' def check_python_version(): is_windows = platform.system() == "Windows" -- cgit v1.2.3 From 8c801362b43013a628c58f0c1276e076ee48227d Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 25 Mar 2023 16:05:12 +0300 Subject: split commandline args into its own file make launch.py use the same command line argument parser as the main program --- launch.py | 77 +++++++++++++++++++-------------------------------------------- 1 file changed, 23 insertions(+), 54 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 5f836d22..c41ae82d 100644 --- a/launch.py +++ b/launch.py @@ -5,28 +5,27 @@ import sys import importlib.util import shlex import platform -import argparse import json -parser = argparse.ArgumentParser(add_help=False) -parser.add_argument("--ui-settings-file", type=str, default='config.json') -parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.realpath(__file__))) -args, _ = parser.parse_known_args(sys.argv) +from modules import cmd_args +from modules.paths_internal import script_path, extensions_dir -script_path = os.path.dirname(__file__) -data_path = args.data_dir +commandline_args = os.environ.get('COMMANDLINE_ARGS', "") +sys.argv += shlex.split(commandline_args) + +args, _ = cmd_args.parser.parse_known_args() -dir_repos = "repositories" -dir_extensions = "extensions" python = sys.executable git = os.environ.get('GIT', "git") index_url = os.environ.get('INDEX_URL', "") stored_commit_hash = None skip_install = False +dir_repos = "repositories" if 'GRADIO_ANALYTICS_ENABLED' not in os.environ: os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False' + def check_python_version(): is_windows = platform.system() == "Windows" major = sys.version_info.major @@ -72,23 +71,6 @@ def commit_hash(): return stored_commit_hash -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, live=False): if desc is not None: print(desc) @@ -225,15 +207,15 @@ def list_extensions(settings_file): disabled_extensions = set(settings.get('disabled_extensions', [])) - return [x for x in os.listdir(os.path.join(data_path, dir_extensions)) if x not in disabled_extensions] + return [x for x in os.listdir(extensions_dir) if x not in disabled_extensions] def run_extensions_installers(settings_file): - if not os.path.isdir(dir_extensions): + if not os.path.isdir(extensions_dir): return for dirname_extension in list_extensions(settings_file): - run_extension_installer(os.path.join(data_path, dir_extensions, dirname_extension)) + run_extension_installer(os.path.join(extensions_dir, dirname_extension)) def prepare_environment(): @@ -241,7 +223,6 @@ def prepare_environment(): torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") - commandline_args = os.environ.get('COMMANDLINE_ARGS', "") xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.16rc425') gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379") @@ -260,21 +241,7 @@ def prepare_environment(): codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af") blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9") - sys.argv += shlex.split(commandline_args) - - sys.argv, _ = extract_arg(sys.argv, '-f') - sys.argv, update_all_extensions = extract_arg(sys.argv, '--update-all-extensions') - sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test') - sys.argv, skip_python_version_check = extract_arg(sys.argv, '--skip-python-version-check') - sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers') - sys.argv, reinstall_torch = extract_arg(sys.argv, '--reinstall-torch') - sys.argv, update_check = extract_arg(sys.argv, '--update-check') - sys.argv, run_tests, test_dir = extract_opt(sys.argv, '--tests') - sys.argv, skip_install = extract_arg(sys.argv, '--skip-install') - xformers = '--xformers' in sys.argv - ngrok = '--ngrok' in sys.argv - - if not skip_python_version_check: + if not args.skip_python_version_check: check_python_version() commit = commit_hash() @@ -282,10 +249,10 @@ def prepare_environment(): print(f"Python {sys.version}") print(f"Commit hash: {commit}") - if reinstall_torch or not is_installed("torch") or not is_installed("torchvision"): + if args.reinstall_torch or not is_installed("torch") or not is_installed("torchvision"): run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True) - if not skip_torch_cuda_test: + if not args.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"): @@ -297,7 +264,7 @@ def prepare_environment(): 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 (not is_installed("xformers") or args.reinstall_xformers) and args.xformers: if platform.system() == "Windows": if platform.python_version().startswith("3.10"): run_pip(f"install -U -I --no-deps {xformers_package}", "xformers") @@ -309,7 +276,7 @@ def prepare_environment(): elif platform.system() == "Linux": run_pip(f"install {xformers_package}", "xformers") - if not is_installed("pyngrok") and ngrok: + if not is_installed("pyngrok") and args.ngrok: run_pip("install pyngrok", "ngrok") os.makedirs(os.path.join(script_path, dir_repos), exist_ok=True) @@ -329,18 +296,18 @@ def prepare_environment(): run_extensions_installers(settings_file=args.ui_settings_file) - if update_check: + if args.update_check: version_check(commit) - if update_all_extensions: - git_pull_recursive(os.path.join(data_path, dir_extensions)) + if args.update_all_extensions: + git_pull_recursive(extensions_dir) if "--exit" in sys.argv: print("Exiting because of --exit argument") exit(0) - if run_tests: - exitcode = tests(test_dir) + if args.tests and not args.no_tests: + exitcode = tests(args.tests) exit(exitcode) @@ -354,6 +321,8 @@ def tests(test_dir): sys.argv.append("--skip-torch-cuda-test") if "--disable-nan-check" not in sys.argv: sys.argv.append("--disable-nan-check") + if "--no-tests" not in sys.argv: + sys.argv.append("--no-tests") print(f"Launching Web UI in another process for testing with arguments: {' '.join(sys.argv[1:])}") -- cgit v1.2.3 From 8a34671fe91e142bce9e5556cca2258b3be9dd6e Mon Sep 17 00:00:00 2001 From: MrCheeze Date: Fri, 24 Mar 2023 22:48:16 -0400 Subject: Add support for the Variations models (unclip-h and unclip-l) --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index b943fed2..e70df7ba 100644 --- a/launch.py +++ b/launch.py @@ -252,7 +252,7 @@ def prepare_environment(): 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', "47b6b607fdd31875c9279cd2f4f16b92e4ea958e") + 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', "5b3af030dd83e0297272d861c19477735d0317ec") codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af") -- cgit v1.2.3 From 2a4d3d21242dcc8b2b9cef85aa8f4227e855dc96 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Mon, 27 Mar 2023 12:04:45 -0400 Subject: Add temporary "disable all extensions" option for debugging use --- launch.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'launch.py') diff --git a/launch.py b/launch.py index c41ae82d..1321b77a 100644 --- a/launch.py +++ b/launch.py @@ -206,6 +206,10 @@ def list_extensions(settings_file): print(e, file=sys.stderr) disabled_extensions = set(settings.get('disabled_extensions', [])) + disable_all_extensions = settings.get('disable_all_extensions', False) + + if disable_all_extensions: + return [] return [x for x in os.listdir(extensions_dir) if x not in disabled_extensions] -- cgit v1.2.3 From fc8e1008ea93f98554907f25aaf52f24ce661847 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Mon, 27 Mar 2023 12:44:49 -0400 Subject: Make disable configurable between builtin/extra extensions --- launch.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 1321b77a..c41ae82d 100644 --- a/launch.py +++ b/launch.py @@ -206,10 +206,6 @@ def list_extensions(settings_file): print(e, file=sys.stderr) disabled_extensions = set(settings.get('disabled_extensions', [])) - disable_all_extensions = settings.get('disable_all_extensions', False) - - if disable_all_extensions: - return [] return [x for x in os.listdir(extensions_dir) if x not in disabled_extensions] -- cgit v1.2.3 From 56f62d3851ff08dc1574a9ff2a05271f3730f3f7 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Mon, 27 Mar 2023 17:23:20 -0400 Subject: Skip extension installers if all disabled --- launch.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'launch.py') diff --git a/launch.py b/launch.py index c41ae82d..2e3cd4c4 100644 --- a/launch.py +++ b/launch.py @@ -206,6 +206,10 @@ def list_extensions(settings_file): print(e, file=sys.stderr) disabled_extensions = set(settings.get('disabled_extensions', [])) + disable_all_extensions = settings.get('disable_all_extensions', 'none') + + if disable_all_extensions != 'none': + return [] return [x for x in os.listdir(extensions_dir) if x not in disabled_extensions] -- cgit v1.2.3 From d5063e07e8b4737621978feffd37b18077b9ea64 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 30 Mar 2023 10:57:54 -0400 Subject: update torch --- launch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 68e08114..37c8b516 100644 --- a/launch.py +++ b/launch.py @@ -225,10 +225,10 @@ def run_extensions_installers(settings_file): def prepare_environment(): global skip_install - torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117") + torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") - xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.16rc425') + xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17') 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") @@ -296,7 +296,7 @@ def prepare_environment(): if not os.path.isfile(requirements_file): requirements_file = os.path.join(script_path, requirements_file) - run_pip(f"install -r \"{requirements_file}\"", "requirements for Web UI") + run_pip(f"install -r \"{requirements_file}\"", "requirements") run_extensions_installers(settings_file=args.ui_settings_file) -- cgit v1.2.3 From 4fa59b045add1d23350e884e201dc77bc34864e6 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 3 Apr 2023 15:23:35 -0400 Subject: update xformers --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 37c8b516..c5ae9092 100644 --- a/launch.py +++ b/launch.py @@ -228,7 +228,7 @@ def prepare_environment(): torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118") 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.18') 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") -- cgit v1.2.3 From 80752f43b22acd85bf6ab54b2e4788f144a0c813 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 4 Apr 2023 17:27:27 -0400 Subject: revert xformers --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index c5ae9092..37c8b516 100644 --- a/launch.py +++ b/launch.py @@ -228,7 +228,7 @@ def prepare_environment(): torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") - xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.18') + xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17') 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") -- cgit v1.2.3 From 7fb72edaffd3d4f2336d2478a424fc455f2376a6 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 13 Apr 2023 06:47:48 -0400 Subject: change index url --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 37c8b516..4256ef25 100644 --- a/launch.py +++ b/launch.py @@ -225,7 +225,7 @@ def run_extensions_installers(settings_file): def prepare_environment(): global skip_install - torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118") + torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17') -- cgit v1.2.3 From ee71eee1818f6f6eba9895c93ba25e0cad27e069 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 29 Apr 2023 12:36:50 +0300 Subject: stuff related to torch version change --- launch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 4256ef25..af1c8309 100644 --- a/launch.py +++ b/launch.py @@ -121,12 +121,12 @@ def run_python(code, desc=None, errdesc=None): return run(f'"{python}" -c "{code}"', desc, errdesc) -def run_pip(args, desc=None): +def run_pip(args, desc=None, live=False): if skip_install: return index_url_line = f' --index-url {index_url}' if index_url != '' else '' - return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") + return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live) def check_run_python(code): @@ -225,7 +225,7 @@ def run_extensions_installers(settings_file): def prepare_environment(): global skip_install - torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118") + torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==2.0.0 torchvision==0.15.1 --index-url https://download.pytorch.org/whl/cu118") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17') @@ -271,7 +271,7 @@ def prepare_environment(): if (not is_installed("xformers") or args.reinstall_xformers) and args.xformers: if platform.system() == "Windows": if platform.python_version().startswith("3.10"): - run_pip(f"install -U -I --no-deps {xformers_package}", "xformers") + run_pip(f"install -U -I --no-deps {xformers_package}", "xformers", live=True) else: print("Installation of xformers is not supported in this version of Python.") print("You can also check this and build manually: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers#building-xformers-on-windows-by-duckness") -- cgit v1.2.3