Skip to content

Commit

Permalink
special commit for project runtime optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
jahangir091 committed Dec 10, 2023
1 parent e824361 commit 7484579
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 59 deletions.
2 changes: 1 addition & 1 deletion extensions/Text2Video-Zero-sd-webui/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 1 addition & 1 deletion extensions/arifScratchRemoverWebUIExtention/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
import subprocess
import launch

launch.run_pip(f"install -r \"{os.path.join(ext_dir, 'requirements.txt')}\"", "requirements for arifScratchRemoverWebUIExtention")
# launch.run_pip(f"install -r \"{os.path.join(ext_dir, 'requirements.txt')}\"", "requirements for arifScratchRemoverWebUIExtention")
98 changes: 49 additions & 49 deletions extensions/sd-face-fusion-extension/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
# 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.")
4 changes: 2 additions & 2 deletions extensions/sd-webui-cleaner/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

6 changes: 4 additions & 2 deletions modules/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
38 changes: 35 additions & 3 deletions requirements_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion webui-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7484579

Please sign in to comment.