Skip to content

Wrong result 8bit blockwise quantization over float16 #1540

Open
@ZiyueXu77

Description

@ZiyueXu77

System Info

Ubuntu 24.04

Reproduction

The following simple script, will yield all 0 dequantized results for all 1 inputs, and Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)
`
import torch
from bitsandbytes.functional import quantize_blockwise, dequantize_blockwise

if name == "main":

test_torch = torch.ones([5, 10], dtype=torch.float16)

quantized, quantized_state = quantize_blockwise(test_torch)
absmax = quantized_state.absmax
code = quantized_state.code

dequantized = dequantize_blockwise(quantized, absmax=absmax, code=code)
print(dequantized)

dequantized = dequantize_blockwise(quantized, quant_state=quantized_state)
print(dequantized)

`

Expected behavior

torch.float32 will give correct results of all 1s with Process finished with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Low RiskRisk of bugs in transformers and other librariesbugSomething isn't workinghigh priority(first issues that will be worked on)x64 CPU

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions