File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
optimum/intel/neural_compressor Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 3232 python -m pip install --upgrade pip
3333 pip install cmake
3434 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
3636 pip install .[neural-compressor,diffusers,tests]
37- pip install intel-extension-for-transformers==1.4.1
37+ pip install intel-extension-for-transformers
3838 pip install peft
3939
4040 - name : Test with Pytest
4343 - name : Test IPEX
4444 run : |
4545 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
4746 pip install intel-extension-for-pytorch==2.3.0
4847 pytest tests/neural_compressor/test_ipex.py
4948
Original file line number Diff line number Diff line change 2929from neural_compressor .model .onnx_model import ONNXModel
3030from neural_compressor .model .torch_model import IPEXModel , PyTorchModel
3131from neural_compressor .quantization import fit
32+ from packaging .version import parse
3233from torch .utils .data import DataLoader , RandomSampler
3334from transformers import (
3435 DataCollator ,
7980)
8081
8182
82- _ITREX_EXCLUDED_VERSION = "1.4.2"
83-
8483if is_itrex_available ():
8584 if is_itrex_version ("<" , ITREX_MINIMUM_VERSION ):
8685 raise ImportError (
@@ -229,10 +228,12 @@ def quantize(
229228
230229 # ITREX Weight Only Quantization
231230 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+ ):
233234 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 ."
236237 )
237238
238239 # check neural-compressor version
You can’t perform that action at this time.
0 commit comments