File tree 2 files changed +8
-8
lines changed
optimum/intel/neural_compressor
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 32
32
python -m pip install --upgrade pip
33
33
pip install cmake
34
34
pip install py-cpuinfo
35
- pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cpu
35
+ pip install torch==2.3.0 torchaudio==2.3.0 torchvision==0.18 --index-url https://download.pytorch.org/whl/cpu
36
36
pip install .[neural-compressor,diffusers,tests]
37
- pip install intel-extension-for-transformers==1.4.1
37
+ pip install intel-extension-for-transformers
38
38
pip install peft
39
39
40
40
- name : Test with Pytest
43
43
- name : Test IPEX
44
44
run : |
45
45
pip uninstall -y intel-extension-for-transformers
46
- pip install torch==2.3.0 torchaudio==2.3.0 torchvision==0.18 --extra-index-url https://download.pytorch.org/whl/cpu
47
46
pip install intel-extension-for-pytorch==2.3.0
48
47
pytest tests/neural_compressor/test_ipex.py
49
48
Original file line number Diff line number Diff line change 29
29
from neural_compressor .model .onnx_model import ONNXModel
30
30
from neural_compressor .model .torch_model import IPEXModel , PyTorchModel
31
31
from neural_compressor .quantization import fit
32
+ from packaging .version import parse
32
33
from torch .utils .data import DataLoader , RandomSampler
33
34
from transformers import (
34
35
DataCollator ,
79
80
)
80
81
81
82
82
- _ITREX_EXCLUDED_VERSION = "1.4.2"
83
-
84
83
if is_itrex_available ():
85
84
if is_itrex_version ("<" , ITREX_MINIMUM_VERSION ):
86
85
raise ImportError (
@@ -229,10 +228,12 @@ def quantize(
229
228
230
229
# ITREX Weight Only Quantization
231
230
if not isinstance (quantization_config , PostTrainingQuantConfig ):
232
- if is_itrex_version ("==" , _ITREX_EXCLUDED_VERSION ):
231
+ if is_itrex_version ("==" , "1.4.2" ) and (
232
+ is_torch_version ("!=" , "2.3.0" ) or parse (_torch_version ).local != "cpu"
233
+ ):
233
234
raise ImportError (
234
- f"Found an incompatible version of `intel-extension-for-transformers`. Found version { _itrex_version } , "
235
- f"but { _ITREX_EXCLUDED_VERSION } is not compatible."
235
+ f"Found an incompatible version of `intel-extension-for-transformers` and `torch` . Found version itrex { _itrex_version } and torch { _torch_version } , "
236
+ f"but only torch 2.3.0+cpu is compatible with ITREX v1.4.2 ."
236
237
)
237
238
238
239
# check neural-compressor version
You can’t perform that action at this time.
0 commit comments