Class Fp8BlockDequant
java.lang.Object
smile.llm.quant.Fp8BlockDequant
Dequantizes DeepSeek / Qwen-style fine-grained FP8 weights
(
weight_block_size = [128, 128] + weight_scale_inv).
Official Qwen3.8-FP8 checkpoints use block scales; Fp8BlockLinear
runs them via at::_scaled_mm_v2. This helper dequantizes for reference
tests and debug only.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intQwen / DeepSeek fine-grained FP8 block size. -
Method Summary
Modifier and TypeMethodDescriptionstatic Tensordequant(Tensor weightFp8, Tensor scaleInv, ScalarType outDtype) Dequantizesweight_fp8 * broadcast(scale_inv)tooutDtype.static booleanisBlockScale(Tensor weight, Tensor scale) Returnstruewhenscaleis a block layout forweight.static booleanisTensorScale(Tensor scale) Returnstruewhenscaleis a scalar / length-1 tensor scale.
-
Field Details
-
BLOCK
public static final int BLOCKQwen / DeepSeek fine-grained FP8 block size.- See Also:
-
-
Method Details
-
isBlockScale
-
isTensorScale
Returnstruewhenscaleis a scalar / length-1 tensor scale.- Parameters:
scale- candidate scale tensor.- Returns:
truewhenscaleis a scalar / length-1 tensor scale.
-
dequant
Dequantizesweight_fp8 * broadcast(scale_inv)tooutDtype.- Parameters:
weightFp8- FP8 weight[N, K].scaleInv- block inverse scales[ceil(N/128), ceil(K/128)].outDtype- compute dtype (BF16 or FP16).- Returns:
- dense weight on the same device as
weightFp8(caller owns).
-