Skip to content

Commit 19e0a4f

Browse files
Merge branch 'main' into ns/whisper-quantization
2 parents 72bd28c + 958eb6e commit 19e0a4f

File tree

23 files changed

+1172
-882
lines changed

23 files changed

+1172
-882
lines changed

.github/workflows/test_inc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
torch-version: ["2.4.*", "2.5.0"]
21+
torch-version: ["2.4.0", "2.5.*"]
2222

2323
runs-on: ubuntu-22.04
2424

@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
pip install --upgrade pip
3737
pip install torch==${{ matrix.torch-version }} torchaudio torchvision --index-url https://download.pytorch.org/whl/cpu
38-
pip install .[neural-compressor,ipex,diffusers,peft,tests] transformers[testing] intel-extension-for-pytorch==${{ matrix.torch-version }}
38+
pip install .[neural-compressor,diffusers,peft,tests] transformers[testing] intel-extension-for-pytorch==${{ matrix.torch-version }}
3939
4040
- name: Assert versions
4141
run: |

.github/workflows/test_ipex.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
torch-version: ["2.2.0", "2.3.*", "2.4.*"]
22-
transformers-version: ["4.39.0", "4.44.*"]
21+
transformers-version: ["4.46.0", "4.46.3"]
22+
torch-version: ["2.4.0", "2.5.*"]
2323

2424
runs-on: ubuntu-22.04
2525

@@ -38,10 +38,6 @@ jobs:
3838
pip install torch==${{ matrix.torch-version }} torchaudio torchvision --extra-index-url https://download.pytorch.org/whl/cpu
3939
pip install .[ipex,tests] transformers[testing]==${{ matrix.transformers-version }} intel_extension_for_pytorch==${{ matrix.torch-version }}
4040
41-
- if: ${{ matrix.torch-version == '2.2.0' }}
42-
name: Downgrade Numpy
43-
run: pip install numpy==1.*
44-
4541
- name: Assert versions
4642
run: |
4743
python -c "import torch; print(torch.__version__); assert torch.__version__.startswith('${{ matrix.torch-version }}'.replace('.*', ''))"
@@ -50,4 +46,4 @@ jobs:
5046
5147
- name: Test with Pytest
5248
run: |
53-
pytest tests/ipex
49+
pytest tests/ipex
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: OpenVINO - Full Test
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "41 3 * * *" # run every day at 3:41
7+
push:
8+
branches:
9+
- v*-release
10+
pull_request:
11+
types: [opened, synchronize, reopened, labeled]
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
if: ${{ (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') || (github.event_name == 'push') || contains( github.event.pull_request.labels.*.name, 'openvino-test') }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- python-version: "3.9"
25+
os: "ubuntu-22.04"
26+
transformers-version: "latest"
27+
openvino: "ov-stable"
28+
nncf: "nncf-stable"
29+
- python-version: "3.9"
30+
os: "ubuntu-22.04"
31+
transformers-version: "latest"
32+
openvino: "ov-nightly"
33+
nncf: "nncf-stable"
34+
- python-version: "3.9"
35+
os: "ubuntu-22.04"
36+
transformers-version: "latest"
37+
openvino: "ov-stable"
38+
nncf: "nncf-develop"
39+
- python-version: "3.9"
40+
os: "ubuntu-22.04"
41+
transformers-version: "latest"
42+
openvino: "ov-nightly"
43+
nncf: "nncf-develop"
44+
45+
runs-on: ${{ matrix.os }}
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Setup Python ${{ matrix.python-version }}
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
# Install PyTorch CPU to prevent unnecessary downloading/installing of CUDA packages
58+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
59+
pip install .[tests]
60+
61+
- name: Install openvino-nightly
62+
if: ${{ matrix.openvino == 'ov-nightly' }}
63+
run: pip install --pre -U openvino openvino-tokenizers --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
64+
65+
- name: Install openvino release
66+
if: ${{ matrix.openvino == 'ov-stable' }}
67+
run: pip install .[openvino]
68+
69+
- name: Install nncf develop
70+
if: ${{ matrix.nncf == 'nncf-develop' }}
71+
run: pip install git+https://github.com/openvinotoolkit/nncf.git
72+
73+
- name: Install nncf release
74+
if: ${{ matrix.nncf == 'nncf-stable' }}
75+
run: pip install .[nncf]
76+
77+
- name: Install the lowest compatible transformers version
78+
if: ${{ matrix.transformers-version != 'latest' }}
79+
run: pip install transformers==${{ matrix.transformers-version }}
80+
81+
- name: Pip freeze
82+
run: pip freeze
83+
84+
- name: OpenVINO tests
85+
run: pytest tests/openvino --durations=0
86+
env:
87+
RUN_SLOW: 1
88+
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}

.github/workflows/test_openvino_slow.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
os: ["ubuntu-22.04", "windows-2019"]
28-
openvino-version: ["stable", "nightly"]
2928
transformers-version: ["4.36.0", "latest"]
30-
nncf: ["nncf", "git+https://github.com/openvinotoolkit/nncf.git"]
3129

3230
runs-on: ${{ matrix.os }}
3331

@@ -47,11 +45,6 @@ jobs:
4745
pip install .[openvino,tests] transformers[testing]
4846
pip uninstall -y nncf
4947
50-
- if: ${{ matrix.openvino-version == 'nightly' }}
51-
name: Install nightly OpenVINO
52-
run: |
53-
pip install openvino openvino-tokenizers --pre --upgrade --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
54-
5548
- if: ${{ matrix.transformers-version != 'latest' }}
5649
name: Downgrade Transformers and Accelerate
5750
run: pip install transformers==${{ matrix.transformers-version }} accelerate==0.*
@@ -65,7 +58,11 @@ jobs:
6558
6659
- name: Install dependencies (slow)
6760
run: |
68-
pip install ${{ matrix.nncf }}
61+
pip install .[nncf]
62+
63+
- if: ${{ matrix.transformers-version != 'latest' }}
64+
name: Downgrade Transformers and Accelerate
65+
run: pip install transformers==${{ matrix.transformers-version }} accelerate==0.*
6966

7067
- name: Test with Pytest (slow)
7168
run: |

docs/source/ipex/inference.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Optimum Intel can be used to load models from the [Hub](https://huggingface.co/m
1414

1515
## Loading
1616

17-
You can load your model and apply IPEX optimizations (including weight prepacking and graph mode). For supported architectures like LLaMA, BERT and ViT, further optimizations will be applied by patching the model to use custom operators.
18-
For now, support is only enabled for CPUs and the original model will be exported via TorchScript. In the future `torch.compile` will be used and model exported via TorchScript will get deprecated.
17+
You can load your model and apply IPEX optimizations (apply torch.compile for non-generation tasks). For supported architectures like LLaMA, BERT and ViT, further optimizations will be applied by patching the model to use custom operators.
18+
For now, support is enabled for Intel CPU/GPU. Previous models converted to TorchScript will be deprecated in v1.22.
1919

2020
```diff
2121
import torch
@@ -25,7 +25,7 @@ For now, support is only enabled for CPUs and the original model will be exporte
2525

2626
model_id = "gpt2"
2727
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16)
28-
+ model = IPEXModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, export=True)
28+
+ model = IPEXModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16)
2929
tokenizer = AutoTokenizer.from_pretrained(model_id)
3030
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
3131
results = pipe("He's a dreadful magician and")

0 commit comments

Comments
 (0)