From 6f786f2c506cb07f4566771fdc62e640e2c4a176 Mon Sep 17 00:00:00 2001 From: Thomas <153741656+thomasmaindron@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:11:18 +0200 Subject: [PATCH] [Bugfix][Model] Fix Devstral Small 2 HF format weight loading (#39293) Signed-off-by: thomasmaindron Co-authored-by: thomasmaindron Co-authored-by: Claude Opus 4.6 (1M context) --- tests/models/registry.py | 1 + vllm/model_executor/models/mistral3.py | 16 +++++++++------- vllm/model_executor/models/registry.py | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/models/registry.py b/tests/models/registry.py index 45733f7d43..92ebac0184 100644 --- a/tests/models/registry.py +++ b/tests/models/registry.py @@ -416,6 +416,7 @@ _TEXT_GENERATION_EXAMPLE_MODELS = { "MiniMaxAI/MiniMax-M2", trust_remote_code=True, ), + "Ministral3ForCausalLM": _HfExamplesInfo("mistralai/Ministral-3-3B-Instruct-2512"), "MistralForCausalLM": _HfExamplesInfo("mistralai/Mistral-7B-Instruct-v0.1"), "MistralLarge3ForCausalLM": _HfExamplesInfo( "mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4" diff --git a/vllm/model_executor/models/mistral3.py b/vllm/model_executor/models/mistral3.py index 0ece3dda2e..025ce56408 100644 --- a/vllm/model_executor/models/mistral3.py +++ b/vllm/model_executor/models/mistral3.py @@ -382,7 +382,14 @@ class Mistral3ForConditionalGeneration( # Some PEFT LoRAs are trained against the text submodule directly # and produce names like `base_model.model.model.layers.*`. "model.": "language_model.model.", - } + }, + orig_to_new_suffix={ + # FP8 quantized HF checkpoints use "activation_scale" and + # "weight_scale_inv" but vLLM's FP8 linear layers register + # them as "input_scale" and "weight_scale" + ".activation_scale": ".input_scale", + ".weight_scale_inv": ".weight_scale", + }, ) @classmethod @@ -402,13 +409,8 @@ class Mistral3ForConditionalGeneration( self.config = config self.multimodal_config = multimodal_config - # NOTE: These are special cases for Pixtral-12B in the HF-format + # NOTE: This is a special case for Pixtral-12B in the HF-format # https://huggingface.co/mistral-community/pixtral-12b/blob/main/config.json # noqa - if ( - config.text_config.architectures is None - and config.text_config.model_type == "mistral" - ): - config.text_config.architectures = ["MistralForCausalLM"] if ( config.projector_hidden_act is None and config.vision_config.hidden_act == "gelu" diff --git a/vllm/model_executor/models/registry.py b/vllm/model_executor/models/registry.py index 948618d82a..ef89e159fe 100644 --- a/vllm/model_executor/models/registry.py +++ b/vllm/model_executor/models/registry.py @@ -160,6 +160,7 @@ _TEXT_GENERATION_MODELS = { "MiniMaxText01ForCausalLM": ("minimax_text_01", "MiniMaxText01ForCausalLM"), "MiniMaxM1ForCausalLM": ("minimax_text_01", "MiniMaxText01ForCausalLM"), "MiniMaxM2ForCausalLM": ("minimax_m2", "MiniMaxM2ForCausalLM"), + "Ministral3ForCausalLM": ("mistral", "MistralForCausalLM"), "MistralForCausalLM": ("mistral", "MistralForCausalLM"), "MistralLarge3ForCausalLM": ("mistral_large_3", "MistralLarge3ForCausalLM"), "MixtralForCausalLM": ("mixtral", "MixtralForCausalLM"),