nncf icon indicating copy to clipboard operation
nncf copied to clipboard

[Conformance] TorchFX/OV backends Alignment

Open daniil-lyakhov opened this issue 1 year ago • 9 comments

Changes

  • Constant folding is applied to all TorchFX models before the quantization
  • Some torchvision models (swin_v2_s, vit_16_b) are exported by torch.export.export before ov conversation
  • Moc transformations are applied to openvino compressed models after the compression

After the #2984

  • Fixed _compress_qdq_constant_transformation for per tensor case

Reason for changes

  • To align TorchFX/OV quantized models

Related tickets

#2766

Tests

post_training_quantization/504/ is finished successfully

daniil-lyakhov avatar Sep 30 '24 10:09 daniil-lyakhov

Please rerun post_training_quantization build.

alexsu52 avatar Oct 11 '24 09:10 alexsu52

Please rerun post_training_quantization build.

/post_training_quantization/504/ is finished successfully

daniil-lyakhov avatar Oct 11 '24 13:10 daniil-lyakhov

Please add unit tests for constant folding and docstrings.

AlexanderDokuchaev avatar Oct 14 '24 20:10 AlexanderDokuchaev

Please add unit tests for constant folding and docstrings.

tested by test_models by swin_v2_s and vit_b_16 models. The same test approach is done for other transformation. If you think we definitely need a unit test - let's create an issue for that

daniil-lyakhov avatar Oct 15 '24 11:10 daniil-lyakhov

@alexsu52 i will not review PR that adding transformation that will applied for any model in nncf.quantize without unit tests and any documentation.

AlexanderDokuchaev avatar Oct 16 '24 20:10 AlexanderDokuchaev

@AlexanderDokuchaev, please take a look

daniil-lyakhov avatar Oct 17 '24 13:10 daniil-lyakhov

In the case where the user gives a model with already inserted Quantize-Dequantize or Quantize-random_nodes-Dequantize, shouldn't it be ignored by constant folding? cc @alexsu52

anzr299 avatar Oct 21 '24 16:10 anzr299

@anzr299, I fixed _compress_qdq_constant_transformation function in the per tensor case and tested it by test_compress_post_quantize_transformation, take a look

daniil-lyakhov avatar Oct 22 '24 09:10 daniil-lyakhov

@anzr299, I fixed _compress_qdq_constant_transformation function in the per tensor case and tested it by test_compress_post_quantize_transformation, take a look

Oh, yes that implementation did not consider per_tensor quantization. Thank you for pointing it out!

anzr299 avatar Oct 22 '24 11:10 anzr299