From d33ce2fc4a07e09116d924cb166b9ee4dfd3cbe2 Mon Sep 17 00:00:00 2001 From: Liubov Talamanova Date: Mon, 21 Oct 2024 16:08:13 +0100 Subject: [PATCH] Remove warning from examples (#3023) ### Changes Add `subset_size` to PTQ samples after merging https://github.com/openvinotoolkit/nncf/pull/2995 to remove the warning message CI: https://github.com/openvinotoolkit/nncf/actions/runs/11436915496 --- .../onnx/yolov8_quantize_with_accuracy_control/main.py | 1 + .../anomaly_stfpm_quantize_with_accuracy_control/main.py | 1 + examples/post_training_quantization/openvino/yolov8/main.py | 1 + .../openvino/yolov8_quantize_with_accuracy_control/main.py | 1 + examples/post_training_quantization/torch/ssd300_vgg16/main.py | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/post_training_quantization/onnx/yolov8_quantize_with_accuracy_control/main.py b/examples/post_training_quantization/onnx/yolov8_quantize_with_accuracy_control/main.py index 2109b750b3b..38b4fe56ef5 100644 --- a/examples/post_training_quantization/onnx/yolov8_quantize_with_accuracy_control/main.py +++ b/examples/post_training_quantization/onnx/yolov8_quantize_with_accuracy_control/main.py @@ -190,6 +190,7 @@ def validation_ac( model, quantization_dataset, quantization_dataset, + subset_size=len(data_loader), validation_fn=validation_fn, max_drop=0.003, preset=nncf.QuantizationPreset.MIXED, diff --git a/examples/post_training_quantization/openvino/anomaly_stfpm_quantize_with_accuracy_control/main.py b/examples/post_training_quantization/openvino/anomaly_stfpm_quantize_with_accuracy_control/main.py index 5215c867b43..659666962fe 100644 --- a/examples/post_training_quantization/openvino/anomaly_stfpm_quantize_with_accuracy_control/main.py +++ b/examples/post_training_quantization/openvino/anomaly_stfpm_quantize_with_accuracy_control/main.py @@ -159,6 +159,7 @@ def transform_fn(data_item): ov_quantized_model = nncf.quantize_with_accuracy_control( model=ov_model, calibration_dataset=calibration_dataset, + subset_size=len(anomaly_images), validation_dataset=validation_dataset, validation_fn=validation_fn, max_drop=max_accuracy_drop, diff --git a/examples/post_training_quantization/openvino/yolov8/main.py b/examples/post_training_quantization/openvino/yolov8/main.py index 88a34d5c24c..7695c870b5e 100644 --- a/examples/post_training_quantization/openvino/yolov8/main.py +++ b/examples/post_training_quantization/openvino/yolov8/main.py @@ -120,6 +120,7 @@ def transform_fn(data_item: Dict): quantized_model = nncf.quantize( model, quantization_dataset, + subset_size=len(data_loader), preset=nncf.QuantizationPreset.MIXED, ignored_scope=nncf.IgnoredScope( types=["Multiply", "Subtract", "Sigmoid"], diff --git a/examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/main.py b/examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/main.py index 82e5941f609..919d1c0d7a1 100644 --- a/examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/main.py +++ b/examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/main.py @@ -183,6 +183,7 @@ def validation_ac( model, quantization_dataset, quantization_dataset, + subset_size=len(data_loader), validation_fn=validation_fn, max_drop=0.003, preset=nncf.QuantizationPreset.MIXED, diff --git a/examples/post_training_quantization/torch/ssd300_vgg16/main.py b/examples/post_training_quantization/torch/ssd300_vgg16/main.py index 7eff8b6bf20..3e28861743c 100644 --- a/examples/post_training_quantization/torch/ssd300_vgg16/main.py +++ b/examples/post_training_quantization/torch/ssd300_vgg16/main.py @@ -152,7 +152,7 @@ def main(): # Quantize model calibration_dataset = nncf.Dataset(dataset, partial(transform_fn, device=device)) - quantized_model = nncf.quantize(model, calibration_dataset) + quantized_model = nncf.quantize(model, calibration_dataset, subset_size=len(dataset)) # Convert to OpenVINO dummy_input = torch.randn(1, 3, 480, 480)