From edca360f13aeff2f5a76cc288c87d5af55d080b8 Mon Sep 17 00:00:00 2001 From: Mikko Tukiainen Date: Mon, 5 Oct 2026 13:40:02 +0300 Subject: [PATCH] [Bugfix][Qwen4Exp] Load PLE tables unquantized under Quark checkpoints (#59443) Signed-off-by: Mikko Tukiainen Co-authored-by: Cursor Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: TJian --- tests/models/qwen4_exp/test_ple.py | 11 +++++++++++ vllm/models/qwen4_exp/common/ngram_embedding.py | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/tests/models/qwen4_exp/test_ple.py b/tests/models/qwen4_exp/test_ple.py index 85c9122c9d..1ad44e8304 100644 --- a/tests/models/qwen4_exp/test_ple.py +++ b/tests/models/qwen4_exp/test_ple.py @@ -26,6 +26,7 @@ from vllm.model_executor.layers.quantization.modelopt import ( ModelOptNvFp4Config, ) from vllm.model_executor.layers.quantization.online.base import OnlineQuantizationConfig +from vllm.model_executor.layers.quantization.quark.quark import QuarkConfig from vllm.models.qwen4_exp.amd import ple_layer as amd_ple_layer from vllm.models.qwen4_exp.amd.ple_layer import ( Qwen4ExpPLELayer as Qwen4ExpPLELayerAMD, @@ -585,6 +586,16 @@ def test_ple_embedding_respects_inc_layer_config() -> None: Qwen4ExpPLEEmbeddingMethod.from_quant_config(quant_config, prefix) +def test_ple_embedding_is_unquantized_under_quark() -> None: + prefix = "model.layers.1.ple.ple_embedding.ngram_embedding" + quant_config = QuarkConfig({"exclude": [], "global_quant_config": {}}) + + assert isinstance( + Qwen4ExpPLEEmbeddingMethod.from_quant_config(quant_config, prefix), + Qwen4ExpPLEUnquantizedEmbeddingMethod, + ) + + def test_ple_embedding_dtype_overrides_modelopt_exclusion() -> None: prefix = "model.layers.1.ple.ple_embedding.ngram_embedding" quant_config = ModelOptNvFp4Config(exclude_modules=[prefix]) diff --git a/vllm/models/qwen4_exp/common/ngram_embedding.py b/vllm/models/qwen4_exp/common/ngram_embedding.py index 6b4ea9e98f..24eac4f876 100644 --- a/vllm/models/qwen4_exp/common/ngram_embedding.py +++ b/vllm/models/qwen4_exp/common/ngram_embedding.py @@ -32,6 +32,7 @@ from vllm.model_executor.layers.quantization.modelopt import ( ModelOptMixedPrecisionConfig, ModelOptQuantConfigBase, ) +from vllm.model_executor.layers.quantization.quark.quark import QuarkConfig from vllm.model_executor.layers.quantization.utils.fp8_utils import ( create_fp8_scale_parameter, ) @@ -196,6 +197,9 @@ class Qwen4ExpPLEEmbeddingMethod(QuantizeMethodBase): and not quant_config.config_parser.resolve(None, prefix).quantized ): return Qwen4ExpPLEUnquantizedEmbeddingMethod() + # Quark quantizes only Linear and MoE layers; PLE tables stay BF16. + if isinstance(quant_config, QuarkConfig): + return Qwen4ExpPLEUnquantizedEmbeddingMethod() if not isinstance(quant_config, Fp8Config): raise NotImplementedError( "Qwen4Exp PLE embedding does not support quantization config "