mstar.utils.fp8_block#
FP8 block-scale checkpoints: the quantization_config they declare, and their weights dequantized.
A block-scale checkpoint (DeepSeek-V3’s format, GLM-5.x’s) stores each linear weight as e4m3 with one fp32
weight_scale_inv per weight_block_size block. Triton-free, so a model’s config can import it on a
CPU-only install; the activation quantizer that feeds the block-scale GEMMs is quant_fp8.
Functions
|
Pair fp8 |
|
Dequantize one 2-D fp8 weight: |
Classes
|
The fields of an HF fp8 |
- class mstar.utils.fp8_block.Fp8BlockQuantConfig(weight_block_size=(128, 128), fmt='e4m3', activation_scheme='dynamic', ignore=<factory>)[source]#
Bases:
objectThe fields of an HF fp8
quantization_configa block-scale checkpoint carries.- Parameters:
- classmethod from_hf_config_dict(quant)[source]#
- Parameters:
quant (dict | None)
- Return type:
Fp8BlockQuantConfig | None
- mstar.utils.fp8_block.dequant_fp8_block_stream(weights, quant_config, out_dtype=torch.bfloat16, keep_fp8=None)[source]#
Pair fp8
.weightkeys with.weight_scale_invand dequantize.