Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel ARC / IPEX Docker support #3713

Merged
merged 18 commits into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,15 @@ def get_platform():
'system': platform.system(),
'release': release,
'python': platform.python_version(),
'docker': os.environ.get('SD_INSTALL_DEBUG', None) is not None,
'docker': os.environ.get('SD_DOCKER', None) is not None,
# 'host': platform.node(),
# 'version': platform.version(),
}
except Exception as e:
return { 'error': e }


# TODO Requires pydantic 2.x before fully supporting python 3.12
# check python version
def check_python(supported_minors=[9, 10, 11, 12], reason=None):
t_start = time.time()
Expand Down Expand Up @@ -537,6 +538,7 @@ def install_rocm_zluda():
log.info('Using CPU-only torch')
return os.environ.get('TORCH_COMMAND', 'torch torchvision')

# TODO Requires pydantic 2.x before fully supporting python 3.12
check_python(supported_minors=[10, 11], reason='ROCm or ZLUDA backends require Python 3.10 or 3.11')
log.info('ROCm: AMD toolkit detected')
os.environ.setdefault('PYTORCH_HIP_ALLOC_CONF', 'garbage_collection_threshold:0.8,max_split_size_mb:512')
Expand Down Expand Up @@ -659,6 +661,9 @@ def install_rocm_zluda():

def install_ipex(torch_command):
t_start = time.time()
# https://pytorch-extension.intel.com/installation?platform=gpu&version=v2.5.10%2Bxpu&os=linux%2Fwsl2&package=pip
# while IPEX supports 3.12, other components (such as pydantic 1.x) do not. Capping at 3.11 still.
# TODO Requires pydantic 2.x before fully supporting python 3.12
check_python(supported_minors=[9, 10, 11, 12], reason='IPEX backend requires Python 3.9, 3.10 or 3.11')
args.use_ipex = True # pylint: disable=attribute-defined-outside-init
log.info('IPEX: Intel OneAPI toolkit detected')
Expand All @@ -681,7 +686,8 @@ def install_ipex(torch_command):
os.environ.setdefault('IPEX_FORCE_ATTENTION_SLICE', '1')

if "linux" in sys.platform:
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.5.1+cxx11.abi torchvision==0.20.1+cxx11.abi intel-extension-for-pytorch==2.5.10+xpu oneccl_bind_pt==2.5.0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/')
# default to US server. If The China server is needed, change .../release-whl/stable/xpu/us/ to .../release-whl/stable/xpu/cn/
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.5.1+cxx11.abi torchvision==0.20.1+cxx11.abi intel-extension-for-pytorch==2.5.10+xpu oneccl_bind_pt==2.5.0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/')
# os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.15.1 intel-extension-for-tensorflow[xpu]==2.15.0.2')
else:
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.6.0+xpu torchvision==0.21.0+xpu --index-url https://download.pytorch.org/whl/test/xpu')
Expand All @@ -695,6 +701,7 @@ def install_ipex(torch_command):

def install_openvino(torch_command):
t_start = time.time()
# TODO Requires pydantic 2.x before fully supporting python 3.12
check_python(supported_minors=[9, 10, 11, 12], reason='OpenVINO backend requires Python 3.9, 3.10 or 3.11')
log.info('OpenVINO: selected')
if sys.platform == 'darwin':
Expand Down