@@ -74,7 +74,7 @@ OpenVINO and NNCF could be easily installed via `pip distribution <https://docs.
7474.. code-block :: bash
7575
7676 pip install -U pip
77- pip install openvino, nncf
77+ pip install openvino nncf
7878
7979
8080 1. Capture FX Graph
@@ -84,7 +84,6 @@ We will start by performing the necessary imports, capturing the FX Graph from t
8484
8585.. code-block :: python
8686
87- import copy
8887 import openvino.torch
8988 import torch
9089 import torchvision.models as models
@@ -106,7 +105,7 @@ We will start by performing the necessary imports, capturing the FX Graph from t
106105 example_inputs = (x,)
107106
108107 # Capture the FX Graph to be quantized
109- with torch.no_grad(), nncf.torch.disable_patching() :
108+ with torch.no_grad():
110109 exported_model = torch.export.export(model, example_inputs).module()
111110
112111
@@ -204,7 +203,7 @@ After that the FX Graph can utilize OpenVINO optimizations using `torch.compile(
204203
205204.. code-block :: python
206205
207- with torch.no_grad(), nncf.torch.disable_patching() :
206+ with torch.no_grad():
208207 optimized_model = torch.compile(quantized_model, backend = " openvino" )
209208
210209 # Running some benchmark
@@ -235,6 +234,10 @@ These advanced NNCF algorithms can be accessed via the NNCF `quantize_pt2e` API:
235234
236235
237236 calibration_dataset = nncf.Dataset(calibration_loader, transform_fn)
237+
238+ with torch.no_grad():
239+ exported_model = torch.export.export(model, example_inputs).module()
240+
238241 quantized_model = quantize_pt2e(
239242 exported_model, quantizer, calibration_dataset, smooth_quant = True , fast_bias_correction = False
240243 )
0 commit comments