Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
fix xpu version itrex detect (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhewang1-intc authored Jun 28, 2024
1 parent c47dcb8 commit a9a0e93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/script/install_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source /intel-extension-for-transformers/.github/workflows/script/change_color.s
cd /intel-extension-for-transformers
export CMAKE_ARGS="-DNE_DNNL_CACHE_DIR=/cache"
pip install -U pip
pip install -r requirements.txt
$BOLD_YELLOW && echo "---------------- git submodule update --init --recursive -------------" && $RESET
git config --global --add safe.directory "*"
git submodule update --init --recursive
Expand Down
5 changes: 3 additions & 2 deletions intel_extension_for_transformers/qbits/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
# limitations under the License.

import torch
if not torch.xpu._is_compiled():
from intel_extension_for_transformers.qbits_py import * # pylint: disable=E0401, E0611
import intel_extension_for_transformers
if "gpu" not in intel_extension_for_transformers.__version__:
from intel_extension_for_transformers.qbits_py import * # pylint: disable=E0401, E0611
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
from pathlib import Path
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
from setuptools_scm import get_version

result = subprocess.Popen("pip install -r requirements.txt", shell=True)
result.wait()


def is_intel_gpu_available():
import torch
import intel_extension_for_pytorch as ipex
Expand Down Expand Up @@ -286,6 +288,9 @@ def check_submodules():
"intel_extension_for_transformers/transformers/runtime/"),
])
cmdclass = {'build_ext': CMakeBuild}
itrex_version = get_version()
if IS_INTEL_GPU:
itrex_version = itrex_version + "-gpu"

setup(
name="intel-extension-for-transformers",
Expand Down Expand Up @@ -324,4 +329,5 @@ def check_submodules():
],
setup_requires=['setuptools_scm'],
use_scm_version=True,
version=itrex_version
)

0 comments on commit a9a0e93

Please sign in to comment.