vllm.models.glm5next.nvidia.model ¶
_dequant_fp8_block(weight_fp8, scale_inv, block_size=128) ¶
Dequantize a block-FP8 (e4m3) weight with per-block scale to BF16.
Unlike scaled_dequantize this tolerates a non-divisible (partial last block) shape by zero-padding to a multiple of block_size before the scale broadcast and trimming back afterwards (e.g. kv_a_proj_with_mqa is 576 rows = 4*128 + 64).
Source code in vllm/models/glm5next/nvidia/model.py
_try_load_fp8_attn_proj(name, tensor, buf, params_dict, loaded_params, kv_a_pad_size) ¶
Dequantize FP8 q_a_proj / kv_a_proj_with_mqa / o_proj to BF16 on load.
The FP8 checkpoint stores these as block-FP8 (weight + weight_scale_inv), but the model holds them in BF16 (fused_qkv_a_proj is always BF16 via DeepSeekV2FusedQkvAProjLinear; o_proj is excluded by modules_to_not_convert). When the model target is BF16 (no weight_scale_inv param) we dequantize; otherwise we return False so the normal stacked/direct path loads the FP8 tensor as-is.
Source code in vllm/models/glm5next/nvidia/model.py
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | |