OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Remove disable_tracing (#30179)
Alexander Dokuchaevdcc995695bbb
diff --git a/docs/optimization_guide/nncf/ptq/code/ptq_torch_fx.py b/docs/optimization_guide/nncf/ptq/code/ptq_torch_fx.pyindex 932c709b48a..fcb02ac0f47 100644--- a/docs/optimization_guide/nncf/ptq/code/ptq_torch_fx.py+++ b/docs/optimization_guide/nncf/ptq/code/ptq_torch_fx.py@@ -16,14 +16,12 @@ calibration_dataset = nncf.Dataset(calibration_loader, transform_fn)#! [quantization]import torchvision-from nncf.torch import disable_patchinginput_fp32 = torch.ones((1, 3, 224, 224)) # FP32 model inputmodel = torchvision.models.resnet50(pretrained=True)-with disable_patching():- exported_model = torch.export.export_for_training(model, args=(input_fp32,)).module()- quantized_model = nncf.quantize(exported_model, calibration_dataset)+exported_model = torch.export.export_for_training(model, args=(input_fp32,)).module()+quantized_model = nncf.quantize(exported_model, calibration_dataset)#! [quantization]#! [inference]@@ -32,13 +30,12 @@ import openvino.torchinput_fp32 = ... # FP32 model input# compile quantized model using torch.compile API-with disable_patching():- compiled_model_int8 = torch.compile(quantized_model, backend="openvino")- # OpenVINO backend compiles the model during the first call,- # so the first call is expected to be slower than the following calls- res = compiled_model_int8(input_fp32)-- # save the model- exported_program = torch.export.export(quantized_model, args=(input_fp32,))- torch.export.save(exported_program, 'exported_program.pt2')+compiled_model_int8 = torch.compile(quantized_model, backend="openvino")+# OpenVINO backend compiles the model during the first call,+# so the first call is expected to be slower than the following calls+res = compiled_model_int8(input_fp32)++# save the model+exported_program = torch.export.export(quantized_model, args=(input_fp32,))+torch.export.save(exported_program, 'exported_program.pt2')#! [inference]