diff --git a/single_shot_inference.py b/single_shot_inference.py index 601d8a4e..1ed2d3b7 100644 --- a/single_shot_inference.py +++ b/single_shot_inference.py @@ -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