Package smile.llm.quant
package smile.llm.quant
Weight quantization backends: FP8 / NVFP4 (primary) and Marlin (Ampere failover).
-
ClassDescriptionReleases placeholder dense
LinearLayershells after quantized ops are installed, so empty GPU weight storage does not inflate the KV budget.Dequantizes DeepSeek / Qwen-style fine-grained FP8 weights (weight_block_size = [128, 128]+weight_scale_inv).Block-scaled FP8 linear for DeepSeek / Qwen fine-grained FP8 checkpoints (weight_block_size=[128,128]+weight_scale_inv).Helpers for FP8 KV store/load with per-tensor scales.Weight-only FP8 linear layer using cuBLASLt via LibTorch_scaled_mm.Shared forward interface for dense, FP8, NVFP4, and Marlin linear layers.Marlin FP16Ă—INT4 linear layer (Ampere/Ada failover for GPTQ/AWQ).Packs HuggingFace GPTQ / AWQ INT4 tensors into Marlin layout forMarlinLinear.Result of packing: Marlin qweight, scales, logical features.NVFP4 weight-only linear for Blackwell (sm_100+).Thread-local override forsmile.chat.quantizationduring model load.Detected checkpoint quantization format.Detects HuggingFace quantization format fromconfig.json.Loads HuggingFace GPTQ / AWQ / FP8 / NVFP4 SafeTensors into Llama linears (shard-then-pack for TP whentpSize > 1).Installs native FP8 linears into a Qwen hybrid model from HuggingFace SafeTensors.Factory forLinearOpbackends from checkpoint tensors + selected backend.Resolves checkpointQuantFormatandWeightGemmBackendfor load.Resolved quant policy for a checkpoint load.Shard-then-pack helpers for tensor-parallel quantized linears.Weight GEMM backend selected from checkpoint format and GPU capability.