detect_nvfp4_variant

Function detect_nvfp4_variant 

Source
pub fn detect_nvfp4_variant(
    store: &WeightStore,
    config: &ModelConfig,
) -> Nvfp4Variant
Expand description

Detect the weight quantization variant from the weight store.

Dispatch order matches vLLM / TRT-LLM / SGLang:

  1. Config-declared scheme (config.quantization_config.quant_method) wins outright. This is the authoritative signal and the only one that correctly handles checkpoints with an ignore list (e.g. lukealonso/MiniMax-M2.7-NVFP4, whose MLP gate_proj is intentionally unquantized and therefore has no .weight_scale tensor — sniffing would mis-detect the whole checkpoint as Bf16Raw and then read uint8-packed FP4 as BF16, which is the 4× byte overrun that surfaces as CUDA_ERROR_ILLEGAL_ADDRESS ten seconds into load).
  2. Tensor-name sniffing for the many checkpoints in the wild that ship without a quantization_config block.