Skip to main content
OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference. OpenVINO™ Runtime can enable running the same model optimized across various hardware devices. Accelerate your deep learning performance across use cases like: language + LLMs, computer vision, automatic speech recognition, and more. OpenVINO models can be run locally through the HuggingFacePipeline class. To deploy a model with OpenVINO, you can specify the backend="openvino" parameter to trigger OpenVINO as backend inference framework. To use, you should have the optimum-intel with OpenVINO Accelerator python package installed.

Model loading

Models can be loaded by specifying the model parameters using the from_model_id method. If you have an Intel GPU, you can specify model_kwargs={"device": "GPU"} to run inference on it.
They can also be loaded by passing in an existing optimum-intel pipeline directly

Create chain

With the model loaded into memory, you can compose it with a prompt to form a chain.
To get response without prompt, you can bind skip_prompt=True with LLM.

Inference with local OpenVINO model

It is possible to export your model to the OpenVINO IR format with the CLI, and load the model from local folder.
It is recommended to apply 8 or 4-bit weight quantization to reduce inference latency and model footprint using --weight-format:
You can get additional inference speed improvement with Dynamic Quantization of activations and KV-cache quantization. These options can be enabled with ov_config as follows:

Streaming

You can use stream method to get a streaming of LLM output,
For more information refer to: