Skip to content

Commit

Permalink
Add ipex tests (#806)
Browse files Browse the repository at this point in the history
* add low version ipex tests

* Update .github/workflows/test_ipex.yml

Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>

* Update .github/workflows/test_ipex.yml

Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>

* 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 <80481427+echarlaix@users.noreply.github.com>
  • Loading branch information
jiqing-feng and echarlaix authored Jul 11, 2024
1 parent b25e845 commit 101c7c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/test_ipex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9]
transformers-version: [4.39.0, 4.42.3]
os: [ubuntu-latest]
ipex-version: [2.2.0, 2.3.*]
include:
- python-version: 3.8
transformers-version: 4.39.0
ipex-version: 2.2.0

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
Expand All @@ -34,9 +38,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch torchaudio torchvision --extra-index-url https://download.pytorch.org/whl/cpu
pip install .[ipex,tests]
pip install transformers==${{ matrix.transformers-version }}
pip install torch==${{ matrix.ipex-version }} --extra-index-url https://download.pytorch.org/whl/cpu
pip install intel_extension_for_pytorch==${{ matrix.ipex-version }}
pip install Pillow parameterized
pip install transformers[testing]==${{ matrix.transformers-version }}
pip install .[ipex]
- name: Test with Pytest
run: |
pytest tests/ipex/
pytest tests/ipex/
4 changes: 3 additions & 1 deletion optimum/intel/ipex/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ def ipex_jit_trace(model, task, use_cache):
sample_inputs.pop("past_key_values")

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

0 comments on commit 101c7c2

Please sign in to comment.