[Dependency] Update Humming and remove NVFP4 scale workaround (#61556)

Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Misha Goin <mgoin64@gmail.com>
Co-authored-by: Kevin H. Luu <khluu000@gmail.com>
This commit is contained in:
Jinzhen Lin
2026-10-14 13:32:36 -07:00
committed by GitHub
co-authored by Codex Misha Goin Kevin H. Luu
parent 2e8a5930f6
commit fe98d90a9d
13 changed files with 54 additions and 47 deletions
@@ -64,8 +64,7 @@ def prepare_humming_linear_layer_config(
BaseInputSchema,
BaseWeightSchema,
HummingInputSchema,
prepare_layer_config,
transform_humming_tensors,
prepare_and_transform_humming_tensors,
)
weight_schema = BaseWeightSchema.from_config(quant_config)
@@ -127,7 +126,8 @@ def prepare_humming_linear_layer_config(
input_tensors.pop(name, None)
# Step 2: transform weight (humming standard format) for forwarding.
config = prepare_layer_config(
config, tensors = prepare_and_transform_humming_tensors(
tensors=tensors,
shape_n=sum(layer.output_partition_sizes),
shape_k=input_size_per_partition,
weight_schema=weight_schema,
@@ -138,7 +138,6 @@ def prepare_humming_linear_layer_config(
torch_dtype=layer.params_dtype,
device=tensors["weight"].device,
)
tensors = transform_humming_tensors(config, tensors)
tensors.update(input_tensors)
if "bias" in tensors:
zero_bias = torch.zeros_like(tensors["bias"])
@@ -397,11 +397,15 @@ def _prepare_and_transform_sublayer(
) -> "LayerConfig":
"""Prepare Humming configuration and transform one sublayer's tensors."""
from vllm.utils.humming import (
prepare_layer_config,
transform_humming_tensors,
prepare_and_transform_humming_tensors,
)
config = prepare_layer_config(
source_tensors = _extract_sublayer_tensors(layer, sublayer_name)
for name in ("input_scale", "input_scale_2"):
if name != input_schema.static_tensor_scale_name:
source_tensors.pop(name, None)
config, tensors = prepare_and_transform_humming_tensors(
tensors=source_tensors,
shape_n=shape_n,
shape_k=shape_k,
pad_n_to_multiple=256,
@@ -413,11 +417,6 @@ def _prepare_and_transform_sublayer(
torch_dtype=param_dtype,
device=getattr(layer, f"{sublayer_name}_weight").device,
)
source_tensors = _extract_sublayer_tensors(layer, sublayer_name)
for name in ("input_scale", "input_scale_2"):
if name != input_schema.static_tensor_scale_name:
source_tensors.pop(name, None)
tensors = transform_humming_tensors(config, source_tensors)
for name in ("input_scale", "input_scale_2"):
if name in source_tensors:
tensors[name] = source_tensors[name]
@@ -322,22 +322,6 @@ def check_and_fallback_input_schema(
input_group_size = input_schema.input_scale_group_size
input_scale_dtype = input_schema.input_scale_dtype
def is_compatible(candidate: "HummingInputSchema") -> bool:
check_weight_schema = weight_schema
if (
candidate.a_dtype in (None, humming_dtypes.float16, humming_dtypes.bfloat16)
and weight_schema.b_dtype == humming_dtypes.float4e2m1
and weight_group_size == 16
and weight_schema.bs_dtype
in (None, humming_dtypes.float16, humming_dtypes.bfloat16)
):
# Humming rejects folded NVFP4 scales despite A16 software dequant
# supporting them. Relax only this check, preserving kernel metadata.
check_weight_schema = dataclasses.replace(
weight_schema, bs_dtype=humming_dtypes.float8e4m3
)
return candidate.is_compatible_with(check_weight_schema, param_dtype)
def is_deprecated(dtype: "humming_dtypes.DataType | None") -> bool:
if dtype is None or dtype.num_bits == 16:
return False
@@ -349,7 +333,7 @@ def check_and_fallback_input_schema(
is_fp8_deprecated = dtype.num_bits < 16 and 100 <= sm_version < 120
return is_int4_deprecated or is_int8_deprecated or is_fp8_deprecated
if is_compatible(input_schema):
if input_schema.is_compatible_with(weight_schema, param_dtype):
if not allow_fallback:
if is_deprecated(a_dtype):
msg = f"Humming {a_dtype} activation is slow on SM{sm_version} now."
@@ -406,7 +390,7 @@ def check_and_fallback_input_schema(
input_scale_dtype=scale_dtype,
input_quant_mode=quant_mode,
)
if is_compatible(candidate):
if candidate.is_compatible_with(weight_schema, param_dtype):
return candidate
raise ValueError(