fix: Stop quantize_blockwise and quantize_4bit from mutating user-provided absmax#1863
Open
TimDettmers wants to merge 3 commits intomainfrom
Open
fix: Stop quantize_blockwise and quantize_4bit from mutating user-provided absmax#1863TimDettmers wants to merge 3 commits intomainfrom
TimDettmers wants to merge 3 commits intomainfrom
Conversation
Worker agents were running the full test suite (10+ min) which is wasteful when only a small area of code changed. Updated the completion workflow to instruct agents to run only relevant test files/functions. The full suite will be run separately later. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vided absmax Both `quantize_blockwise` and `quantize_4bit` used `absmax.copy_()` to write the internally computed absmax into the user-provided tensor, silently mutating the caller's data. Remove the mutation so user tensors are left unchanged. The computed absmax is still correctly stored in the returned QuantState. Fixes #1587 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
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. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
quantize_blockwiseandquantize_4bitsilently mutated user-providedabsmaxtensors via in-placecopy_(), overwriting the caller's data as a side effectQuantState, so writing into the user's tensor was unnecessaryFixes #1587
Test plan
test_quantize_blockwise_does_not_mutate_absmax— passes on CPU and CUDAtest_quantize_4bit_does_not_mutate_absmax— passes on CPU and CUDA for both fp4 and nf4test_dynamic_blockwise_quantizationandtest_4bit_quanttests still pass🤖 Generated with Claude Code