Text-to-Image
Diffusers
stable-diffusion

CFG = 0 makes some issue

#55
by Lavico - opened

Hi
Thank you for your contribution of distillation diffusion model work.

I face some issue related to the CFG issue.

When i apply the suggested code in the front Model card page, there is some issue below
" negative_pooled_prompt_embeds = negative_pooled_prompt_embeds.repeat(1, num_images_per_prompt).view(
AttributeError: 'NoneType' object has no attribute 'repeat'"

i searched the original huggingface/diffusers - SDXLpipeline py file (https://github.com/huggingface/diffusers/blob/v0.27.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py)
then i found

if do_classifier_free_guidance and negative_prompt_embeds is None and zero_out_negative_prompt:
negative_prompt_embeds = torch.zeros_like(prompt_embeds)
negative_pooled_prompt_embeds = torch.zeros_like(pooled_prompt_embeds)

and classifier_free_guidance(CFG) is defined when >1.

so if this pipeline is processed i must put CFG more than 1.

However you suggestion is put CFG set to 0.

So i'm qurious if you give some advice to avoid to put CFG=0

cf) i could run when CFG > 1(num_inference_steps=4, guidance_scale=2). but it's not satisfied to me.

output1.png
output2.png

Lavico changed discussion status to closed

sorry, I used diffusers == 0.18 version. but i upgrade diffusers=22.0 then it works well.
sdxl_lightning_step_4_cfg_0_20240530_0205.png

Sign up or log in to comment