Commit 3326269
committed
Delete AffineQuantizedTensor, AQTTensorImpl, and Layout
**Summary:** AffineQuantizedTensor was the v1 quantized tensor
system, now fully superseded by v2 tensor types (Int8Tensor,
Int4Tensor, Float8Tensor, IntxUnpackedToInt8Tensor, etc.) that
inherit from TorchAOBaseTensor.
**BC-Breaking notes:**
Before (AQT):
```python
from torchao.dtypes import to_affine_quantized_intx
from torchao.quantization import quantize_, Int4WeightOnlyConfig
# Low-level AQT API
weight = to_affine_quantized_intx(
weight, mapping_type, block_size, target_dtype,
quant_min, quant_max, eps, _layout=Layout(),
)
# High-level API (unchanged)
quantize_(model, Int4WeightOnlyConfig())
```
After (v2 tensors):
```python
from torchao.quantization import quantize_, Int4WeightOnlyConfig
# High-level API (unchanged, recommended)
quantize_(model, Int4WeightOnlyConfig())
# Low-level v2 API (if needed)
from torchao.quantization import Int4Tensor, IntxUnpackedToInt8Tensor
weight = Int4Tensor.from_hp(weight, block_size)
weight = IntxUnpackedToInt8Tensor.from_hp(weight, block_size, torch.int4)
```
**Detailed changes:**
Core deletions:
- torchao/dtypes/affine_quantized_tensor.py (class definition)
- torchao/dtypes/affine_quantized_tensor_ops.py (aten dispatch)
- torchao/dtypes/floatx/, torchao/dtypes/uintx/ (empty subpackages)
- torchao/dtypes/README.md (stale AQT-centric docs)
- torchao/dtypes/utils.py: removed Layout class and AQTTensorImpl class
- torchao/dtypes/__init__.py: removed all AQT and Layout exports
- torchao/utils.py: removed _register_layout, _get_tensor_impl_constructor,
and their classmethod registrations on TorchAOBaseTensor
- test/dtypes/test_affine_quantized.py
- test/dtypes/test_affine_quantized_tensor_parallel.py
Core updates:
- quant_api.py: removed AQT from _is_linear check, removed 5 dead
activation quant helpers
- testing/utils.py: switched defaults from AQT to Int8Tensor
- Updated test assertions, docstrings, and docs to remove AQT references
Prototype updates:
- prototype/autoround/: removed broken AQT imports, updated isinstance
checks to TorchAOBaseTensor. Everything works except apply_auto_round()
which was already broken before this PR (issue #1690).
- prototype/dtypes/uintx/uintx_utils.py: removed UintxLayout,
UintxAQTTensorImpl, and AQT imports (fixes codebook import breakage)
- prototype/quantization/mixed_precision/: added assertion error since
feature was already broken by PlainLayout deletion (#4151)
Still broken (tracked with TODOs):
- tutorials/calibration_flow/ (uses to_affine_quantized_intx_static)
- tutorials/developer_api_guide/ (uses Layout)
Docs/comments only (not broken, just stale references):
- prototype/quantization/module_swap/ (README)
- prototype/parq/ (README)
- prototype/quantized_training/ (comments)1 parent 6e7a6e9 commit 3326269
45 files changed
Lines changed: 124 additions & 1928 deletions
File tree
- docs/source
- contributing
- eager_tutorials
- test
- dtypes
- prototype
- quantization
- torchao
- dtypes
- floatx
- uintx
- prototype
- autoround
- dtypes/uintx
- hqq
- parq
- quant
- quantization
- mixed_precision/scripts
- module_swap
- quantized_training
- tensor_conversion
- quantization
- pt2e
- qat
- testing
- tutorials
- calibration_flow
- developer_api_guide
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | | - | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | 162 | | |
166 | | - | |
167 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
168 | 166 | | |
169 | 167 | | |
170 | 168 | | |
171 | | - | |
172 | | - | |
| 169 | + | |
173 | 170 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
178 | 174 | | |
179 | 175 | | |
180 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
458 | | - | |
| 458 | + | |
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
This file was deleted.
0 commit comments