Skip to content

Commit

Permalink
simplify installation
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
qiacheng authored Nov 16, 2023
2 parents f2a35b8 + ed6be6e commit 4400629
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 74 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


18 changes: 17 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 @@ -121,6 +136,7 @@ def openvino_fx(subgraph, example_inputs):
try:
executor_parameters = None
inputs_reversed = False
maybe_fs_cached_name = None
if os.getenv("OPENVINO_TORCH_MODEL_CACHING") is not None:
# Create a hash to be used for caching
model_hash_str = sha256(subgraph.code.encode('utf-8')).hexdigest()
Expand Down Expand Up @@ -801,7 +817,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
13 changes: 0 additions & 13 deletions torch-install.bat

This file was deleted.

51 changes: 0 additions & 51 deletions torch-install.ps1

This file was deleted.

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 4400629

Please sign in to comment.