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:
-
check_and_fallback_input_schema–Resolve input_schema against weight_schema, falling back if needed.
-
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.
-
humming_executed_input_quant_key–The activation quantization Humming runs on this device for weights
-
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.
check_and_fallback_input_schema(weight_schema, input_schema, param_dtype=None, allow_fallback=True, allow_fp8_sm100=True, warn=True)
¶
Resolve input_schema against weight_schema, falling back if needed.
Parameters:
-
(weight_schema¶BaseWeightSchema) –the weight schema the input must be compatible with.
-
(input_schema¶BaseInputSchema) –the requested input schema.
-
(param_dtype¶dtype | None, default:None) –model compute dtype, used as the 16-bit fallback.
-
(allow_fallback¶bool, default:True) –if False, return the requested schema as-is.
-
(allow_fp8_sm100¶bool, default:True) –whether FP8 activations may be honored on SM100-SM119. Humming's dense FP8 UMMA path is fast there, but the MoE grouped-GEMM path is not (the tuner can emit invalid two-CTA configs), so the MoE call sites pass False.
-
(warn¶bool, default:True) –whether to log fallbacks; False when only probing the result.
Source code in vllm/model_executor/layers/quantization/utils/humming/schema.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
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 | |
humming_executed_input_quant_key(weight_quant_config, activation_key, allow_fallback=True)
¶
The activation quantization Humming runs on this device for weights
described by weight_quant_config when activation_key is requested.
None if it runs unquantized activations or rejects the request.
Source code in vllm/model_executor/layers/quantization/utils/humming/schema.py
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.