-
Notifications
You must be signed in to change notification settings - Fork 169
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
Refactor Affine Quantized Tensor #1234
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/1234
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit d992432 with merge base 06ad55a (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
26e2760
to
79a7f52
Compare
Ruff format and lint on some high traffic files
Update pre-commit to match CI/CD
stack-info: PR: #1228, branch: drisspg/stack/19
* add module swap UX * update * fix typing. add small notes * try NF4 support * fix * fix unpacking * fix * update nf4 integration * update backward pass
ce8934c
to
7bc89bc
Compare
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
babdd34
to
9427064
Compare
843716d
to
9c531e9
Compare
torchao/dtypes/floatx/__init__.py
Outdated
@@ -12,4 +13,6 @@ | |||
"to_scaled_tc_floatx", | |||
"from_scaled_tc_floatx", | |||
"_SPLIT_K_MAP", | |||
"Float8AQTTensorImpl", |
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.
if this is not used by other people, maybe we can remove, this is supposed to be internal mostly I think
torchao/dtypes/uintx/__init__.py
Outdated
@@ -12,4 +31,11 @@ | |||
"UintxAQTTensorImpl", | |||
"to_uintx", | |||
"_DTYPE_TO_BIT_WIDTH", | |||
"_BIT_WIDTH_TO_DTYPE", | |||
"UInt4Tensor", | |||
"PlainAQTTensorImpl", |
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.
probably don't need to expose this one
torchao/dtypes/uintx/__init__.py
Outdated
@@ -12,4 +31,11 @@ | |||
"UintxAQTTensorImpl", |
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.
we can probably remove this one as well
torchao/quantization/quant_api.py
Outdated
@@ -36,7 +36,7 @@ | |||
to_affine_quantized_floatx_static, | |||
to_affine_quantized_intx, | |||
) | |||
from torchao.dtypes.uintx.uintx import UintxLayout | |||
from torchao.dtypes.uintx.uintx_layout import UintxLayout |
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.
we can import from torchao.dtypes for now I think
torchao/dtypes/uintx/uint4_layout.py
Outdated
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.
should be a follow up: this is not used actually, I think we can move this to prototype
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.
Will do this in separate PR
0315a14
to
25980e7
Compare
25980e7
to
af2a88d
Compare
torchao/dtypes/__init__.py
Outdated
@@ -1,13 +1,9 @@ | |||
from . import affine_quantized_tensor_ops | |||
|
|||
# from ..prototype.dtypes.uint2 import UInt2Tensor, BitnetTensor |
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.
nit: we can remove this I think
torchao/dtypes/__init__.py
Outdated
from .utils import ( | ||
Layout, | ||
PlainLayout, | ||
) | ||
|
||
# from ..prototype.dtypes.uint2 import UInt2Tensor, BitnetTensor |
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 for this line
test/hqq/test_hqq_affine.py
Outdated
@@ -1,12 +1,7 @@ | |||
import unittest | |||
import torch | |||
from torchao.dtypes.affine_quantized_tensor import ( | |||
to_affine_quantized_intx, | |||
from torchao.quantization.quant_primitives import ( |
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.
nit: maybe we can just import from torchao.quantization now
torchao/prototype/hqq/example.py
Outdated
) | ||
from torchao.quantization.quant_primitives import ( |
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
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, thanks! please import to fbcode and check if there is any internal failures
b9245cc
to
d992432
Compare
@jainapurva has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Move Dtype Layout / TensorImpl class and dispatcher check-impl to their respective layout files
Test Plan: Pass all external and internal tests