Commit cb055ce
Preserve unquantized embedding tables through sharding
Summary:
PNI builds TorchRec per-table weight dtype maps from `select_quantization_dtype()`. The selector uses `None` to mean that a table must remain unquantized, but omitting that table from TorchRec's map means to use the default INT8 dtype. That mismatch produced an INT8 TBE specification for a table whose packed weight remained floating point, so ICE attempted to load a Float weight into a Byte table.
Record selector `None` explicitly as `torch.float` in the existing ADS EBC, IG, and retrieval PNI quantization callsites. Explicit INT8, INT4, and INT2 selections are unchanged, and float-to-half policies continue to return and preserve `torch.half`.
Mixed floating and quantized tables also expose a TorchRec state initialization gap when split scale/bias state is enabled. Floating TBEs correctly return neither qscale nor qbias. Preserve their weight state while omitting quantization-parameter state, and reject an asymmetric qscale/qbias pair as invalid instead of producing an incomplete state dict.
Together these changes preserve each table's selected representation across PNI authoring, TorchRec sharding, model packing, and ICE loading without special-casing a model or transform.
Differential Revision: D1135010491 parent adf7d7b commit cb055ce
2 files changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 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 | + | |
150 | 186 | | |
151 | 187 | | |
152 | 188 | | |
| |||
0 commit comments