thu-nics / MixDQ

[ECCV24] MixDQ: Memory-Efficient Few-Step Text-to-Image Diffusion Models with Metric-Decoupled Mixed Precision Quantization
https://a-suozhang.xyz/mixdq.github.io/
31 stars 4 forks source link

libpeng error for mixed-precision process #12

Open Harahan opened 4 months ago

Harahan commented 4 months ago

Hi, thanks for releasing the wonderful work!

However, when I ran quant_content.py, I got the following error for both weight and activation quantization of SD-XL-turbo. Can you help me?


07/25/2024 10:23:39 - INFO - __main__ -   model.down_blocks.2.attentions.0.transformer_blocks.9.attn2.to_q: weight_quant=False, act_quant=True

Generating image samples for FID evaluation.:   0%|          | 0/1 [00:00<?, ?it/s]

  0%|          | 0/1 [00:00<?, ?it/s]

100%|██████████| 1/1 [00:02<00:00,  2.54s/it]
100%|██████████| 1/1 [00:02<00:00,  2.54s/it]

Generating image samples for FID evaluation.: 100%|██████████| 1/1 [00:10<00:00, 10.70s/it]
Generating image samples for FID evaluation.: 100%|██████████| 1/1 [00:10<00:00, 10.70s/it]libpng error: IDAT: CRC error

Traceback (most recent call last):
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 335, in <module>
    main()
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 194, in main
    SSIM_Layer(model=qnn, qnn=qnn, pipe=pipe, opt=opt, prompts=prompts, weight_quant=False, act_quant=True, weight_only=False, config_ssim_layer=config_ssim_layer, cur_bit=bit_width)
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 246, in SSIM_Layer
    SSIM_Layer(model=module, qnn=qnn, pipe=pipe, opt=opt, prompts=prompts, weight_quant=weight_quant, act_quant=act_quant, weight_only=weight_only, progressivly=False, config_ssim_layer=config_ssim_layer, cur_bit=cur_bit, prefix=full_name+".")
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 246, in SSIM_Layer
    SSIM_Layer(model=module, qnn=qnn, pipe=pipe, opt=opt, prompts=prompts, weight_quant=weight_quant, act_quant=act_quant, weight_only=weight_only, progressivly=False, config_ssim_layer=config_ssim_layer, cur_bit=cur_bit, prefix=full_name+".")
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 246, in SSIM_Layer
    SSIM_Layer(model=module, qnn=qnn, pipe=pipe, opt=opt, prompts=prompts, weight_quant=weight_quant, act_quant=act_quant, weight_only=weight_only, progressivly=False, config_ssim_layer=config_ssim_layer, cur_bit=cur_bit, prefix=full_name+".")
  [Previous line repeated 5 more times]
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 230, in SSIM_Layer
    ssim = SSIM(img_path1=opt.image_folder, 
  File "mixed_precision_scripts/get_sensitivity/sdxl_turbo/quant_content.py", line 316, in SSIM
    ssim_index = metrics.structural_similarity(img1, img2, multichannel=True, channel_axis=2, win_size=511)
  File "/home/huangyushi/miniconda3/envs/mixdq/lib/python3.8/site-packages/skimage/metrics/_structural_similarity.py", line 111, in structural_similarity
    check_shape_equality(im1, im2)
  File "/home/huangyushi/miniconda3/envs/mixdq/lib/python3.8/site-packages/skimage/_shared/utils.py", line 499, in check_shape_equality
    if not all(image0.shape == image.shape for image in images[1:]):
  File "/home/huangyushi/miniconda3/envs/mixdq/lib/python3.8/site-packages/skimage/_shared/utils.py", line 499, in <genexpr>
    if not all(image0.shape == image.shape for image in images[1:]):
AttributeError: 'NoneType' object has no attribute 'shape'
A-suozhang commented 4 months ago

Thx for pointing out this issue, we will soon fix it in the upcoming commit.