From 92baeae55dd58e96234eac02de506ca8171e6a7d Mon Sep 17 00:00:00 2001 From: Disty0 Date: Thu, 14 Dec 2023 01:01:45 +0300 Subject: [PATCH] IPEX bundle in MKL and DPCPP --- CHANGELOG.md | 4 +++- installer.py | 13 ++++--------- webui.sh | 12 +++--------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ca24915..4198185dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,9 @@ - **Extra networks** new *settting -> extra networks -> build info on first access* indexes all networks on first access instead of server startup - **IPEX** - - Update to **Torch 2.1 - This Update Requires Intel OneApi 2024.0**, thanks @disty0 + - Update to **Torch 2.1**, thanks @disty0 + - Built-in *MKL* and *DPCPP* for IPEX, thanks @disty0 + No need to install OneAPI anymore - Fix IPEX Optimize not applying with Diffusers backend, thanks @disty0 - Disable 32 bit workarounds if the GPU supports 64 bit, thanks @disty0 - More compatibility improvements, thanks @disty0 diff --git a/installer.py b/installer.py index bb957f9b4..c6725287b 100644 --- a/installer.py +++ b/installer.py @@ -423,14 +423,10 @@ def check_torch(): log.info('Intel OneAPI Toolkit detected') os.environ.setdefault('NEOReadDebugKeys', '1') os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100') - if "linux" in sys.platform: - torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.1.0a0 torchvision==0.16.0a0 intel-extension-for-pytorch==2.1.10+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/') - os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.13.0 intel-extension-for-tensorflow[gpu]') - else: - pytorch_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torch-2.0.0a0+gite9ebda2-cp310-cp310-win_amd64.whl' - torchvision_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl' - ipex_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/intel_extension_for_pytorch-2.0.110+gitc6ea20b-cp310-cp310-win_amd64.whl' - torch_command = os.environ.get('TORCH_COMMAND', f'{pytorch_pip} {torchvision_pip} {ipex_pip}') + torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.1.0a0 torchvision==0.16.0a0 intel-extension-for-pytorch==2.1.10+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/') + os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.13.0 intel-extension-for-tensorflow[gpu]') + install('mkl==2024.0.0', 'mkl') + install('mkl-dpcpp==2024.0.0', 'mkl-dpcpp') install('openvino', 'openvino', ignore=True) install('onnxruntime-openvino', 'onnxruntime-openvino', ignore=True) elif allow_openvino and args.use_openvino: @@ -503,7 +499,6 @@ def check_torch(): if opts.get('cuda_compile_backend', '') == 'hidet': install('hidet', 'hidet') if args.use_openvino or opts.get('cuda_compile_backend', '') == 'openvino_fx': - uninstall('openvino-nightly') # TODO openvino: remove after people had enough time upgrading install('openvino==2023.2.0', 'openvino') install('onnxruntime-openvino', 'onnxruntime-openvino', ignore=True) # TODO openvino: numpy version conflicts with tensorflow and doesn't support Python 3.11 os.environ.setdefault('PYTORCH_TRACING_MODE', 'TORCHFX') diff --git a/webui.sh b/webui.sh index 692cc36c1..cec7fb960 100755 --- a/webui.sh +++ b/webui.sh @@ -80,22 +80,16 @@ else exit 1 fi -#Set OneAPI environmet if it's not set by the user -if ([[ "$@" == *"--use-ipex"* ]] || [[ -d "/opt/intel/oneapi" ]] || [[ ! -z "$ONEAPI_ROOT" ]]) && [ ! -x "$(command -v sycl-ls)" ] +if [ -d "$(realpath "$venv_dir")/lib/" ] then - echo "Setting OneAPI environment" - if [[ -z "$ONEAPI_ROOT" ]] - then - ONEAPI_ROOT=/opt/intel/oneapi - fi - source $ONEAPI_ROOT/setvars.sh + export LD_LIBRARY_PATH=$(realpath "$venv_dir")/lib/:$LD_LIBRARY_PATH fi if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ] then echo "Launching accelerate launch.py..." exec accelerate launch --num_cpu_threads_per_process=6 launch.py "$@" -elif [[ "$@" == *"--use-ipex"* ]] && [[ -z "${first_launch}" ]] && [ -x "$(command -v ipexrun)" ] && [ -x "$(command -v sycl-ls)" ] +elif [[ "$@" == *"--use-ipex"* ]] && [[ -z "${first_launch}" ]] && [ -x "$(command -v ipexrun)" ] then echo "Launching ipexrun launch.py..." exec ipexrun --multi-task-manager 'taskset' --memory-allocator 'jemalloc' launch.py "$@"