Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate RTN, HQQ and AWQ to Torch new 3.x API #1765

Merged
merged 12 commits into from
May 7, 2024

Conversation

yuwenzho
Copy link
Contributor

@yuwenzho yuwenzho commented Apr 29, 2024

Type of Change

feature
API changed or not: yes

Description

Migrate RTN, HQQ and AWQ to Torch new 3x API

RTN

from neural_compressor.torch.quantization import get_default_rtn_config, prepare, convert
quant_config = get_default_rtn_config()
model= prepare(model, quant_config)
q_model = convert(model)

HQQ

from neural_compressor.torch.quantization import get_default_hqq_config, prepare, convert
quant_config = get_default_hqq_config()
model= prepare(model, quant_config)
q_model = convert(model)

AWQ

from neural_compressor.torch.quantization import get_default_awq_config, prepare, convert
quant_config = get_default_awq_config()
# prepare
model= prepare(model, quant_config, example_inputs=example_inputs)
# calibrate
calib_func(model)
# convert
q_model = convert(model)

How has this PR been tested?

CI

Dependency Change?

no

Signed-off-by: yuwenzho <yuwen.zhou@intel.com>
Signed-off-by: yuwenzho <yuwen.zhou@intel.com>
Signed-off-by: yuwenzho <yuwen.zhou@intel.com>
@yuwenzho yuwenzho added INC3.X PyTorch Related to PyTorch F/W labels Apr 29, 2024
@yuwenzho yuwenzho requested review from Kaihui-intel, yiliu30 and xin3he and removed request for Kaihui-intel and yiliu30 April 29, 2024 06:04
Copy link

github-actions bot commented Apr 29, 2024

⚡ Required checks status: All passing 🟢

Groups summary

🟢 Code Scan Tests workflow
Check ID Status Error details
Code-Scan success
Code-Scan (Bandit Code Scan Bandit) success
Code-Scan (DocStyle Code Scan DocStyle) success
Code-Scan (Pylint Code Scan Pylint) success

These checks are required after the changes to neural_compressor/torch/algorithms/base_algorithm.py, neural_compressor/torch/algorithms/static_quant/static_quant.py, neural_compressor/torch/algorithms/weight_only/awq.py, neural_compressor/torch/algorithms/weight_only/hqq/__init__.py, neural_compressor/torch/algorithms/weight_only/hqq/quant_api.py, neural_compressor/torch/algorithms/weight_only/hqq/quantizer.py, neural_compressor/torch/algorithms/weight_only/rtn.py, neural_compressor/torch/algorithms/weight_only/utility.py, neural_compressor/torch/quantization/algorithm_entry.py.

🟢 Model Tests 3x workflow
Check ID Status Error details
Model-Test-3x success
Model-Test-3x (Generate Report GenerateReport) success
Model-Test-3x (Run PyTorch Model opt_125m_woq_gptq_int4) success
Model-Test-3x (Run PyTorch Model opt_125m_woq_gptq_int4_dq_bnb) success
Model-Test-3x (Run PyTorch Model opt_125m_woq_gptq_int4_dq_ggml) success

These checks are required after the changes to neural_compressor/torch/algorithms/base_algorithm.py, neural_compressor/torch/algorithms/static_quant/static_quant.py, neural_compressor/torch/algorithms/weight_only/awq.py, neural_compressor/torch/algorithms/weight_only/hqq/__init__.py, neural_compressor/torch/algorithms/weight_only/hqq/quant_api.py, neural_compressor/torch/algorithms/weight_only/hqq/quantizer.py, neural_compressor/torch/algorithms/weight_only/rtn.py, neural_compressor/torch/algorithms/weight_only/utility.py, neural_compressor/torch/quantization/algorithm_entry.py.

🟢 Unit Tests 3x-PyTorch workflow
Check ID Status Error details
UT-3x-Torch success
UT-3x-Torch (Coverage Compare CollectDatafiles) success
UT-3x-Torch (Unit Test 3x Torch Unit Test 3x Torch) success
UT-3x-Torch (Unit Test 3x Torch baseline Unit Test 3x Torch baseline) success

These checks are required after the changes to neural_compressor/torch/algorithms/base_algorithm.py, neural_compressor/torch/algorithms/static_quant/static_quant.py, neural_compressor/torch/algorithms/weight_only/awq.py, neural_compressor/torch/algorithms/weight_only/hqq/__init__.py, neural_compressor/torch/algorithms/weight_only/hqq/quant_api.py, neural_compressor/torch/algorithms/weight_only/hqq/quantizer.py, neural_compressor/torch/algorithms/weight_only/rtn.py, neural_compressor/torch/algorithms/weight_only/utility.py, neural_compressor/torch/quantization/algorithm_entry.py, test/3x/torch/quantization/weight_only/hqq/test_hqq_cpu.py, test/3x/torch/quantization/weight_only/hqq/test_hqq_cuda.py, test/3x/torch/quantization/weight_only/test_awq.py, test/3x/torch/quantization/weight_only/test_rtn.py.


Thank you for your contribution! 💜

Note
This comment is automatically generated and will be updates every 180 seconds within the next 6 hours. If you have any other questions, contact chensuyue or XuehaoSun for help.

@yuwenzho yuwenzho requested a review from yiliu30 April 29, 2024 06:05
Copy link
Contributor

@yiliu30 yiliu30 left a comment

Choose a reason for hiding this comment

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

Others are LTGM.

Signed-off-by: yuwenzho <yuwen.zhou@intel.com>
@yuwenzho yuwenzho merged commit 1a45090 into master May 7, 2024
30 checks passed
@yuwenzho yuwenzho deleted the yuwenzho/refactor_rtn_hqq_awq branch May 7, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INC3.X PyTorch Related to PyTorch F/W
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants