Commit 299ff3a
authored
[llm] Add IRPA transcoding. (#633)
Primary feature is the addition of `save` and `load` on the `Dataset`
class. Previously, it was only possible to create one of these from a
GGUF file. Now, we can load from GGUF, save to IRPA, do arbitrary
transformations and update, etc.
The rest is the machinery to manage this:
* Layouts types can now be registered and have stable serialization.
* InferenceTensor types can now be registered and have stable
serialization.
* Generic PlanarQuantizedTensor which can generically represent the
unpacked form of any QuantizedTensor when serializing to IRPA. By
default, QuantizedTensors are saved planarized.
* The core ParameterArchive classes were completed to faithfully
roundtrip PyTorch tensors.
* There are still things in the CLI that refer to "gguf", but these now
operate on any supported archive format (GGUF or IRPA).
Future enhancements include the ability to support incremental IRPA
construction with a last-wins/merged approach. This would let arbitrary
Theta transformations to be done and appended to new segments of the
files. Probably a really useful quantizer feature.
While not done here, this facility makes it pretty trivial to write
quantizers and other things since it moves this from bespoke/file-format
handling like they are usually based on. Instead, it is just high level
transformations on the Theta collection.1 parent b9c9201 commit 299ff3a
File tree
24 files changed
+1222
-51
lines changed- core
- shark_turbine
- aot
- dynamo
- transforms/general
- tests
- aot
- transforms/general
- llm
- tests
- ops
- types
- turbine_llm
- examples
- ops
- tools
- types
- gguf_interop
24 files changed
+1222
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
49 | 110 | | |
50 | 111 | | |
51 | 112 | | |
| |||
63 | 124 | | |
64 | 125 | | |
65 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
66 | 194 | | |
67 | 195 | | |
68 | 196 | | |
| |||
71 | 199 | | |
72 | 200 | | |
73 | 201 | | |
74 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
75 | 208 | | |
76 | 209 | | |
77 | 210 | | |
78 | | - | |
| 211 | + | |
79 | 212 | | |
80 | 213 | | |
81 | 214 | | |
| |||
94 | 227 | | |
95 | 228 | | |
96 | 229 | | |
97 | | - | |
98 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
99 | 236 | | |
100 | 237 | | |
101 | 238 | | |
| |||
113 | 250 | | |
114 | 251 | | |
115 | 252 | | |
116 | | - | |
117 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
118 | 256 | | |
119 | 257 | | |
120 | 258 | | |
121 | 259 | | |
122 | 260 | | |
123 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
124 | 269 | | |
125 | 270 | | |
126 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | | - | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
141 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
142 | 150 | | |
143 | 151 | | |
144 | 152 | | |
145 | | - | |
| 153 | + | |
146 | 154 | | |
147 | 155 | | |
148 | 156 | | |
149 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
265 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
266 | 270 | | |
267 | 271 | | |
268 | 272 | | |
| |||
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
300 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
301 | 307 | | |
302 | 308 | | |
303 | 309 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 15 | | |
21 | 16 | | |
22 | 17 | | |
| |||
50 | 45 | | |
51 | 46 | | |
52 | 47 | | |
53 | | - | |
54 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
55 | 52 | | |
56 | 53 | | |
57 | 54 | | |
| |||
65 | 62 | | |
66 | 63 | | |
67 | 64 | | |
68 | | - | |
69 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | | - | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
0 commit comments