[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
@@ -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