Skip to content

Commit

Permalink
improve-snippets (openvinotoolkit#19498)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgolebiewski-intel authored Aug 30, 2023
1 parent 3d17c65 commit fd519c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/optimization_guide/nncf/ptq/code/ptq_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def transform_fn(data_item):
#! [dataset]

#! [quantization]
model = ... # onnx.ModelProto object
import onnx
model = onnx.load("model_path")

quantized_model = nncf.quantize(model, calibration_dataset)
#! [quantization]
Expand Down
5 changes: 2 additions & 3 deletions docs/optimization_guide/nncf/ptq/code/ptq_openvino.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ def transform_fn(data_item):
#! [dataset]

#! [quantization]
model = ... # openvino.runtime.Model object
import openvino.runtime as ov
model = ov.Core().read_model("model_path")

quantized_model = nncf.quantize(model, calibration_dataset)
#! [quantization]

#! [inference]
import openvino.runtime as ov

# compile the model to transform quantized operations to int8
model_int8 = ov.compile_model(quantized_model)

Expand Down
3 changes: 2 additions & 1 deletion docs/optimization_guide/nncf/ptq/code/ptq_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def transform_fn(data_item):
#! [dataset]

#! [quantization]
model = ... # tensorflow.Module object
import tensorflow as tf
model = tf.saved_model.load("model_path")

quantized_model = nncf.quantize(model, calibration_dataset)
#! [quantization]
Expand Down
3 changes: 2 additions & 1 deletion docs/optimization_guide/nncf/ptq/code/ptq_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def transform_fn(data_item):
#! [dataset]

#! [quantization]
model = ... # torch.nn.Module object
import torchvision
model = torchvision.models.resnet50(pretrained=True)

quantized_model = nncf.quantize(model, calibration_dataset)
#! [quantization]
Expand Down

0 comments on commit fd519c7

Please sign in to comment.