Commit 8844a2b
authored
Support attention quantization for diffusers >= 0.35.0 (NVIDIA#608)
## What does this PR do?
**Type of change:**
new feature
**Overview:** ?
Attention mechanism has changed from diffusers 0.35.
Many model attentions are now subclass of a new Mixin class:
AttentionModuleMixin, which is not a sub class of Attention
To fix it, patch the mixin class by forcing to use native attention
impl so the existing function monkey patch still work.
## Testing
manual quant of Wan, Flux
---------
Signed-off-by: Shengliang Xu <[email protected]>1 parent 1524251 commit 8844a2b
File tree
3 files changed
+45
-16
lines changed- examples/diffusers/quantization
- modelopt/torch/quantization/plugins
3 files changed
+45
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
763 | | - | |
764 | | - | |
765 | 763 | | |
766 | 764 | | |
767 | 765 | | |
| |||
816 | 814 | | |
817 | 815 | | |
818 | 816 | | |
819 | | - | |
820 | 817 | | |
821 | 818 | | |
822 | 819 | | |
| |||
831 | 828 | | |
832 | 829 | | |
833 | 830 | | |
834 | | - | |
835 | 831 | | |
836 | 832 | | |
837 | 833 | | |
| |||
1118 | 1114 | | |
1119 | 1115 | | |
1120 | 1116 | | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
1121 | 1122 | | |
1122 | 1123 | | |
1123 | 1124 | | |
1124 | 1125 | | |
1125 | 1126 | | |
1126 | | - | |
1127 | 1127 | | |
1128 | 1128 | | |
1129 | 1129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
27 | 38 | | |
28 | 39 | | |
29 | 40 | | |
| |||
140 | 151 | | |
141 | 152 | | |
142 | 153 | | |
143 | | - | |
| 154 | + | |
144 | 155 | | |
145 | 156 | | |
146 | 157 | | |
| |||
167 | 178 | | |
168 | 179 | | |
169 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
170 | 195 | | |
171 | 196 | | |
172 | 197 | | |
| |||
0 commit comments