[Bugfix][Quantization] Detect NVFP4 in ModelOpt mixed-precision checkpoints (#56050)
Signed-off-by: Stefano Castagnetta <scastagnetta@nvidia.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fa212b8dc5
commit
f0b4b36890
@@ -30,6 +30,7 @@ from .models import (
|
||||
llama3_8b_fp8,
|
||||
llama4_scout_fp4,
|
||||
llama4_scout_fp8,
|
||||
qwen3_8_27b_mixed_fp4,
|
||||
qwen3_a3b_fp8,
|
||||
)
|
||||
|
||||
@@ -202,3 +203,46 @@ def test_tp1_fp4_fusions(
|
||||
compilation_config,
|
||||
matches_check,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model_name, matches_fn, model_kwargs, hf_overrides", [qwen3_8_27b_mixed_fp4]
|
||||
)
|
||||
@pytest.mark.parametrize("attn_backend", [FLASHINFER_ATTN])
|
||||
@pytest.mark.parametrize("n_layers", [4])
|
||||
@pytest.mark.parametrize("inductor_graph_partition", INDUCTOR_GRAPH_PARTITION)
|
||||
@pytest.mark.skipif(not is_blackwell(), reason="Blackwell required for fp4")
|
||||
def test_tp1_fp4_mixed_precision_act_fusion(
|
||||
model_name: str,
|
||||
matches_fn: Callable[[int], Matches],
|
||||
model_kwargs: dict,
|
||||
hf_overrides: Callable[[int], dict],
|
||||
attn_backend: AttentionBackendCase,
|
||||
n_layers: int,
|
||||
inductor_graph_partition: bool,
|
||||
run_e2e_fusion_test,
|
||||
):
|
||||
"""Act+quant fusion matches on a MIXED_PRECISION NVFP4 checkpoint."""
|
||||
model_kwargs["hf_overrides"] = hf_overrides(n_layers)
|
||||
model_kwargs["load_format"] = "dummy"
|
||||
model_kwargs["max_model_len"] = 1024
|
||||
model_kwargs["kernel_config"] = {"enable_flashinfer_autotune": False}
|
||||
|
||||
compilation_config = dict(
|
||||
use_inductor_graph_partition=inductor_graph_partition,
|
||||
pass_config=PassConfig(
|
||||
fuse_norm_quant=False,
|
||||
fuse_act_quant=True,
|
||||
fuse_attn_quant=False,
|
||||
enable_qk_norm_rope_fusion=False,
|
||||
),
|
||||
)
|
||||
|
||||
run_e2e_fusion_test(
|
||||
model_name,
|
||||
matches_fn(n_layers),
|
||||
model_kwargs,
|
||||
attn_backend,
|
||||
compilation_config,
|
||||
["act_quant_fusion"],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user