Skip to content

Commit ca27b04

Browse files
authored
fix alias rev map for quant types (#629)
* chore: fix alias for quant types * chore: fix alias for quant types * chore: fix alias for quant types * chore: fix alias for quant types
1 parent 8ac6ed8 commit ca27b04

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ You can install the stable release of cache-dit from PyPI, or the latest develop
7676
## 🔥Supported DiTs
7777

7878
> [!Tip]
79-
> One Model Series may contain many pipelines. cache-dit applies optimizations at the Transformer level; thus, any pipelines that include the supported transformer are already supported by cache-dit. ✅: supported now; ✖️: not supported now; **[C-P](./)**: Context Parallelism; **[T-P](./)**: Tensor Parallelism; **[TE-P](./)**: Text Encoder Parallelism; **[CN-P](./)**: ControlNet Parallelism; **[VAE-P](./)**: VAE Parallelism (TODO).
79+
> One Model Series may contain many pipelines. cache-dit applies optimizations at the Transformer level; thus, any pipelines that include the supported transformer are already supported by cache-dit. ✅: supported now; ✖️: not supported now; **[🤖Q](https://github.com/nunchaku-tech/nunchaku)**: **[nunchaku](https://github.com/nunchaku-tech/nunchaku)** w/ SVDQ W4A4; **[C-P](./)**: Context Parallelism; **[T-P](./)**: Tensor Parallelism; **[TE-P](./)**: Text Encoder Parallelism; **[CN-P](./)**: ControlNet Parallelism; **[VAE-P](./)**: VAE Parallelism (TODO).
8080
8181
<div align="center">
8282

8383
| 📚Supported DiTs: `🤗65+` | Cache | C-P | T-P | TE-P | CN-P | VAE-P |
8484
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
85-
| Z-Image-Turbo `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
85+
| Z-Image-Turbo `🤖Q` ||| ✖️ || ✖️ | ✖️ |
8686
| Qwen-Image-Layered ||||| ✖️ | ✖️ |
8787
| Qwen-Image-Edit-2511-Lightning ||||| ✖️ | ✖️ |
8888
| Qwen-Image-Edit-2511 ||||| ✖️ | ✖️ |
@@ -114,14 +114,15 @@ You can install the stable release of cache-dit from PyPI, or the latest develop
114114
| HunyuanImage-2.1 ||||| ✖️ | ✖️ |
115115
| HunyuanVideo-1.5 || ✖️ | ✖️ || ✖️ | ✖️ |
116116
| HunyuanVideo ||||| ✖️ | ✖️ |
117-
| FLUX.1-dev `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
118-
| FLUX.1-Fill-dev `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
119-
| Qwen-Image `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
120-
| Qwen-Image-Edit `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
121-
| Qwen-Image-Edit-2509 `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
122-
| Qwen-Image-Lightning `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
123-
| Qwen...Edit-Lightning `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
124-
| Qwen...Edit-2509-Lightning `⚡️Nunchaku` ||| ✖️ || ✖️ | ✖️ |
117+
| FLUX.1-dev `🤖Q` ||| ✖️ || ✖️ | ✖️ |
118+
| FLUX.1-Fill-dev `🤖Q` ||| ✖️ || ✖️ | ✖️ |
119+
| FLUX.1-Kontext-dev `🤖Q` ||| ✖️ || ✖️ | ✖️ |
120+
| Qwen-Image `🤖Q` ||| ✖️ || ✖️ | ✖️ |
121+
| Qwen-Image-Edit `🤖Q` ||| ✖️ || ✖️ | ✖️ |
122+
| Qwen-Image-Edit-2509 `🤖Q` ||| ✖️ || ✖️ | ✖️ |
123+
| Qwen-Image-Lightning `🤖Q` ||| ✖️ || ✖️ | ✖️ |
124+
| Qwen-Image-Edit-Lightning `🤖Q` ||| ✖️ || ✖️ | ✖️ |
125+
| Qwen-Image-Edit-2509-Lightning `🤖Q` ||| ✖️ || ✖️ | ✖️ |
125126
| SkyReels-V2-T2V ||||| ✖️ | ✖️ |
126127
| LongCat-Video || ✖️ | ✖️ || ✖️ | ✖️ |
127128
| ChronoEdit-14B ||||| ✖️ | ✖️ |

src/cache_dit/quantize/torchao/quantize_ao.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import torch
2+
import copy
23
from typing import Callable, Optional, List
34
from cache_dit.utils import maybe_empty_cache
45
from cache_dit.logger import init_logger
@@ -35,6 +36,13 @@ def quantize_ao(
3536
"int4_weight_only": "int4_w4a16_wo",
3637
"int4_wo": "int4_w4a16_wo",
3738
}
39+
alias_map_rev = copy.deepcopy(alias_map)
40+
# remove duplicates *_wo in rev map
41+
for key in list(alias_map_rev.keys()):
42+
if key.endswith("_wo"):
43+
alias_map_rev.pop(key)
44+
alias_map_rev = {v: k for k, v in alias_map_rev.items()}
45+
3846
if quant_type.lower() in alias_map:
3947
quant_type = alias_map[quant_type.lower()]
4048

@@ -187,7 +195,6 @@ def _quant_config():
187195

188196
maybe_empty_cache()
189197

190-
alias_map_rev = {v: k for k, v in alias_map.items()}
191198
if quant_type in alias_map_rev:
192199
quant_type = alias_map_rev[quant_type]
193200

0 commit comments

Comments
 (0)