mirror of
https://github.com/vladmandic/automatic
synced 2026-09-13 10:08:43 +02:00
IPEX add AoT wheels for Windows
This commit is contained in:
+4
-23
@@ -328,27 +328,6 @@ def check_python():
|
||||
log.debug(f'Git {git_version.replace("git version", "").strip()}')
|
||||
|
||||
|
||||
# Intel hasn't released a corresponding torchvision wheel along with torch and ipex wheels, so we have to install official pytorch torchvision as a W/A.
|
||||
# However, the latest torchvision explicitly requires torch version == 2.0.1, which is incompatible with the Intel torch version 2.0.0a0. This will cause
|
||||
# intel torch to be uninstalled when pip scans the dependencies of torchvision. This function will check the torch version and force installing Intel torch
|
||||
# 2.0.0a0 to avoid the underlying dll version error.
|
||||
# TODO(Disty or Nuullll) remove this W/A when Intel releases torchvision wheel for windows.
|
||||
def fix_ipex_win_torch():
|
||||
if not args.use_ipex or 'win' not in sys.platform:
|
||||
return
|
||||
try:
|
||||
ipex_torch_ver = '2.0.0a0'
|
||||
installed_torch_ver = pkg_resources.get_distribution('torch').version
|
||||
if not installed_torch_ver.startswith(ipex_torch_ver):
|
||||
log.warning(f'Incompatible torch version {installed_torch_ver} for ipex windows, reinstalling to {ipex_torch_ver}')
|
||||
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.0.0a0 intel_extension_for_pytorch==2.0.110+gitba7f6c1 -f https://developer.intel.com/ipex-whl-stable-xpu')
|
||||
install(torch_command)
|
||||
import torch # pylint: disable=unused-import
|
||||
import intel_extension_for_pytorch as ipex # pylint: disable=unused-import
|
||||
except Exception as e:
|
||||
log.warning(e)
|
||||
|
||||
|
||||
# check torch version
|
||||
def check_torch():
|
||||
if args.quick:
|
||||
@@ -432,7 +411,10 @@ def check_torch():
|
||||
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.0.1a0 torchvision==0.15.2a0 intel_extension_for_pytorch==2.0.110+xpu -f https://developer.intel.com/ipex-whl-stable-xpu')
|
||||
os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.13.0 intel-extension-for-tensorflow[gpu]')
|
||||
else:
|
||||
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.0.0a0 intel_extension_for_pytorch==2.0.110+gitba7f6c1 -f https://developer.intel.com/ipex-whl-stable-xpu')
|
||||
pytorch_pip = 'https://github.com/Disty0/automatic/releases/download/ipex_with_aot_for_windows/torch-2.0.0a0+gite9ebda2-cp310-cp310-win_amd64.whl'
|
||||
torchvision_pip = 'https://github.com/Disty0/automatic/releases/download/ipex_with_aot_for_windows/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl'
|
||||
ipex_pip = 'https://github.com/Disty0/automatic/releases/download/ipex_with_aot_for_windows/intel_extension_for_pytorch-2.0.110+git0f2597b-cp310-cp310-win_amd64.whl'
|
||||
torch_command = os.environ.get('TORCH_COMMAND', f'{pytorch_pip} {torchvision_pip} {ipex_pip}')
|
||||
elif allow_openvino and args.use_openvino:
|
||||
#Remove this after 2.1.0 releases
|
||||
log.info('Using OpenVINO')
|
||||
@@ -456,7 +438,6 @@ def check_torch():
|
||||
import torch
|
||||
log.info(f'Torch {torch.__version__}')
|
||||
if args.use_ipex and allow_ipex:
|
||||
fix_ipex_win_torch()
|
||||
import intel_extension_for_pytorch as ipex # pylint: disable=import-error, unused-import
|
||||
log.info(f'Torch backend: Intel IPEX {ipex.__version__}')
|
||||
if shutil.which('icpx') is not None:
|
||||
|
||||
@@ -204,7 +204,6 @@ if __name__ == "__main__":
|
||||
installer.log.warning(f'Setup complete with errors: {installer.errors}')
|
||||
installer.log.warning(f'See log file for more details: {installer.log_file}')
|
||||
installer.extensions_preload(parser) # adds additional args from extensions
|
||||
installer.fix_ipex_win_torch() # redo ipex win torch fix since extensions may scan the deps of torchvision
|
||||
args = installer.parse_args(parser)
|
||||
# installer.run_setup()
|
||||
# installer.log.debug(f"Args: {vars(args)}")
|
||||
|
||||
Reference in New Issue
Block a user