0

Visual-language assistant with MiniCPM-V 4.7 and OpenVINO

MiniCPM-V 4.7 adds canvas M-RoPE to the MiniCPM-V architecture so image slices retain their spatial positions and video frames retain their temporal order.

Example · مثال

Content

Visual-language assistant with MiniCPM-V 4.7 and OpenVINO

MiniCPM-V 4.7 adds canvas M-RoPE to the MiniCPM-V architecture so image slices retain their spatial positions and video frames retain their temporal order.

The [notebook](./minicpm-v-4.7.ipynb) downloads a preconverted OpenVINO model by default. Clear the Use preconverted model checkbox to export the 1B dense or 35B-A3B MoE checkpoint from a local directory or Hugging Face model ID with Optimum Intel instead. Inference uses the OpenVINO GenAI VLMPipeline for text, single-image, multi-image, document, and video responses. INT8 is the default weight format; INT4 and FP16 are selectable. Thinking can be enabled per inference request. The optional Gradio 6.29.1+ image demo uses [gradio_helper.py](./gradio_helper.py) and has an examples table with image previews, questions, and thinking settings; its streamed thinking appears in a collapsible block.

Text, image, and non-thinking Gradio responses allow up to 512 new tokens; the video example allows up to 2048, and the Gradio thinking mode allows up to 1024. These are limits, not required output lengths.

The official model collection includes openbmb/MiniCPM-V-4.7-1B and openbmb/MiniCPM-V-4.7-35B-A3B. Preconverted models are available for 1B INT8, 1B INT4, 1B FP16, 35B-A3B INT8, and 35B-A3B INT4. The selected model downloads into OpenVINO-<checkpoint>-ov/<weight-format>; rerunning the cell uses the Hugging Face cache to resume or update it. There is no published 35B-A3B FP16 conversion; clear the checkbox to export it locally.

For local conversion only, an empty Export source: field uses the selected checkpoint's local directory if it exists; otherwise, it exports the published openbmb/<checkpoint> model. Enter a local directory or Hugging Face ID to override this choice. Exports go to <model-name>-ov/<weight-format> (for example, MiniCPM-V-4.7-1B-ov/int8), separately from downloaded conversions and local source checkpoints. The 35B-A3B download requires substantial disk space; conversion also requires RAM for the original weights.

The published 1B INT4 conversion uses group size 128 without calibration. A fresh canonical-ID local export uses tuned INT4 defaults: asymmetric group size 64, ratio 1.0, and GSM8K scale estimation. Neither a downloaded IR nor a previously exported directory is updated automatically; use a new output directory for re-export.

An optional DSpark speculative decoding section exports a separate, correctly paired target and -DSpark draft: 1B INT8 + INT4 draft, or 35B-A3B INT4 + INT4 draft. Enable Run DSpark example to download, export, and load this additional pair; leave it disabled for the ordinary tutorial. This text-only example uses the selected checkpoint but not the export-source/weight/download controls, writes to dspark-models, and preserves the draft-free image/video examples and Gradio demo. It requires memory for an additional target and draft. CPU/GPU continuous batching, greedy decoding, one return sequence, and no prefix caching are used; NPU is not supported. See the merged GenAI implementation. Draft counts do not establish an accuracy or speed improvement.

After the first download or export, the last cell can be run on its own after a kernel restart. The helper discovers downloaded and exported models, caches sample images under demo_examples, and loads the selected model on the first request; select the model and device in the Gradio form. Keep gradio_helper.py alongside the notebook. If the model was loaded by the notebook earlier in the same kernel, the helper reuses it.

The demo starts locally. Only if Gradio reports that localhost is inaccessible does the launch retry with share=True, creating a public link accessible to anyone with its URL. For remote hosting, set server_name and server_port explicitly in the last cell.

⚠️ EXPERIMENTAL NOTEBOOK

Model support is merged upstream, but full-model validation across devices is not complete.

Keep the exported model's visual downsampling configuration; do not override it with 4x.

Use Python 3.11–3.13. MiniCPM-V 4.7 and DSpark support are included in Optimum Intel 2.3.0 (cut from f09a56ac) and OpenVINO / OpenVINO GenAI >=2026.5.0. For reproducibility, the notebook installs optimum-intel>=2.3.0,<2.4, pins Transformers to 5.18.0 and NNCF to 3.4.0, and requires OpenVINO >=2026.5.0 and Tokenizers/GenAI >=2026.5.0.0. See the notebook's [prerequisites](./minicpm-v-4.7.ipynb#Prerequisites) for the merged support and GPU fixes. Existing DSpark exports must match the export contract expected by the installed runtime.

The exporter declares transformers<5.16, although MiniCPM-V 4.7 requires 5.18. As in the upstream MiniCPM DSpark CI setup, dependencies are installed explicitly and Optimum Intel is installed with --no-deps. pip check reports this known metadata conflict; the environment is not resolver-clean. Restart the kernel after installation. Full-model execution on each advertised device is still required to validate results.

Installation Instructions

Use a dedicated Python environment with Jupyter installed and run the notebook cells in order. The notebook installs its own model dependencies. For Jupyter setup, see the [installation guide](../../README.md).

Source and license

Source
Intel OpenVINO Notebooks
Original
openvinotoolkit/openvino_notebooks/notebooks/minicpm-v-4.7
License
Apache-2.0