Skip to content

SDXL prompt embeddings not working #3970

@adhikjoshi

Description

@adhikjoshi

Describe the bug

pipe = StableDiffusionXLPipeline.from_pretrained(
                    model_id, torch_dtype=torch.float16, use_safetensors=True, variant="fp16", use_auth_token=hf_token).to("cuda")
cond, uncond = text_embeddings(
    self.pipe, args_dict["prompt"], args_dict["negative_prompt"], clip_skip=2)
del args_dict["prompt"]
del args_dict["negative_prompt"]
args_dict["prompt_embeds"] = cond
args_dict["negative_prompt_embeds"] = uncond
pipe(**args_dict)

Gives error


File "/opt/conda/envs/ldm/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 402, in encode_prompt
pooled_prompt_embeds = pooled_prompt_embeds.repeat(1, num_images_per_prompt).view(
                           ^^^^^^^^^^^^^^^^^^^^
 UnboundLocalError: cannot access local variable 'pooled_prompt_embeds' where it is not associated with a value

Reproduction

SDXL

Logs

No response

System Info

pip3 install git+https://github.com/huggingface/diffusers.git

Who can help?

@patrickvonplaten

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions