Skip to content

Conversation

@kaikaiyao
Copy link
Contributor

@kaikaiyao kaikaiyao commented Dec 5, 2022

Signed-off-by: Yao, Kai [email protected]

Type of Change

Neural Coder enable backend support for intel_extension_for_transformers

Description

Neural Coder enable backend support for intel_extension_for_transformers. Intel Extension for Transformers: https://github.com/intel/intel-extension-for-transformers

The enabling pattern is as follows:

from intel_extension_for_transformers import metric, objectives, QuantizationConfig
from intel_extension_for_transformers.optimization.trainer import NLPTrainer
# Replace transformers.Trainer with NLPTrainer
# trainer = transformers.Trainer(......)
trainer = NLPTrainer(......)
metric = metrics.Metric(name="eval_f1", is_relative=True, criterion=0.01)
objective = objectives.performance
q_config = QuantizationConfig(approach="PostTrainingStatic", metrics=[metric], objectives=[objective])
MODEL_NAME = trainer.quantize(quant_config=q_config)

We enable the backend support in two parts:

  1. Change Trainer to NLPTrainer while defining the trainer, according to intel_extension_for_transformers document
  2. Add API code lines, according to intel_extension_for_transformers document

Note that since Neural Coder is a one-click no-code solution, we default apply Post-Training Dynamic and eval_f1 in this case to avoid confusion, and we do not provide user-specific argument for this feature as of now.

Expected Behavior & Potential Risk

enable backend support for intel_extension_for_transformers , no risk

How has this PR been tested?

locally

Dependency Change?

no

@kaikaiyao
Copy link
Contributor Author

kaikaiyao commented Dec 5, 2022

@WenjiaoYue could you help add the word PythonLauncher to pass spelling check CI? Thanks

@kaikaiyao kaikaiyao merged commit 7e78a95 into master Dec 5, 2022
@kaikaiyao kaikaiyao deleted the neural_coder_enable_intel_ex_transformers branch December 5, 2022 08:24
PenghuiCheng pushed a commit that referenced this pull request Dec 6, 2022
…ers (#214)

* Create intel_extension_for_transformers.yaml

* change default strategy to dynamic according to huggingface sync

* change default strategy to dynamic according to HF sync

* enable intel extension for transformers

* Create change_trainer_to_nlptrainer.py

* add use_inc for not using default optimum for HF code

* add use_inc

* update optimum quant static dynamic separation

* Update interface.py

* Update interface.py

* Update autoinc_harness.py

* Update README.md

* add change_trainer_to_nlptrainer to outside_harness

* add PythonLauncher to pass spelling check CI

Signed-off-by: Yue, Wenjiao <[email protected]>

Signed-off-by: Yue, Wenjiao <[email protected]>
Co-authored-by: Yue, Wenjiao <[email protected]>
zehao-intel pushed a commit that referenced this pull request Dec 9, 2022
…ers (#214)

* Create intel_extension_for_transformers.yaml

* change default strategy to dynamic according to huggingface sync

* change default strategy to dynamic according to HF sync

* enable intel extension for transformers

* Create change_trainer_to_nlptrainer.py

* add use_inc for not using default optimum for HF code

* add use_inc

* update optimum quant static dynamic separation

* Update interface.py

* Update interface.py

* Update autoinc_harness.py

* Update README.md

* add change_trainer_to_nlptrainer to outside_harness

* add PythonLauncher to pass spelling check CI

Signed-off-by: Yue, Wenjiao <[email protected]>

Signed-off-by: Yue, Wenjiao <[email protected]>
Co-authored-by: Yue, Wenjiao <[email protected]>
Signed-off-by: zehao-intel <[email protected]>
yiliu30 pushed a commit that referenced this pull request Apr 30, 2025
#214)

* [SW-225078] [INC][DynamicQuant] Reenable testing dynamic quantization scales on hpu graphs and torch.compile

* CR fixes

* tiny fix

* cr fix

* don't support running _quant_only_scale_methods with dynamic quantization

* string check fix

* fix test_matmul runs and atol in HW_ALIGNED_SINGLE_SCALE

* string fixes
xin3he pushed a commit that referenced this pull request Jul 15, 2025
#214)

* [SW-225078] [INC][DynamicQuant] Reenable testing dynamic quantization scales on hpu graphs and torch.compile

* CR fixes

* tiny fix

* cr fix

* don't support running _quant_only_scale_methods with dynamic quantization

* string check fix

* fix test_matmul runs and atol in HW_ALIGNED_SINGLE_SCALE

* string fixes
XuehaoSun pushed a commit that referenced this pull request Jul 19, 2025
#214)

* [SW-225078] [INC][DynamicQuant] Reenable testing dynamic quantization scales on hpu graphs and torch.compile

* CR fixes

* tiny fix

* cr fix

* don't support running _quant_only_scale_methods with dynamic quantization

* string check fix

* fix test_matmul runs and atol in HW_ALIGNED_SINGLE_SCALE

* string fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants