vllm.model_executor.layers.quantization.utils.humming
¶
Humming quantization integration.
Modules:
-
activation–MoE activation expressions for Humming input processing.
-
linear–Prepare and execute Humming linear layers.
-
moe–Configure, prepare weights for, and assemble Humming MoE kernels.
-
priority–Humming kernel selection priority.
-
schema–Map Humming schemas and handle shared checkpoint quantization settings.
Functions:
-
convert_linear_layer_to_humming_standard–Rename/reshape a linear layer's quantized params (the canonical MPLinear
-
convert_to_humming_moe_kernel_format–Convert MoE weights from checkpoint format to Humming kernel format.
-
prefers_humming–Whether Humming outranks Marlin. A missing compute capability uses the
-
prioritize_humming–Move Humming directly ahead of Marlin where Humming is preferred.
-
select_humming_moe_experts–Select the primary Humming MoE Experts class
-
stage_moe_weights_for_humming–Install canonical weights and scales for Humming's layer-based converter.
convert_linear_layer_to_humming_standard(layer, name_map)
¶
Rename/reshape a linear layer's quantized params (the canonical MPLinear
layout: weight_packed int32 + weight_scale) into the parameter names
and layout humming's weight schema expects (weight / weight_scale).
Source code in vllm/model_executor/layers/quantization/utils/humming/linear.py
convert_to_humming_moe_kernel_format(layer, quant_config=None, sublayer_configs=None, weight_schema=None, input_schema=None, force_weight_schema=None, allow_input_schema_fallback=True)
¶
Convert MoE weights from checkpoint format to Humming kernel format.
This function processes weights for each sublayer (w13, w2) by: 1. Converting from checkpoint format to humming format if needed 2. Force requanting if a different quantization schema is specified 3. Preparing layer metadata for the Humming kernel 4. Transforming weights for inference
Parameters:
-
(layer¶RoutedExperts) –The RoutedExperts layer containing weights to process
-
(quant_config¶dict | None, default:None) –Optional quantization config dict. Required if weight_schema or input_schema are None. Used to build schemas via BaseWeightSchema.from_config().
-
(sublayer_configs¶dict[str, Any] | None, default:None) –Optional configuration dict for each sublayer (w13, w2). Each config must have "shape_n" and "shape_k" keys. If None, configs are built from layer.moe_config properties.
-
(weight_schema¶Any | None, default:None) –Optional initial weight quantization schema. If None, built from quant_config.
-
(input_schema¶Any | None, default:None) –Optional initial input quantization schema. If None, built from quant_config or env vars.
-
(force_weight_schema¶Any | None, default:None) –Optional schema to force requantization to
-
(allow_input_schema_fallback¶bool, default:True) –Whether incompatible input schemas may be replaced.
Side effects
- Modifies layer parameters in place
- Sets layer.weight_schemas and layer.input_schemas
- Sets layer.humming_configs for quant config construction
Source code in vllm/model_executor/layers/quantization/utils/humming/moe.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
prefers_humming(compute_capability=None)
¶
Whether Humming outranks Marlin. A missing compute capability uses the current device.
Source code in vllm/model_executor/layers/quantization/utils/humming/priority.py
prioritize_humming(kernels, compute_capability=None)
¶
Move Humming directly ahead of Marlin where Humming is preferred.
Every other entry keeps its relative order and the input list is not modified. Match kernel class names or MoE backend enum names.
Source code in vllm/model_executor/layers/quantization/utils/humming/priority.py
select_humming_moe_experts(config, weight_key, activation_key)
¶
Select the primary Humming MoE Experts class Note: Shape-specific fallbacks may still occur at runtime.
Source code in vllm/model_executor/layers/quantization/utils/humming/moe.py
stage_moe_weights_for_humming(layer, w13, w2, w13_scale, w2_scale, w13_input_scale=None, w2_input_scale=None)
¶
Install canonical weights and scales for Humming's layer-based converter.
Returns the scale parameter name used, weight_scale or
weight_scale_inv.