diff --git a/.github/workflows/test_ipex.yml b/.github/workflows/test_ipex.yml index 2ed91535f7..c32b65b2b9 100644 --- a/.github/workflows/test_ipex.yml +++ b/.github/workflows/test_ipex.yml @@ -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 }} @@ -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/ \ No newline at end of file diff --git a/optimum/intel/ipex/modeling_base.py b/optimum/intel/ipex/modeling_base.py index 3d39e944b3..a42b217c30 100644 --- a/optimum/intel/ipex/modeling_base.py +++ b/optimum/intel/ipex/modeling_base.py @@ -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()