@@ -74,7 +74,7 @@ OpenVINO and NNCF could be easily installed via `pip distribution <https://docs.
74
74
.. code-block :: bash
75
75
76
76
pip install -U pip
77
- pip install openvino, nncf
77
+ pip install openvino nncf
78
78
79
79
80
80
1. Capture FX Graph
@@ -84,7 +84,6 @@ We will start by performing the necessary imports, capturing the FX Graph from t
84
84
85
85
.. code-block :: python
86
86
87
- import copy
88
87
import openvino.torch
89
88
import torch
90
89
import torchvision.models as models
@@ -106,7 +105,7 @@ We will start by performing the necessary imports, capturing the FX Graph from t
106
105
example_inputs = (x,)
107
106
108
107
# Capture the FX Graph to be quantized
109
- with torch.no_grad(), nncf.torch.disable_patching() :
108
+ with torch.no_grad():
110
109
exported_model = torch.export.export(model, example_inputs).module()
111
110
112
111
@@ -204,7 +203,7 @@ After that the FX Graph can utilize OpenVINO optimizations using `torch.compile(
204
203
205
204
.. code-block :: python
206
205
207
- with torch.no_grad(), nncf.torch.disable_patching() :
206
+ with torch.no_grad():
208
207
optimized_model = torch.compile(quantized_model, backend = " openvino" )
209
208
210
209
# Running some benchmark
@@ -235,6 +234,10 @@ These advanced NNCF algorithms can be accessed via the NNCF `quantize_pt2e` API:
235
234
236
235
237
236
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
+
238
241
quantized_model = quantize_pt2e(
239
242
exported_model, quantizer, calibration_dataset, smooth_quant = True , fast_bias_correction = False
240
243
)
0 commit comments