8000 BlipDiffusionPipeline example breaks in v0.33.1, but works in v0.32.2 · Issue #11563 · huggingface/diffusers · GitHub
[go: up one dir, main page]

Skip to content
BlipDiffusionPipeline example breaks in v0.33.1, but works in v0.32.2 #11563
@Gorluxor

Description

@Gorluxor

Describe the bug

The code crashes in the newest version.

The minimum viable code is part of the official Huggingface BlipDiffusion example found here, and the full example works on diffusers v0.32.2:

from diffusers.pipelines import BlipDiffusionPipeline
from diffusers import DiffusionPipeline
from diffusers.utils import load_image
import torch

blip_diffusion_pipe = BlipDiffusionPipeline.from_pretrained(
    "Salesforce/blipdiffusion", torch_dtype=torch.float16
).to("cuda")

# blip_diffusion_pipe = DiffusionPipeline.from_pretrained(
#     "Salesforce/blipdiffusion" , torch_dtype=torch.float16
# ).to("cuda") # my attempt to see if DiffusionPipeline will fix the problem


cond_subject = "dog"
tgt_subject = "dog"
text_prompt_input = "swimming underwater"

cond_image = load_image(
    "https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/dog.jpg"
)
guidance_scale = 7.5
num_inference_steps = 25
negative_prompt = "over-exposure, under-exposure, saturated, duplicate, out of frame, lowres, cropped, worst quality, low quality, jpeg artifacts, morbid, mutilated, out of frame, ugly, bad anatomy, bad proportions, deformed, blurry, duplicate"


output = blip_diffusion_pipe(
    text_prompt_input,
    cond_image,
    cond_subject,
    tgt_subject,
    guidance_scale=guidance_scale,
    num_inference_steps=num_inference_steps,
    neg_prompt=negative_prompt,
    height=512,
    width=512,
).images
# output[0].save("image.png")
output[0]

Output / Error:
Warnings produce the output below, and are triggered at

logger.warning(f"cannot get type annotation for Parameter {k} of {cls}.")

cannot get type annotation for Parameter mean of <class 'diffusers.pipelines.blip_diffusion.pipeline_blip_diffusion.BlipDiffusionPipeline'>.
cannot get type annotation for Parameter std of <class 'diffusers.pipelines.blip_diffusion.pipeline_blip_diffusion.BlipDiffusionPipeline'>.

Error => KeyError: 'mean' on

and not expected_types[kw] == (inspect.Signature.empty,) # Skip if no type annotations

Did a quick check, seems like init_kwargs have 2 tensors mean and std, in addition to vae, etc. But didn't investigate fully what the cause was.

Reproduction

Error manifested when trying to load BlipDiffusion, minimal viable example on diffusers v0.33.1:

from diffusers.pipelines import BlipDiffusionPipeline
from diffusers.utils import load_image
import torch

blip_diffusion_pipe = BlipDiffusionPipeline.from_pretrained(
    "Salesforce/blipdiffusion", torch_dtype=torch.float16
).to("cuda")

Logs

System Info

Environment information (same system, 2 environments):
Python (Working): 3.10.16, (Not working): 3.10.17
Transformer (Working): 4.48.2 (Not working): 4.46.3
Diffusers (Working): 0.32.2 (Not working): 0.33.1
Torch (Working): 2.6.0+cu124, (Not working): 2.6.0+cu124

Who can help?

No response

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

      0