Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Update NNCF documentation (#32600)

Andrey Churkin59b73fe37a1f
diff --git a/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst b/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst
index 5f1eb71cc36..337a32e45f7 100644
--- a/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst
+++ b/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst
@@ -132,19 +132,20 @@ By default, weights are compressed asymmetrically to "INT8_ASYM" mode.
results = pipe(phrase)
print(results)
+The NNCF ``nncf.compress_weights()`` API can also be used directly with models from various frameworks, including OpenVINO, TorchFX, PyTorch, and ONNX.
+The API can be applied in the same way across all frameworks; only the type of the input model differs. Here is an example of code to perform asymmetrical
+8-bit data-free weight quantization of a model:
-Here is an example of code using NNCF to perform asymmetrical 8-bit weight quantization of
-a model in the OpenVINO IR format:
-
-.. tab-set::
+.. code-block:: python
- .. tab-item:: OpenVINO
- :sync: openvino
+ from nncf import compress_weights
- .. doxygensnippet:: docs/optimization_guide/nncf/code/weight_compression_openvino.py
- :language: python
- :fragment: [compression_8bit]
+ ...
+ # The `model` type depends on the framework:
+ # openvino.Model for OpenVINO, onnx.ModelProto for ONNX,
+ # torch.fx.GraphModule for TorchFX, and torch.nn.Module for PyTorch.
+ compressed_model = compress_weights(model)
**4-bit weight quantization** is actually a mixed-precision compression,
primarily INT4 and a backup asymmetric INT8 precisions. It produces a smaller model,
@@ -300,8 +301,11 @@ for details of the usage.
scale_estimation=True
) # The model is openvino.Model.
-For data-aware weight compression refer to the following
-`example <https://github.com/openvinotoolkit/nncf/tree/develop/examples/llm_compression/openvino/tiny_llama>`__.
+Data-aware weight compression is supported for multiple backends, including OpenVINO, ONNX, TorchFX, and PyTorch. See the following examples:
+
+- `OpenVINO example <https://github.com/openvinotoolkit/nncf/tree/develop/examples/llm_compression/openvino/tiny_llama>`__
+- `ONNX example <https://github.com/openvinotoolkit/nncf/tree/develop/examples/llm_compression/onnx/tiny_llama_scale_estimation>`__
+- `TorchFX example <https://github.com/openvinotoolkit/nncf/tree/develop/examples/llm_compression/torch_fx/tiny_llama>`__
.. note::
diff --git a/docs/optimization_guide/nncf/code/weight_compression_openvino.py b/docs/optimization_guide/nncf/code/weight_compression_openvino.py
deleted file mode 100644
index d66fb28f424..00000000000
--- a/docs/optimization_guide/nncf/code/weight_compression_openvino.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#! [compression_8bit]
-from nncf import compress_weights
-
-...
-model = compress_weights(model) # model is openvino.Model object
-#! [compression_8bit]
-
-#! [compression_4bit]
-from nncf import compress_weights, CompressWeightsMode
-
-...
-model = compress_weights(model, mode=CompressWeightsMode.INT4_SYM, group_size=128, ratio=0.8) # model is openvino.Model object
-#! [compression_4bit]
\ No newline at end of file