mirror of
https://github.com/NVIDIA/Model-Optimizer.git
synced 2026-11-10 09:34:01 +08:00
## What does this PR do? **Type of change:** new feature **Overview:** - Allow user to select the target opset - Minimum opset will be defined according to quantization mode - Add tests in tests/unit/onnx/test_quantize_api.py ## Testing Added unit tests tests/unit/onnx/test_quantize_api.py::test_opset_below_minimum_upgrades_to_minimum[int8] PASSED [ 11%] tests/unit/onnx/test_quantize_api.py::test_opset_below_minimum_upgrades_to_minimum[fp8] PASSED [ 22%] tests/unit/onnx/test_quantize_api.py::test_opset_below_minimum_upgrades_to_minimum[int4] PASSED [ 33%] tests/unit/onnx/test_quantize_api.py::test_opset_below_original_uses_original[int8] PASSED [ 44%] tests/unit/onnx/test_quantize_api.py::test_opset_below_original_uses_original[fp8] PASSED [ 55%] tests/unit/onnx/test_quantize_api.py::test_opset_below_original_uses_original[int4] PASSED [ 66%] tests/unit/onnx/test_quantize_api.py::test_opset_above_minimum[int8] PASSED [ 77%] tests/unit/onnx/test_quantize_api.py::test_opset_above_minimum[fp8] PASSED [ 88%] tests/unit/onnx/test_quantize_api.py::test_opset_above_minimum[int4] PASSED [100%] ## Before your PR is "*Ready for review*" <!-- If you haven't finished some of the above items you can still open `Draft` PR. --> - **Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)** and your commits are signed. - **Is this change backward compatible?**: Yes - **Did you write any new necessary tests?**: Yes - **Did you add or update any necessary documentation?**: Yes - auto update according to argparser help - **Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**: Yes ## Additional Information Requested as a WAR for a Windows-onnxruntime issue in 5525939, but regardless, it's a useful feature to have <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added `--opset` CLI option enabling users to specify target ONNX opset version when quantizing models. * Automatic validation ensures the opset version is compatible with quantization requirements, with warnings when adjustments are made. * **Tests** * Added comprehensive test coverage for opset version handling across quantization workflows. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com> Signed-off-by: Gal Hubara-Agam <96368689+galagam@users.noreply.github.com> Co-authored-by: Gwena Cunha <4861122+gcunhase@users.noreply.github.com>