bitsandbytes icon indicating copy to clipboard operation
bitsandbytes copied to clipboard

out kwarg in matmul_4bit() is not working

Open chenqianfzh opened this issue 1 year ago • 3 comments

System Info

Linux 20.04

Reproduction

output is defined as a tensor. The following works as expected: output = matmul_4bit(a, b)

but the following does not, the elements in output are not changed. matmul_4bit(a, b, out=output)

Expected behavior

matmul_4bit(a, b, out=output) is expected to have the output values set. It is a preferred way as it saves extra memory copy.

chenqianfzh avatar Jun 01 '24 00:06 chenqianfzh

Hi @chenqianfzh,

Thanks for reporting this issue. I believe that I see the same behavior with the 8bit version matmul as well.

For the 4bit version, this may work as expected when taking the gemv path, i.e. inputs where a is a 1D tensor with size divisible by selected blocksize.

matthewdouglas avatar Jun 03 '24 17:06 matthewdouglas

Thanks for checking it out.

I am using this function in model reference, so a needs to high-dimensional tensors. :-(

Hi @chenqianfzh,

Thanks for reporting this issue. I believe that I see the same behavior with the 8bit version matmul as well.

For the 4bit version, this may work as expected when taking the gemv path, i.e. inputs where a is a 1D tensor with size divisible by selected blocksize.

chenqianfzh avatar Jun 04 '24 18:06 chenqianfzh

Is there a fix planned for this anytime soon @matthewdouglas?

vrdn-23 avatar Jun 13 '24 16:06 vrdn-23

Hi @matthewdouglas , I'm new to bitsandbytes and I would like to give this a shot.

HAKSOAT avatar Mar 29 '25 13:03 HAKSOAT