[OpenVINO] export and inference support for Ministral3 (ministral3) VLM#1659
Open
dhandhalyabhavik wants to merge 1 commit intohuggingface:mainfrom
Open
[OpenVINO] export and inference support for Ministral3 (ministral3) VLM#1659dhandhalyabhavik wants to merge 1 commit intohuggingface:mainfrom
dhandhalyabhavik wants to merge 1 commit intohuggingface:mainfrom
Conversation
Enable mistralai/Ministral-3-3B-Instruct-2512 (model_type: mistral3) for OpenVINO export via optimum-cli and inference via OVModelForVisualCausalLM. The model is a Vision-Language Model with a PixtralVisionModel encoder, Mistral3MultiModalProjector with 2x2 PatchMerger, and MinistralModel decoder. Changes: - model_configs.py: Add Mistral3OpenVINOConfig with VLM sub-model configs, register _CUSTOM_CLASSES for mistral3, register ministral3 in CONFIG_MAPPING - model_patcher.py: Add _mistral3_vision_embed_forward (inlines full vision pipeline to keep all shapes dynamic in OpenVINO IR), add Mistral3ImageEmbeddingModelPatcher and Mistral3LanguageModelPatcher (fixes sliding_window=None crash in MinistralModel) - utils.py: Add mistral3 to MULTI_MODAL_TEXT_GENERATION_MODELS - __main__.py: Add FP8 dequantization handling for FP8-quantized source models - modeling_visual_language.py: Add _OVMistral3ForCausalLM inference class with masked_scatter-based vision/text embedding merge, add to MODEL_TYPE_TO_CLS_MAPPING Tested with FP16, INT8, and INT4 exports — text-only and image+text inference produce correct results across all precisions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable mistralai/Ministral-3-3B-Instruct-2512 (model_type: mistral3) for OpenVINO export via optimum-cli and inference via OVModelForVisualCausalLM.
The model is a Vision-Language Model with a PixtralVisionModel encoder, Mistral3MultiModalProjector with 2x2 PatchMerger, and MinistralModel decoder.
Changes:
Tested with FP16, INT8, and INT4 exports — text-only and image+text inference produce correct results across all precisions.
Tested multi-turn conversation with following chat-ministral.py file
Output: