pub trait QuantFormat:
Send
+ Sync
+ Debug {
// Required methods
fn name(&self) -> &'static str;
fn base_variant(&self) -> Nvfp4Variant;
fn is_ignored(&self, module_path: &str) -> bool;
// Provided method
fn variant_for(&self, module_path: &str) -> Nvfp4Variant { ... }
}Expand description
A serialization layout for quantized weights.
Implementations describe a loading policy for a checkpoint: which
tensor names to read, which dtypes to expect, and which module paths
should stay BF16 (the ignore list). The heavy per-linear loading code
remains in weight_map.rs; this trait is a thin dispatch wrapper that
selects the right variant while honoring per-module overrides.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Human-readable name for logs ("modelopt", "compressed-tensors",
"fp8-blockscaled").
Sourcefn base_variant(&self) -> Nvfp4Variant
fn base_variant(&self) -> Nvfp4Variant
The Nvfp4Variant that this format maps to in the existing
weight_map.rs dispatch. Allows the trait to co-exist with the
legacy variant-based call sites during incremental migration.
Sourcefn is_ignored(&self, module_path: &str) -> bool
fn is_ignored(&self, module_path: &str) -> bool
Is module_path in the format’s ignore list (should be loaded
as dense BF16 rather than quantized)? module_path is the tensor
name with the trailing .weight_scale_2 / .weight_packed /
etc. stripped — i.e. the prefix passed to
weight_map::quantized_any.
Provided Methods§
Sourcefn variant_for(&self, module_path: &str) -> Nvfp4Variant
fn variant_for(&self, module_path: &str) -> Nvfp4Variant
Effective variant for a specific module: the base variant, or
Bf16Raw if the module is in the ignore list. Loaders should
consult this instead of base_variant when loading per-module.