Commit 1f9bfd7
authored
Make FqnToConfig handle module swap configs (#3492)
**Summary:** `FqnToConfig` does not handle module swap configs
like `QATConfig` today because it does not reassign the replaced
modules, but instead assumes there is no need to do so because
the underlying tensors are swapped. This breaks when the user
tries to use `FqnToConfig` with `QATConfig`, which does not
rely on tensor subclasses. This commit fixes this by making
the replacement logic in `FqnToConfig` more general.
Fixes #3490.
**Test Plan:**
```
python test/quantization/test_quant_api.py -k test_fqn_config_quantized_nested_module_module_swap
```1 parent ac535b2 commit 1f9bfd7
File tree
2 files changed
+41
-8
lines changed- test/quantization
- torchao/quantization
2 files changed
+41
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
1197 | 1201 | | |
1198 | 1202 | | |
1199 | 1203 | | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1200 | 1230 | | |
1201 | 1231 | | |
1202 | 1232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
472 | | - | |
| 471 | + | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
479 | | - | |
| 478 | + | |
480 | 479 | | |
481 | | - | |
482 | | - | |
483 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
484 | 488 | | |
485 | 489 | | |
486 | 490 | | |
| |||
491 | 495 | | |
492 | 496 | | |
493 | 497 | | |
494 | | - | |
495 | 498 | | |
496 | 499 | | |
497 | 500 | | |
| |||
0 commit comments