-
Notifications
You must be signed in to change notification settings - Fork 372
Add generic TorchAOTensor extra_repr for nn.Modules
#3328
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
Conversation
Summary: att Test Plan: Reviewers: Subscribers: Tasks: Tags:
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3328
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 6 PendingAs of commit e1c23ba with merge base b4ec4cb ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
vkuzo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a test we can add print(module) to to prevent regressions?
extra_repr for nn.Modules
test/quantization/test_quant_api.py
Outdated
| "self.block_size=[128, 128], self.mm_config=Float8MMConfig(emulate=False, use_fast_accum=True, " | ||
| "pad_inner_dim=False), self.scale.shape=torch.Size([1, 1]), self.kernel_preference=<KernelPreference.AUTO: 'auto'>))" | ||
| ) | ||
| assert str(custom_module) == expected_str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be a bit fragile? since small changes will break it, maybe use FileCheck()?
test/quantization/test_quant_api.py
Outdated
| "pad_inner_dim=False), self.scale.shape=torch.Size([1, 1]), self.kernel_preference=<KernelPreference.AUTO: 'auto'>))" | ||
| ) | ||
|
|
||
| assert str(linear_model.linear1) == expected_str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
jerryzh168
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, had some comments inline
Summary:
This fixes
extra_reprfor generic modules by introducing a new helper function,_module_extra_repr, which will add TorchAOTensor info to all the parameters in a module that are an instance of TorchAOBaseTensor to the original extra_repr of the module.The configs supporting parameter quantization have been update to use
_module_extra_repr.Also renamed
new_weight->quantized_tensorto be more consistent.For example, we will see the following output
when we run the following code:
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags: