|
23 | 23 | from nncf.quantization.advanced_parameters import AdvancedQuantizationParameters |
24 | 24 | from nncf.quantization.advanced_parameters import AdvancedScaleEstimationParameters |
25 | 25 | from nncf.quantization.advanced_parameters import AdvancedSmoothQuantParameters |
| 26 | +from nncf.quantization.range_estimator import AggregatorType |
| 27 | +from nncf.quantization.range_estimator import StatisticsCollectorParameters |
| 28 | +from nncf.quantization.range_estimator import StatisticsType |
26 | 29 | from tests.post_training.pipelines.base import ALL_PTQ_BACKENDS |
27 | 30 | from tests.post_training.pipelines.base import FX_BACKENDS |
28 | 31 | from tests.post_training.pipelines.base import NNCF_PTQ_BACKENDS |
|
89 | 92 | "pipeline_cls": ImageClassificationTorchvision, |
90 | 93 | "compression_params": { |
91 | 94 | "subset_size": 2, |
| 95 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 96 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 97 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 98 | + ) |
| 99 | + ), |
92 | 100 | }, |
93 | 101 | "backends": FX_BACKENDS |
94 | 102 | + [ |
|
117 | 125 | "pipeline_cls": ImageClassificationTorchvision, |
118 | 126 | "compression_params": { |
119 | 127 | "model_type": ModelType.TRANSFORMER, |
120 | | - "advanced_parameters": AdvancedQuantizationParameters(smooth_quant_alpha=0.15), |
| 128 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 129 | + smooth_quant_alpha=0.15, |
| 130 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 131 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 132 | + ), |
| 133 | + ), |
121 | 134 | }, |
122 | 135 | "backends": FX_BACKENDS + [BackendType.OV], |
123 | 136 | "batch_size": 1, |
|
128 | 141 | "pipeline_cls": ImageClassificationTorchvision, |
129 | 142 | "compression_params": { |
130 | 143 | "model_type": ModelType.TRANSFORMER, |
131 | | - "advanced_parameters": AdvancedQuantizationParameters(smooth_quant_alpha=0.5), |
| 144 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 145 | + smooth_quant_alpha=0.5, |
| 146 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 147 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 148 | + ), |
| 149 | + ), |
132 | 150 | }, |
133 | 151 | "backends": FX_BACKENDS + [BackendType.OV], |
134 | 152 | "batch_size": 1, |
|
180 | 198 | "compression_params": { |
181 | 199 | "subset_size": 2, |
182 | 200 | "preset": QuantizationPreset.MIXED, |
| 201 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 202 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 203 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 204 | + ) |
| 205 | + ), |
183 | 206 | }, |
184 | 207 | "backends": ALL_PTQ_BACKENDS, |
185 | 208 | "batch_size": 128, |
|
191 | 214 | "compression_params": { |
192 | 215 | "subset_size": 2, |
193 | 216 | "preset": QuantizationPreset.MIXED, |
| 217 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 218 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 219 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 220 | + ) |
| 221 | + ), |
194 | 222 | }, |
195 | 223 | "backends": ALL_PTQ_BACKENDS, |
196 | 224 | "batch_size": 128, |
|
202 | 230 | "compression_params": { |
203 | 231 | "subset_size": 2, |
204 | 232 | "preset": QuantizationPreset.MIXED, |
| 233 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 234 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 235 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 236 | + ) |
| 237 | + ), |
205 | 238 | }, |
206 | 239 | "backends": ALL_PTQ_BACKENDS, |
207 | 240 | "batch_size": 128, |
|
214 | 247 | "subset_size": 2, |
215 | 248 | "preset": QuantizationPreset.MIXED, |
216 | 249 | "fast_bias_correction": False, |
| 250 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 251 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 252 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 253 | + ) |
| 254 | + ), |
217 | 255 | }, |
218 | 256 | "backends": [BackendType.ONNX, BackendType.OV], |
219 | 257 | "batch_size": 128, |
|
225 | 263 | "compression_params": { |
226 | 264 | "subset_size": 2, |
227 | 265 | "preset": QuantizationPreset.MIXED, |
| 266 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 267 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 268 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 269 | + ) |
| 270 | + ), |
228 | 271 | }, |
229 | 272 | "backends": ALL_PTQ_BACKENDS, |
230 | 273 | "batch_size": 128, |
|
236 | 279 | "compression_params": { |
237 | 280 | "subset_size": 2, |
238 | 281 | "preset": QuantizationPreset.MIXED, |
| 282 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 283 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 284 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 285 | + ) |
| 286 | + ), |
239 | 287 | }, |
240 | 288 | "backends": ALL_PTQ_BACKENDS, |
241 | 289 | "batch_size": 128, |
|
246 | 294 | "pipeline_cls": ImageClassificationTimm, |
247 | 295 | "compression_params": { |
248 | 296 | "subset_size": 4, |
| 297 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 298 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 299 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 300 | + ) |
| 301 | + ), |
249 | 302 | }, |
250 | 303 | "backends": NNCF_PTQ_BACKENDS, |
251 | 304 | "batch_size": 64, |
|
303 | 356 | "compression_params": { |
304 | 357 | "subset_size": 2, |
305 | 358 | "preset": QuantizationPreset.MIXED, |
| 359 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 360 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 361 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 362 | + ) |
| 363 | + ), |
306 | 364 | }, |
307 | 365 | "backends": ALL_PTQ_BACKENDS, |
308 | 366 | "batch_size": 128, |
|
314 | 372 | "compression_params": { |
315 | 373 | "subset_size": 2, |
316 | 374 | "preset": QuantizationPreset.MIXED, |
| 375 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 376 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 377 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 378 | + ) |
| 379 | + ), |
317 | 380 | }, |
318 | 381 | "backends": ALL_PTQ_BACKENDS, |
319 | 382 | "batch_size": 128, |
|
326 | 389 | "subset_size": 9, |
327 | 390 | "preset": QuantizationPreset.MIXED, |
328 | 391 | "model_type": ModelType.TRANSFORMER, |
| 392 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 393 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 394 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 395 | + ) |
| 396 | + ), |
329 | 397 | }, |
330 | 398 | "backends": [BackendType.OV], |
331 | 399 | "batch_size": 32, |
|
339 | 407 | "preset": QuantizationPreset.MIXED, |
340 | 408 | "model_type": ModelType.TRANSFORMER, |
341 | 409 | "advanced_parameters": AdvancedQuantizationParameters( |
342 | | - smooth_quant_alphas=AdvancedSmoothQuantParameters(matmul=-1) |
| 410 | + smooth_quant_alphas=AdvancedSmoothQuantParameters(matmul=-1), |
| 411 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 412 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 413 | + ), |
343 | 414 | ), |
344 | 415 | }, |
345 | 416 | "backends": [BackendType.TORCH, BackendType.CUDA_TORCH, BackendType.ONNX], |
|
352 | 423 | "compression_params": { |
353 | 424 | "subset_size": 2, |
354 | 425 | "preset": QuantizationPreset.MIXED, |
| 426 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 427 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 428 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 429 | + ) |
| 430 | + ), |
355 | 431 | }, |
356 | 432 | "backends": ALL_PTQ_BACKENDS, |
357 | 433 | "batch_size": 128, |
|
362 | 438 | "pipeline_cls": ImageClassificationTimm, |
363 | 439 | "compression_params": { |
364 | 440 | "subset_size": 2, |
| 441 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 442 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 443 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 444 | + ) |
| 445 | + ), |
365 | 446 | }, |
366 | 447 | "backends": NNCF_PTQ_BACKENDS, |
367 | 448 | "batch_size": 128, |
|
374 | 455 | "subset_size": 2, |
375 | 456 | "preset": QuantizationPreset.MIXED, |
376 | 457 | "model_type": ModelType.TRANSFORMER, |
| 458 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 459 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 460 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 461 | + ) |
| 462 | + ), |
377 | 463 | }, |
378 | 464 | "backends": ALL_PTQ_BACKENDS, |
379 | 465 | "batch_size": 128, |
|
385 | 471 | "compression_params": { |
386 | 472 | "subset_size": 2, |
387 | 473 | "preset": QuantizationPreset.MIXED, |
| 474 | + "advanced_parameters": AdvancedQuantizationParameters( |
| 475 | + activations_range_estimator_params=StatisticsCollectorParameters( |
| 476 | + statistics_type=StatisticsType.RAW, aggregator_type=AggregatorType.HISTOGRAM |
| 477 | + ) |
| 478 | + ), |
388 | 479 | }, |
389 | 480 | "backends": ALL_PTQ_BACKENDS, |
390 | 481 | "batch_size": 128, |
|
0 commit comments