Skip to content

Conversation

@matthewdouglas
Copy link
Member

Fixes #1157. Not a particularly practical use case, but I would consider it a bug nonetheless.


if(blocksize == 4096)
kQuantizeBlockwise<T, 4096, 4, STOCHASTIC, 0><<<num_blocks, 1024>>>(code, A, absmax, out, rand, rand_offset, n);
kQuantizeBlockwise<T, 4096, 4, STOCHASTIC, DATA_TYPE><<<num_blocks, 1024>>>(code, A, absmax, out, rand, rand_offset, n);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat subtle, but here's where the issue was.

Comment on lines -1931 to +1933
def test_fp4_quant(dtype):
@pytest.mark.parametrize("quant_type", ["fp4", "nf4"])
@pytest.mark.parametrize("blocksize", [64, 128, 256, 512, 1024, 2048, 4096])
def test_4bit_quant(dtype, quant_type, blocksize):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously only fp4 and blocksize=64 was tested here. Expanded these tests, but note the degradation with the larger block size.

@github-actions
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@abhilash1910 abhilash1910 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good find, lgtm.

@Titus-von-Koeller
Copy link
Collaborator

Cool! I'm checking with Tim for a review. Will get back to you.

@TimDettmers
Copy link
Collaborator

This looks good, thanks or catching it!

@Titus-von-Koeller Titus-von-Koeller merged commit 76885a4 into bitsandbytes-foundation:main Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tensor support for quantize_nf4

4 participants