Fix TypeError bug in static quantization tutorial#4500
Open
Ashutosh0x wants to merge 1 commit into
Open
Conversation
QuantizedLinear.from_observed() passes target_dtype to __init__() which doesn't accept it. Anyone copying this tutorial code would get: TypeError: __init__() takes 7 positional arguments but 8 were given The target_dtype parameter was unused -- QuantizedLinear hardcodes Int8Tensor behavior. Removed the dead parameter from from_observed, StaticQuantConfig, and the quantize_ call site. Partial fix for pytorch#3637 Test Plan: Documentation-only change. Verified argument counts match between __init__ (6 params) and from_observed's cls() call (6 args). This change was authored with the assistance of an AI coding assistant.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4500
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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
Fix a TypeError bug in the static quantization tutorial.
QuantizedLinear.from_observed()passestarget_dtypeto__init__()which doesn't accept it:Anyone copying this tutorial code would hit
TypeErrorimmediately. Thetarget_dtypewas unused sinceQuantizedLinearhardcodes int8 behavior viaInt8Tensor.Fix
target_dtypefromfrom_observed()target_dtypefield fromStaticQuantConfig(now empty dataclass)quantize_()call to match:StaticQuantConfig()instead ofStaticQuantConfig(torch.uint8)Partial fix for #3637
Test Plan
Documentation-only change. Verified argument counts match between
__init__(6 params) andfrom_observed'scls()call (6 args).This change was authored with the assistance of an AI coding assistant.