Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.
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: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ def is_intel_gpu_available():
import intel_extension_for_pytorch as ipex
return hasattr(torch, "xpu") and torch.xpu.is_available()


def is_habana_hpu_available():
try:
import habana_frameworks.torch.hpu as hthpu
return True
except ImportError:
return False


def check_env_flag(name: str, default: bool = False) -> bool:
if default: # if a flag meant to be true if not set / mal-formatted
return not os.getenv(name, "").upper() in ["OFF", "0", "FALSE", "NO", "N"]
Expand All @@ -37,7 +46,7 @@ def check_env_flag(name: str, default: bool = False) -> bool:
SKIP_RUNTIME = True
RUNTIME_ONLY = False
IS_INTEL_GPU = True
else:
elif not is_habana_hpu_available():
result = subprocess.Popen(
"pip install -r requirements-cpu.txt", shell=True)
result.wait()
Expand Down