Commit a951643
authored
Add main tensor conversion API for packed tensors (#3029)
Summary:
Added `_convert_to_packed_tensor_based_on_current_hardware`
to convert a tensor from the unpacked / plain version to a packed version
This is to enable vllm for packed weights, vllm will do a slice for the quantized weight,
but slicing is not always supported for all torchao tensor subclasses. So we want to
first ship an plain / unpacked checkpoint and then convert to the packed version using this API
Test Plan:
pytest test/prototype/test_tensor_conversion.py
Reviewers:
Subscribers:
Tasks:
Tags:1 parent cfa39c8 commit a951643
File tree
2 files changed
+60
-3
lines changed- test/prototype
- torchao/prototype/tensor_conversion
2 files changed
+60
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
| |||
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
| |||
178 | 187 | | |
179 | 188 | | |
180 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| |||
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
0 commit comments