Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify install #77

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions modules/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,13 @@ 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}")
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
if os.environ.get("USE_OPENVINO") == "1":
torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==2.1.0 torchvision==0.16.0")
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
else:
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}")
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")

xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.20')
clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip")
Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ tomesd
torch
torchdiffeq
torchsde
transformers==4.30.0
diffusers==0.21.1
openvino==2023.1.0.dev20230811
diffusers
openvino
invisible-watermark
transformers==4.30.2
transformers

5 changes: 3 additions & 2 deletions requirements_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fastapi==0.94.0
gfpgan==1.3.8
gradio==3.41.2
httpcore==0.15
httpx==0.24.1
inflection==0.5.1
jsonmerge==1.8.0
kornia==0.6.7
Expand All @@ -29,8 +30,8 @@ torch
torchdiffeq==0.2.3
torchsde==0.2.5
transformers==4.30.2
diffusers==0.21.1
openvino==2023.1.0.dev20230811
diffusers==0.23.0
openvino==2023.2.0
invisible-watermark


17 changes: 16 additions & 1 deletion scripts/openvino_accelerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@
AutoencoderKL,
)

#ignore future warnings
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

##hack eval_frame.py for windows support, could be removed after official windows support from pytorch
def check_if_dynamo_supported():
import sys
# Skip checking for Windows support for the OpenVINO backend
if sys.version_info >= (3, 12):
raise RuntimeError("Python 3.12+ not yet supported for torch.compile")

torch._dynamo.eval_frame.check_if_dynamo_supported = check_if_dynamo_supported




## hack for pytorch
def BUILD_MAP_UNPACK(self, inst):
Expand Down Expand Up @@ -801,7 +816,7 @@ def infotext(iteration=0, position_in_batch=0):
cn_params = p.extra_generation_params[key]
cn_param_elements = [part.strip() for part in cn_params.split(', ')]
for element in cn_param_elements:
if (element.split(':')[0] == "Model"):
if (element.split(':')[0] == "model"):
cn_model = (element.split(':')[1]).split(' ')[1]

if (cn_model != "None"):
Expand Down
2 changes: 1 addition & 1 deletion torch-install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@



start /wait cmd /k "%cd%\venv\Scripts\activate && pip install torch==2.1.0 torchvision==0.16.0 https://github.com/cavusmustafa/openvino/raw/custom_sdpa_optimizations/openvino-2023.2.0-12829-cp310-cp310-win_amd64.whl imageio --force-reinstall && exit"
start /wait cmd /k "%cd%\venv\Scripts\activate && pip install torch==2.1.0 torchvision==0.16.0 openvino-nightly==2023.2.0.dev20231031 imageio --force-reinstall && exit"

echo torch 2.1.0 dev installation completed.

Expand Down
6 changes: 5 additions & 1 deletion webui-user.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=
set COMMANDLINE_ARGS=--skip-torch-cuda-test --precision full --no-half
set PYTORCH_TRACING_MODE=TORCHFX
set USE_OPENVINO=1

call webui.bat