simplify installation process

This commit is contained in:
Qiacheng 2023-11-16 10:28:54 -08:00
parent 76414f8ead
commit 9241c00e12
5 changed files with 33 additions and 10 deletions

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -63,6 +63,21 @@ from diffusers import (
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):
@ -801,7 +816,7 @@ def process_images_openvino(p: StableDiffusionProcessing, model_config, vae_ckpt
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"):

View File

@ -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