-
Notifications
You must be signed in to change notification settings - Fork 365
Enable PerRow(axis) to support axes other than -1
#3303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+120
−15
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d76d3ff
Update
vkuzo c97b030
Update
vkuzo 763a709
Update
vkuzo 6143910
Update
vkuzo 0073d60
Update
vkuzo d9ebeb3
Update
vkuzo a99196f
Update
vkuzo 84b06d1
Update
vkuzo d4ce355
Update
vkuzo b49280d
Update
vkuzo ec28bf5
Update
vkuzo a6324b0
Update
vkuzo b0d38ad
Update
vkuzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -444,7 +444,9 @@ def _test_slice_and_copy_similar_to_vllm(self, config: AOBaseConfig): | |
| dummy_l = torch.nn.Linear(1024, 1024).to("cuda").to(torch.bfloat16) | ||
| # making the weight different | ||
| dummy_l.weight = torch.nn.Parameter( | ||
| dummy_l.weight + 2 * torch.randn(1024, 1024, device=device, dtype=dtype), | ||
| dummy_l.weight | ||
| + 1.0 | ||
| + 2 * torch.randn(1024, 1024, device=device, dtype=dtype), | ||
| requires_grad=False, | ||
| ) | ||
| quantize_(dummy_l, config) | ||
|
|
@@ -456,15 +458,15 @@ def _test_slice_and_copy_similar_to_vllm(self, config: AOBaseConfig): | |
| param = l.weight | ||
| param_data = param.data | ||
| param_data = param_data.narrow(output_dim, start_idx, shard_size) | ||
| orig_value = param_data.qdata[0][0] | ||
| orig_values = param_data.qdata[0] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the original check failed by chance, the two tensors had the same value at [0][0]. Checking the first row is more resistant to chance. |
||
| loaded_weight = dummy_l.weight | ||
| loaded_weight = loaded_weight.narrow(output_dim, start_idx, shard_size) | ||
|
|
||
| # making sure param.data.qdata[0][0] is not the same as loaded_weight.qdata[0][0] | ||
| assert not torch.equal(orig_value, loaded_weight.qdata[0][0]) | ||
| # making sure param.data.qdata[0] is not the same as loaded_weight.qdata[0] | ||
| assert not torch.equal(orig_values, loaded_weight.qdata[0]) | ||
| param_data.copy_(loaded_weight) | ||
| # making sure param.data is updated to loaded_weight | ||
| assert torch.equal(param_data.qdata[0][0], loaded_weight.qdata[0][0]) | ||
| assert torch.equal(param_data.qdata[0], loaded_weight.qdata[0]) | ||
| if hasattr(param_data, "scale"): | ||
| assert torch.equal(param_data.scale, loaded_weight.scale) | ||
| if hasattr(param_data, "zero_point"): | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.