Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Fixed issue for T5 base model quantization issue with IPEX smoothquant #946

Merged
merged 8 commits into from
Dec 21, 2023

Conversation

PenghuiCheng
Copy link
Contributor

Type of Change

bug fix
No API changed

Description

Fixed quantization failure when T5 base model be quantized with IPEX smoothquant.

Expected Behavior & Potential Risk

Quantize successfully

How has this PR been tested?

Local tested

@VincyZhang
Copy link
Contributor

@VincyZhang VincyZhang added bug Something isn't working ITREX-1.3 labels Dec 15, 2023
delock pushed a commit to delock/intel-extension-for-transformers that referenced this pull request Dec 16, 2023
@VincyZhang
Copy link
Contributor

@VincyZhang
Copy link
Contributor

@PenghuiCheng please check!
Traceback (most recent call last):
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/quantization.py", line 234, in fit
strategy.traverse()
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/strategy/auto.py", line 140, in traverse
super().traverse()
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/strategy/strategy.py", line 482, in traverse
self._setup_pre_tuning_algo_scheduler()
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/strategy/strategy.py", line 360, in _setup_pre_tuning_algo_scheduler
self.model = self._pre_tuning_algo_scheduler("pre_quantization")
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/algorithm/algorithm.py", line 127, in call
self._q_model = algo(self._origin_model, self._q_model, self._adaptor, self._dataloader, self._calib_iter)
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/algorithm/smooth_quant.py", line 89, in call
q_model = adaptor.smooth_quant(
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/adaptor/pytorch.py", line 1796, in smooth_quant
model._model = self.sq.transform(
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/adaptor/torch_utils/smooth_quant.py", line 1286, in transform
out_pre_sq = model_forward_per_sample(self.model, example_inputs, self.device)
File "/home/sdp/miniconda3/envs/pt-ipex-2.1.0+cpu-3.10-spr/lib/python3.10/site-packages/neural_compressor/adaptor/torch_utils/smooth_quant.py", line 110, in model_forward_per_sample
output = forward_wrapper(model, sample[0], device)
KeyError: 0

Signed-off-by: Cheng, Penghui <penghui.cheng@intel.com>
@VincyZhang
Copy link
Contributor

@VincyZhang
Copy link
Contributor

Signed-off-by: Cheng, Penghui <penghui.cheng@intel.com>
@PenghuiCheng PenghuiCheng force-pushed the penghuic/Fixed_t5_model_issue branch from 0a79242 to 4b2e58d Compare December 19, 2023 08:44
@VincyZhang
Copy link
Contributor

VincyZhang commented Dec 19, 2023

Signed-off-by: Cheng, Penghui <penghui.cheng@intel.com>
@VincyZhang
Copy link
Contributor

Signed-off-by: Cheng, Penghui <penghui.cheng@intel.com>
@VincyZhang
Copy link
Contributor

requirements.txt Outdated
@@ -3,6 +3,7 @@ cmake>=3.16
py-cpuinfo
setuptools>=65
setuptools_scm[toml]>=6.2
wheel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a real package?

@VincyZhang
Copy link
Contributor

https://inteltf-jenk.sh.intel.com/job/nlp_toolkit_optimize_validation_localtest/3500/

@PenghuiCheng please check the error, your json format is not correct

Signed-off-by: VincyZhang <wenxin.zhang@intel.com>
@VincyZhang
Copy link
Contributor

VincyZhang and others added 2 commits December 21, 2023 11:36
Signed-off-by: VincyZhang <wenxin.zhang@intel.com>
Signed-off-by: Cheng, Penghui <penghui.cheng@intel.com>
@VincyZhang
Copy link
Contributor

Signed-off-by: VincyZhang <wenxin.zhang@intel.com>
@VincyZhang
Copy link
Contributor

@VincyZhang
Copy link
Contributor

@PenghuiCheng Tuning and benchmark are ok, but acc can not run. Please fix in next PR.

@VincyZhang VincyZhang merged commit 5caf330 into main Dec 21, 2023
2 checks passed
@VincyZhang VincyZhang deleted the penghuic/Fixed_t5_model_issue branch December 21, 2023 10:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants