Class QuantizedQwenFp8Loader
java.lang.Object
smile.llm.quant.QuantizedQwenFp8Loader
Installs native FP8 linears into a Qwen hybrid model from HuggingFace SafeTensors.
Official Qwen3.8-FP8 uses fine-grained weight_block_size=[128,128]
with weight_scale_inv. Those weights are installed as
Fp8BlockLinear (LibTorch _scaled_mm_v2). Tensor-scale FP8
checkpoints still use Fp8Linear.
DeltaNet in_proj_a/in_proj_b, norms, conv, A_log,
dt_bias, embeddings, lm_head, and the vision tower stay on the
dense residual load path.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidinstall(QwenModel model, Path dir, Device device, int tpSize, int tpRank, ScalarType outDtype, int modelLoaderThreads) Installs FP8 (or block-dequant dense) projections for every hybrid block on one TP rank.static voidinstall(QwenModel model, Path dir, Device device, int tpSize, int tpRank, ScalarType outDtype, int modelLoaderThreads, WeightGemmBackend backend) Same asinstall(QwenModel, Path, Device, int, int, ScalarType, int)with an explicit backend:WeightGemmBackend.FP8(Hopper+,_scaled_mm_v2) orWeightGemmBackend.MARLIN_FP8(Ampere/Ada, FP8 weights resident, weight-only Marlin GEMM).static booleanisInstalledProjectionKey(String hfName) Returns whetherhfNameis owned by the FP8 installer (must not be force-fed into dense shells).
-
Method Details
-
install
public static void install(QwenModel model, Path dir, Device device, int tpSize, int tpRank, ScalarType outDtype, int modelLoaderThreads) throws IOException Installs FP8 (or block-dequant dense) projections for every hybrid block on one TP rank.- Parameters:
model- target rank model (shells already ondevice).dir- checkpoint directory.device- rank device.tpSize- tensor-parallel world size.tpRank- this rank.outDtype- compute dtype for dequant / Fp8Linear output.modelLoaderThreads- shard-read concurrency (0= auto).- Throws:
IOException- if checkpoint IO fails.
-
install
public static void install(QwenModel model, Path dir, Device device, int tpSize, int tpRank, ScalarType outDtype, int modelLoaderThreads, WeightGemmBackend backend) throws IOException Same asinstall(QwenModel, Path, Device, int, int, ScalarType, int)with an explicit backend:WeightGemmBackend.FP8(Hopper+,_scaled_mm_v2) orWeightGemmBackend.MARLIN_FP8(Ampere/Ada, FP8 weights resident, weight-only Marlin GEMM).- Parameters:
model- target rank model (shells already ondevice).dir- checkpoint directory.device- rank device.tpSize- tensor-parallel world size.tpRank- this rank.outDtype- compute dtype for dequant / Fp8Linear output.modelLoaderThreads- shard-read concurrency (0= auto).backend- how block-FP8 linears are multiplied.- Throws:
IOException- if checkpoint IO fails.
-
isInstalledProjectionKey
Returns whetherhfNameis owned by the FP8 installer (must not be force-fed into dense shells).- Parameters:
hfName- HuggingFace weight key.- Returns:
truewhen the FP8 installer owns this key.
-