Skip to content

Commit

Permalink
simplify installation process
Browse files Browse the repository at this point in the history
  • Loading branch information
qiacheng committed Nov 16, 2023
1 parent 76414f8 commit 9241c00
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
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
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ tomesd
torch
torchdiffeq
torchsde
diffusers==0.21.1
openvino==2023.1.0.dev20230811
diffusers
openvino
invisible-watermark
transformers==4.30.2
transformers

4 changes: 2 additions & 2 deletions requirements_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,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
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

0 comments on commit 9241c00

Please sign in to comment.