Skip to content

Wrong result 8bit blockwise quantization over float16 #1540

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingHigh Priority(first issues that will be worked on)Low RiskRisk of bugs in transformers and other librariesx64 CPU

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions