"vscode:/vscode.git/clone" did not exist on "6bc591ec7995481a483079a8b71f5c923e8e0ace"
Unverified Commit f7037008 authored by gushiqiao's avatar gushiqiao Committed by GitHub
Browse files

[Feat] support convert qwen-image to 8bit (#357)

parent a14288d5
......@@ -642,7 +642,7 @@ def main():
parser.add_argument(
"-t",
"--model_type",
choices=["wan_dit", "hunyuan_dit", "wan_t5", "wan_clip", "wan_animate_dit"],
choices=["wan_dit", "hunyuan_dit", "wan_t5", "wan_clip", "wan_animate_dit", "qwen_image_dit"],
default="wan_dit",
help="Model type",
)
......@@ -686,6 +686,11 @@ def main():
args.non_linear_dtype = eval(args.non_linear_dtype)
model_type_keys_map = {
"qwen_image_dit": {
"key_idx": 2,
"target_keys": ["attn", "img_mlp", "txt_mlp"],
"ignore_key": None,
},
"wan_dit": {
"key_idx": 2,
"target_keys": ["self_attn", "cross_attn", "ffn"],
......
......@@ -72,6 +72,31 @@ python converter.py \
--quantized
```
### QWen-Image DIT
```bash
python converter.py \
--source /path/to/Qwen-Image-Edit/transformer \
--output /Path/To/output \
--output_ext .safetensors \
--output_name qwen_int8 \
--linear_dtype torch.int8 \
--model_type qwen_image_dit \
--quantized \
--save_by_block
```
```bash
python converter.py \
--source /path/to/Qwen-Image-Edit/transformer \
--output /Path/To/output \
--output_ext .safetensors \
--output_name qwen_fp8 \
--linear_dtype torch.float8_e4m3fn \
--model_type qwen_image_dit \
--quantized \
--save_by_block
```
### Wan T5EncoderModel
......
......@@ -72,6 +72,31 @@ python converter.py \
--quantized
```
### QWen-Image DIT
```bash
python converter.py \
--source /path/to/Qwen-Image-Edit/transformer \
--output /Path/To/output \
--output_ext .safetensors \
--output_name qwen_int8 \
--linear_dtype torch.int8 \
--model_type qwen_image_dit \
--quantized \
--save_by_block
```
```bash
python converter.py \
--source /path/to/Qwen-Image-Edit/transformer \
--output /Path/To/output \
--output_ext .safetensors \
--output_name qwen_fp8 \
--linear_dtype torch.float8_e4m3fn \
--model_type qwen_image_dit \
--quantized \
--save_by_block
```
### Wan T5EncoderModel
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment