[Bugfix] Fix humming lm_head crash and FusedMoE weight_shape coercion (#46420)

Signed-off-by: mgoin <mgoin64@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael Goin
2026-06-22 18:19:29 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent e48592066e
commit 8207ce0850
5 changed files with 27 additions and 7 deletions
@@ -0,0 +1,5 @@
model_name: "google/gemma-4-E4B-it-qat-mobile-ct"
accuracy_threshold: 0.50
num_questions: 1319
num_fewshot: 5
server_args: "--enforce-eager --max-model-len 4096"
+2 -1
View File
@@ -4,4 +4,5 @@ Llama-3-8B-Instruct-nonuniform-CT.yaml
Qwen2.5-VL-3B-Instruct-FP8-dynamic.yaml
Qwen1.5-MoE-W4A16-CT.yaml
DeepSeek-V2-Lite-Instruct-FP8.yaml
Qwen3-30B-A3B-MXFP4A16.yaml
Qwen3-30B-A3B-MXFP4A16.yaml
gemma-4-E4B-it-qat-mobile-ct.yaml
@@ -70,6 +70,15 @@ def test_gsm8k_correctness(config_filename):
"Marlin kernels are not supported."
)
if (
not current_platform.is_cuda()
and "gemma-4-E4B-it-qat-mobile-ct" in eval_config["model_name"]
):
pytest.skip(
"Skipping gemma-4-E4B-it-qat-mobile-ct on non-CUDA platforms. "
"Its W2A16 (uint2b2) scheme has no kernel outside CUDA."
)
# TODO(akaratza): Enable DeepSeek-V3.2 and DeepSeek-R1 on ROCm platforms
if current_platform.is_rocm() and (
"deepseek-ai/DeepSeek-V3.2" in eval_config["model_name"]
@@ -530,8 +530,10 @@ class RoutedExperts(PluggableLayer):
):
param_data = param.data
# Input scales can be loaded directly and should be equal.
param_data[expert_id] = self._to_scalar(loaded_weight)
# Used for both scalar input_scale and the size-2 `weight_shape`
# param (compressed-tensors). Assign directly so both shapes load;
# _to_scalar's reshape(()) would reject the size-2 weight_shape.
param_data[expert_id] = loaded_weight
def _load_g_idx(
self,
@@ -83,10 +83,13 @@ def prepare_humming_layer(layer: LinearBase, quant_config: dict):
input_schema = HummingInputSchema()
# ReplicatedLinear has no TP partitioning and so does not set
# input_size_per_partition; for it that is just input_size.
input_size_per_partition = getattr(
layer, "input_size_per_partition", layer.input_size
)
# input_size_per_partition; for it that is just input_size. Use hasattr
# rather than getattr's default arg, which is evaluated eagerly and would
# raise on layers lacking input_size (e.g. ParallelLMHead).
if hasattr(layer, "input_size_per_partition"):
input_size_per_partition = layer.input_size_per_partition
else:
input_size_per_partition = layer.input_size
shape_k_stacks = [input_size_per_partition]
shape_n_stacks = layer.output_partition_sizes