Skip to content

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

[DOCS] Update NNCF weight compression LLM example (#25287)

Helena Kloostermane7ae7372ba5e
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 2d5fc0f1b98..67cd51a9554 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
@@ -226,7 +226,7 @@ is installed in your environment by running the following command:
.. code-block:: python
- pip install optimum[openvino,nncf]
+ pip install optimum[openvino]
The first example loads a pre-trained Hugging Face model using the Optimum Intel API,
compresses it to INT4 using NNCF, and then executes inference with a text phrase.
@@ -250,12 +250,13 @@ from Optimum Intel instead of NNCF to compress the model to INT8_ASYM.
# Load model from Hugging Face
model_id = "HuggingFaceH4/zephyr-7b-beta"
- model = OVModelForCausalLM.from_pretrained(model_id, export=True)
+ model = OVModelForCausalLM.from_pretrained(model_id, export=True, load_in_8bit=False, compile=False)
# Compress to INT4 Symmetric
- model.model = compress_weights(model.model, mode=CompressWeightsMode.INT4_SYM)
+ model.model = compress_weights(model.model, mode=CompressWeightsMode.INT4_SYM)
# Inference
+ model.compile()
tokenizer = AutoTokenizer.from_pretrained(model_id)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
phrase = "The weather is"