Fix: replace FP4 Inf with 24 (avoid NaN in dequant)
This commit is contained in:
@@ -28,7 +28,7 @@ PROMPT = "The capital of France is"
|
||||
# FP4 E2M1 lookup table: index → float value (unsigned)
|
||||
# E2M1: 1-bit sign, 2-bit exp (bias=1), 1-bit mantissa
|
||||
# Values: 0, 2, 3, 4, 6, 8, 12, Inf (for exp 00,01,10,11 × mantissa 0,1)
|
||||
FP4_LUT = torch.tensor([0., 2., 3., 4., 6., 8., 12., float('inf')])
|
||||
FP4_LUT = torch.tensor([0., 2., 3., 4., 6., 8., 12., 24.]) # E2M1: last value (0b111) is nominally Inf, use 24 (2^(2+1) * 1.5)
|
||||
|
||||
def dequant_nvfp4_weight(
|
||||
weight: torch.Tensor, # (out, in/2) uint8
|
||||
|
||||
Reference in New Issue
Block a user