FluxPipeline type error

import torch
from diffusers import FluxPipeline

model_id = "black-forest-labs/FLUX.1-schnell" #you can also use `black-forest-labs/FLUX.1-dev`

pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
pipe.enable_sequential_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power

prompt = "A cat holding a sign that says hello world"
seed = 42
image = pipe(
    prompt,
    output_type="pil",
    num_inference_steps=4, #use a larger number if you are using [dev]
    generator=torch.Generator("cuda").manual_seed(seed)
).images[0]
image.save("flux-schnell.png")

Ive installed diffusers using pip install --upgrade diffusers[torch], but Im getting type errors in two places. On “from diffusers import FluxPipeline” Im getting

"FluxPipeline" is not exported from module "diffusers"
  Import from "diffusers.pipelines.flux.pipeline_flux"

and on image = pipe() Im getting

Object of type "DiffusionPipeline" is not callable
  Attribute "__call__" is unknown

However, I can run the code and generate images just fine. I can suppress the warnings with “# type: ignore” but I havent seen anyone else mention these errors so Im wondering if something is wrong. I tried uninstalling diffusers library, purging cache in pip and reinstalling, but still seeing the same errors.

I use the diffusers library frequently and have never encountered that error.

However, I do have an idea of what one of the errors might be: when Flux was first supported, FluxPipeline was in the location indicated by the error message.
But it must have been a long time ago, and I don’t see why the error message would appear now…
As for the DiffusionPipeline, it’s probably just a bug altogether.

Either way, they are both bugs.
If the library really should have generated an error message, let alone a warning, it would not have been able to generate the image.

I’m sure it will be fixed soon, so it’s best not to worry about it.
@sayakpaul it’s not a major bug, but the pip version of diffusers is buggy. Perhaps there was some mistake in the Pipeline list update the other day?

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.