Skip to content

Commit 101c7c2

Browse files
Add ipex tests (#806)
* add low version ipex tests * Update .github/workflows/test_ipex.yml Co-authored-by: Ella Charlaix <[email protected]> * Update .github/workflows/test_ipex.yml Co-authored-by: Ella Charlaix <[email protected]> * rm test libs * add tests 3-rd libs * test python3.8 with only one set * exclude python3.8 for testing * keep one set test for python3.8' * revert useless changes * Update .github/workflows/test_ipex.yml * Update .github/workflows/test_ipex.yml * Update .github/workflows/test_ipex.yml * Update .github/workflows/test_ipex.yml * Update .github/workflows/test_ipex.yml * Update .github/workflows/test_ipex.yml * Update .github/workflows/test_ipex.yml * , --------- Co-authored-by: Ella Charlaix <[email protected]>
1 parent b25e845 commit 101c7c2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/test_ipex.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ concurrency:
1717

1818
jobs:
1919
build:
20+
runs-on: ubuntu-latest
2021
strategy:
2122
fail-fast: false
2223
matrix:
23-
python-version: [3.8, 3.9]
24+
python-version: [3.9]
2425
transformers-version: [4.39.0, 4.42.3]
25-
os: [ubuntu-latest]
26+
ipex-version: [2.2.0, 2.3.*]
27+
include:
28+
- python-version: 3.8
29+
transformers-version: 4.39.0
30+
ipex-version: 2.2.0
2631

27-
runs-on: ${{ matrix.os }}
2832
steps:
2933
- uses: actions/checkout@v2
3034
- name: Setup Python ${{ matrix.python-version }}
@@ -34,9 +38,11 @@ jobs:
3438
- name: Install dependencies
3539
run: |
3640
python -m pip install --upgrade pip
37-
pip install torch torchaudio torchvision --extra-index-url https://download.pytorch.org/whl/cpu
38-
pip install .[ipex,tests]
39-
pip install transformers==${{ matrix.transformers-version }}
41+
pip install torch==${{ matrix.ipex-version }} --extra-index-url https://download.pytorch.org/whl/cpu
42+
pip install intel_extension_for_pytorch==${{ matrix.ipex-version }}
43+
pip install Pillow parameterized
44+
pip install transformers[testing]==${{ matrix.transformers-version }}
45+
pip install .[ipex]
4046
- name: Test with Pytest
4147
run: |
42-
pytest tests/ipex/
48+
pytest tests/ipex/

optimum/intel/ipex/modeling_base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def ipex_jit_trace(model, task, use_cache):
110110
sample_inputs.pop("past_key_values")
111111

112112
# Use Tensor Processing Primitives to accelerate linear, see https://arxiv.org/abs/2104.05755.
113-
_enable_tpp()
113+
# Only ipex >= 2.3.0 supports tpp.
114+
if is_ipex_version(">=", "2.3.0"):
115+
_enable_tpp()
114116
model = ipex.optimize(model.eval(), dtype=model.dtype, inplace=True)
115117
# Disable repack while jit tracing to reduce the memory
116118
ipex._C.disable_jit_linear_repack()

0 commit comments

Comments
 (0)