How to Install Optimum Intel from Source and Convert DFlash Models
Install the latest Optimum Intel development code with OpenVINO nightly and use it to export supported models, including Qwen DFlash draft models, to OpenVINO IR.
How to Install Optimum Intel from Source and Convert DFlash Models
Optimum Intel is the Hugging Face interface between Transformers and OpenVINO. It can export supported models to OpenVINO IR, apply NNCF weight compression, and provide OpenVINO-backed inference on Intel CPUs, GPUs, and other supported Intel accelerators.
For newer OpenVINO model features, install Optimum Intel from source and pair it with an OpenVINO nightly build. Installing a released Optimum Intel package together with an older released OpenVINO package can leave you without features that are only present in the current development code.
What Optimum Intel is useful for
Optimum Intel provides several important pieces of the OpenVINO model workflow:
- Convert Hugging Face PyTorch models into OpenVINO IR.
- Export decoder LLMs with past key values for efficient generation.
- Compress model weights to formats such as INT8 and INT4 through NNCF.
- Load exported models with
OVModelFor*classes. - Prepare models for OpenVINO GenAI inference.
- Support specialized model architectures and export paths that are being added to the development branch.
- Export DFlash draft models for OpenVINO-based speculative decoding workflows.
The current Optimum Intel model list explicitly includes DFlash families such as Qwen3 DFlash, Qwen3.5 DFlash, Qwen3.6 DFlash, and Qwen3-Coder-30B-A3B-DFlash.
Why use the source version
Optimum Intel is a fast-moving project. The upstream project itself recommends installing from source when you need the latest development functionality.
Create a clean virtual environment first:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
Then install Optimum Intel directly from its Git repository with the OpenVINO dependencies:
python -m pip install "optimum-intel[openvino] @ git+https://github.com/huggingface/optimum-intel.git"
This installs the development version of Optimum Intel rather than the version currently published on PyPI.
Pair it with OpenVINO nightly
This is the important part: use the OpenVINO nightly build with the source version of Optimum Intel.
Install the nightly wheels with:
python -m pip install --pre -U openvino --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
If you already installed a stable OpenVINO release in the environment, upgrade it using the command above so the environment is actually using the nightly package.
You can verify the installed versions with:
python -c "import openvino, optimum.intel; print('OpenVINO:', openvino.__version__); print('Optimum Intel:', getattr(optimum.intel, '__version__', 'unknown'))"
The reason for keeping these components aligned is that Optimum Intel’s development branch can depend on OpenVINO functionality that has not reached the stable release you happen to have installed.
Basic model conversion
Once the environment is installed, optimum-cli can export a supported Hugging Face model to OpenVINO IR:
optimum-cli export openvino \
--model Qwen/Qwen3-8B \
--task text-generation-with-past \
qwen3-8b-openvino
The output directory contains the OpenVINO model representation, including the XML graph and binary weights.
For a local model, replace the model ID with its local directory:
optimum-cli export openvino \
--model ./my-model \
--task text-generation-with-past \
./my-model-openvino
If the model requires custom Transformers code, add --trust-remote-code when appropriate.
Converting DFlash models
DFlash models are a specialized case. DFlash provides a draft model used for speculative decoding rather than simply being another ordinary dense LLM checkpoint.
The current Optimum Intel source contains an explicit DFlash export path. Its model loader recognizes the DFlashDraftModel architecture and maps it to the Qwen3 DFlash model classes. During export, Optimum Intel also writes DFlash-specific runtime information into the resulting OpenVINO model.
The supported DFlash model families currently listed by Optimum Intel include:
Qwen3-*-DFlashQwen3.5-*-DFlashQwen3.6-*-DFlashQwen3-Coder-30B-A3B-DFlash
A DFlash model can be supplied to the same OpenVINO exporter. For example, for a local DFlash checkpoint:
optimum-cli export openvino \
--model ./qwen3-dflash \
--task text-generation \
./qwen3-dflash-openvino
The important distinction is that the checkpoint must actually be a supported DFlash draft model. A normal Qwen checkpoint is not magically turned into a DFlash draft model by adding a command-line option.
When working with a DFlash repository from the Hugging Face Hub, the same pattern applies:
optimum-cli export openvino \
--model <DFlash-model-id> \
--task text-generation \
./dflash-openvino
Use the task and model format required by the particular DFlash checkpoint. If automatic task detection does not select the correct task, specify it explicitly.
DFlash export is not the same as ordinary model quantization
Do not confuse DFlash export with --weight-format int4 or another weight-compression option.
For example:
optimum-cli export openvino \
--model <model> \
--weight-format int4 \
./model-openvino
asks Optimum Intel to perform OpenVINO weight compression during export. DFlash support, on the other hand, preserves the information needed to use the exported draft model in a DFlash speculative-decoding workflow.
If you already have a quantized DFlash checkpoint and your goal is to preserve its existing precision rather than quantize it again, do not blindly add --weight-format int4. Export it using the appropriate DFlash model checkpoint and let the exporter handle the model architecture.
Why the nightly OpenVINO build matters for DFlash
The DFlash export path is part of the newer Optimum Intel development code. The exporter adds DFlash-specific runtime metadata to the OpenVINO graph, and the source tree contains dedicated DFlash export tests.
That makes the combination important:
Optimum Intel source
+
OpenVINO nightly
↓
latest exporter functionality
↓
OpenVINO IR
↓
OpenVINO GenAI / DFlash inference workflow
Using an older stable OpenVINO runtime with a newer Optimum Intel checkout can produce compatibility errors or missing functionality. If you are specifically trying to use a newly added exporter feature, update both sides rather than mixing an old OpenVINO installation with the newest Optimum Intel source.
Checking the exporter
After installation, make sure the CLI is available:
optimum-cli export openvino --help
You can also verify that Python can import the OpenVINO and Optimum Intel packages:
python -c "import openvino; from optimum.intel import OVModelForCausalLM; print(openvino.__version__)"
For debugging an export, it is useful to keep the exact Git revision and package versions. Development exporters can change rapidly, so reproducing a successful conversion is much easier when the environment is recorded.
Loading the resulting IR model
An ordinary exported causal language model can be loaded through Optimum Intel:
from optimum.intel import OVModelForCausalLM
from transformers import AutoTokenizer
model_dir = "qwen3-8b-openvino"
model = OVModelForCausalLM.from_pretrained(model_dir)
tokenizer = AutoTokenizer.from_pretrained(model_dir)
OpenVINO GenAI can also consume OpenVINO IR models for generative inference, depending on the model and workflow.
Source installation in one command sequence
For a fresh environment, the essential setup is:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install "optimum-intel[openvino] @ git+https://github.com/huggingface/optimum-intel.git"
python -m pip install --pre -U openvino --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
Then export a model:
optimum-cli export openvino \
--model <model-id-or-local-path> \
--task text-generation-with-past \
./openvino-model
For a supported DFlash checkpoint, use its DFlash model directory or Hub ID and the task appropriate for that checkpoint.
Summary
Optimum Intel is the conversion and optimization layer between Hugging Face models and OpenVINO. Installing it from source gives access to the newest exporter functionality, while OpenVINO nightly provides the corresponding development runtime.
For current DFlash work, the recommended setup is therefore Optimum Intel from source + OpenVINO nightly. The current source explicitly supports multiple Qwen DFlash families and contains dedicated DFlash export handling. Once exported, the model is represented as OpenVINO IR and can be used by the appropriate OpenVINO inference stack.
Comments
One comment per thread every 30 minutes · edits are unlimited.