Skip to content

Commit

Permalink
fix is_intel_gpu_available (#1527)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenwei-intel authored May 7, 2024
1 parent f650408 commit 47d5024
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion intel_extension_for_transformers/tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def is_intel_gpu_available():
import intel_extension_for_pytorch as ipex
return hasattr(torch, "xpu") and torch.xpu.is_available()


_ipex_available = importlib.util.find_spec("intel_extension_for_pytorch") is not None
_ipex_version = "N/A"
if _ipex_available:
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
--extra-index-url https://download.pytorch.org/whl/cpu
py-cpuinfo
setuptools>=65
setuptools_scm[toml]>=6.2
torch==2.2.0
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

result = subprocess.Popen("pip install -r requirements.txt", shell=True)
result.wait()
from intel_extension_for_transformers.tools.utils import is_intel_gpu_available

def is_intel_gpu_available():
import torch
import intel_extension_for_pytorch as ipex
return hasattr(torch, "xpu") and torch.xpu.is_available()

def check_env_flag(name: str, default: bool = False) -> bool:
if default: # if a flag meant to be true if not set / mal-formatted
Expand Down

0 comments on commit 47d5024

Please sign in to comment.