From 7484579892550305140cd94ce053a29df9aee985 Mon Sep 17 00:00:00 2001 From: jahangir Date: Sun, 10 Dec 2023 15:28:48 +0600 Subject: [PATCH] special commit for project runtime optimization --- .../Text2Video-Zero-sd-webui/install.py | 2 +- .../install.py | 2 +- .../sd-face-fusion-extension/install.py | 98 +++++++++---------- extensions/sd-webui-cleaner/install.py | 4 +- modules/launch_utils.py | 6 +- requirements_versions.txt | 38 ++++++- webui-user.sh | 2 +- 7 files changed, 93 insertions(+), 59 deletions(-) diff --git a/extensions/Text2Video-Zero-sd-webui/install.py b/extensions/Text2Video-Zero-sd-webui/install.py index 0f1040a9..001d5104 100644 --- a/extensions/Text2Video-Zero-sd-webui/install.py +++ b/extensions/Text2Video-Zero-sd-webui/install.py @@ -25,4 +25,4 @@ import subprocess import launch -launch.run_pip(f"install -r \"{os.path.join(ext_dir, 'requirements.txt')}\"", "requirements for Text2Video-Zero") +# launch.run_pip(f"install -r \"{os.path.join(ext_dir, 'requirements.txt')}\"", "requirements for Text2Video-Zero") diff --git a/extensions/arifScratchRemoverWebUIExtention/install.py b/extensions/arifScratchRemoverWebUIExtention/install.py index 0d86b5c8..e7940c2c 100644 --- a/extensions/arifScratchRemoverWebUIExtention/install.py +++ b/extensions/arifScratchRemoverWebUIExtention/install.py @@ -25,4 +25,4 @@ import subprocess import launch -launch.run_pip(f"install -r \"{os.path.join(ext_dir, 'requirements.txt')}\"", "requirements for arifScratchRemoverWebUIExtention") \ No newline at end of file +# launch.run_pip(f"install -r \"{os.path.join(ext_dir, 'requirements.txt')}\"", "requirements for arifScratchRemoverWebUIExtention") \ No newline at end of file diff --git a/extensions/sd-face-fusion-extension/install.py b/extensions/sd-face-fusion-extension/install.py index a0a81ab6..5add05e8 100644 --- a/extensions/sd-face-fusion-extension/install.py +++ b/extensions/sd-face-fusion-extension/install.py @@ -19,52 +19,52 @@ def _get_installed_version(package: str) -> str | None: return None -if not launch.is_installed("onnxruntime") and not launch.is_installed("onnxruntime-gpu"): - import torch.cuda as cuda - - if cuda.is_available(): - launch.run_pip("install 'onnxruntime-gpu>=1.16.0'") - else: - launch.run_pip("install 'onnxruntime>=1.16.0'") - - -with _REQUIREMENT_PATH.open() as fp: - for requirement in fp: - try: - requirement = requirement.strip() - if "==" in requirement: - name, version = requirement.split("==", 1) - installed_version = _get_installed_version(name) - - if installed_version == version: - continue - - launch.run_pip( - f'install -U "{requirement}"', - f"sd-webui-facefusion requirement: changing {name} version from {installed_version} to {version}", - ) - continue - - if ">=" in requirement: - name, version = requirement.split(">=", 1) - installed_version = _get_installed_version(name) - - if installed_version and ( - _get_comparable_version(installed_version) >= _get_comparable_version(version) - ): - continue - - launch.run_pip( - f'install -U "{requirement}"', - f"sd-webui-facefusion requirement: changing {name} version from {installed_version} to {version}", - ) - continue - - if not launch.is_installed(requirement): - launch.run_pip( - f'install "{requirement}"', - f"sd-webui-facefusion requirement: {requirement}", - ) - except Exception as error: - print(error) - print(f"Warning: Failed to install '{requirement}', some preprocessors may not work.") \ No newline at end of file +# if not launch.is_installed("onnxruntime") and not launch.is_installed("onnxruntime-gpu"): +# import torch.cuda as cuda +# +# if cuda.is_available(): +# launch.run_pip("install 'onnxruntime-gpu>=1.16.0'") +# else: +# launch.run_pip("install 'onnxruntime>=1.16.0'") + + +# with _REQUIREMENT_PATH.open() as fp: +# for requirement in fp: +# try: +# requirement = requirement.strip() +# if "==" in requirement: +# name, version = requirement.split("==", 1) +# installed_version = _get_installed_version(name) +# +# if installed_version == version: +# continue +# +# launch.run_pip( +# f'install -U "{requirement}"', +# f"sd-webui-facefusion requirement: changing {name} version from {installed_version} to {version}", +# ) +# continue +# +# if ">=" in requirement: +# name, version = requirement.split(">=", 1) +# installed_version = _get_installed_version(name) +# +# if installed_version and ( +# _get_comparable_version(installed_version) >= _get_comparable_version(version) +# ): +# continue +# +# launch.run_pip( +# f'install -U "{requirement}"', +# f"sd-webui-facefusion requirement: changing {name} version from {installed_version} to {version}", +# ) +# continue +# +# if not launch.is_installed(requirement): +# launch.run_pip( +# f'install "{requirement}"', +# f"sd-webui-facefusion requirement: {requirement}", +# ) +# except Exception as error: +# print(error) +# print(f"Warning: Failed to install '{requirement}', some preprocessors may not work.") \ No newline at end of file diff --git a/extensions/sd-webui-cleaner/install.py b/extensions/sd-webui-cleaner/install.py index 206a3097..284559c7 100644 --- a/extensions/sd-webui-cleaner/install.py +++ b/extensions/sd-webui-cleaner/install.py @@ -2,6 +2,6 @@ # TODO: add pip dependency if need extra module only on extension -if not launch.is_installed("litelama"): - launch.run_pip("install litelama==0.1.7") +# if not launch.is_installed("litelama"): +# launch.run_pip("install litelama==0.1.7") \ No newline at end of file diff --git a/modules/launch_utils.py b/modules/launch_utils.py index 6e54d063..67f60ac5 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -309,10 +309,12 @@ def requirements_met(requirements_file): def prepare_environment(): torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu118") - torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url {torch_index_url}") + # torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url {torch_index_url}") + torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.1.1 torchvision==0.16.1 --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.20') + # xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.20') + xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.23') 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") diff --git a/requirements_versions.txt b/requirements_versions.txt index 8568ff4c..e72aaf4e 100644 --- a/requirements_versions.txt +++ b/requirements_versions.txt @@ -15,14 +15,14 @@ kornia==0.6.7 lark==1.1.2 numpy==1.23.5 omegaconf==2.2.3 -open-clip-torch==2.20.0 +#open-clip-torch==2.20.0 piexif==1.1.3 psutil==5.9.5 pytorch_lightning==1.9.4 realesrgan==0.3.0 resize-right==0.0.2 safetensors==0.3.1 -scikit-image==0.21.0 +#scikit-image==0.21.0 timm==0.9.2 tomesd==0.1.3 torch @@ -39,5 +39,37 @@ tensorboardX ffmpeg ffmpeg-python yt-dlp -opencv-python +#opencv-python Pillow + +#-----------------------------requirements for scratch remove extension---------------------------------------- +glob2==0.5 +#xformers +scipy==1.11.4 +ftfy==6.1.3 +controlnet-aux==0.0.6 +easydict==1.11 + +#-----------------------------requirements for facefusion remove extension-------------------------------------------- +insightface>=0.7.3 +onnx>=1.14.1 +onnxruntime-gpu>=1.16.0 +opennsfw2>=0.10.2 +tensorflow>=2.13.0 +tensorflow[and-cuda] +#opencv-python==4.8.0.74 + +#-----------------------------requirements for text2video extension------------------------------------------------- +decord==0.6.0 +diffusers==0.14.0 +moviepy==1.0.3 +open_clip_torch==2.16.0 +opencv_python==4.7.0.72 +opencv-contrib-python==4.7.0.72 +prettytable==3.6.0 +scikit_image==0.19.3 +beautifulsoup4 +bs4 + +#-----------------------------requirements for lama cleaner extension------------------------------------------------- +litelama==0.1.7 \ No newline at end of file diff --git a/webui-user.sh b/webui-user.sh index 0e5068af..1e1a0c49 100644 --- a/webui-user.sh +++ b/webui-user.sh @@ -11,7 +11,7 @@ # Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention" -export COMMANDLINE_ARGS="--listen --port 8004 --api --enable-insecure-extension-access --reinstall-torch --loglevel 'DEBUG' --api-log --log-startup --nowebui --timeout-keep-alive 120 --disable-safe-unpickle" +export COMMANDLINE_ARGS="--listen --port 8004 --api --enable-insecure-extension-access --loglevel 'DEBUG' --api-log --log-startup --timeout-keep-alive 120 --disable-safe-unpickle" # python3 executable #python_cmd="python3"