ValueError: Loading Flux.1-Fill-dev is not possible

#14
by marcii98 - opened

Hi, I have following problem: When trying to use Flux.1-Fill-dev in my pipeline I get a mismatch in the torch.Size for the output_channels:

[...]
The config attributes {'invert_sigmas': False} were passed to FlowMatchEulerDiscreteScheduler, but are not expected and will be ignored. Please verify your scheduler_config.json configuration file.
[...]
The config attributes {'out_channels': 64} were passed to FluxTransformer2DModel, but are not expected and will be ignored. Please verify your config.json configuration file.

Traceback (most recent call last):
[....]
ValueError: Trying to set a tensor of shape torch.Size([64]) in "bias" (which has shape torch.Size([384])), this looks incorrect.

Here is my code for using the FluxPipeline:

from app.preprocessing.transform_operations import BaseImageTransform
from app.training.config_summary import Config_Summary
import torch
from PIL import Image
from diffusers import FluxPipeline

 class Flux1FillTransform(BaseImageTransform):

def __init__(self, config: Config_Summary):
    super().__init__(config)
    self.prompt = config.prompt
    self.pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev")
    self.pipe.to("cuda" if torch.cuda.is_available() else "cpu")

def process_image(self, img: Image.Image) -> Image.Image:
     return self.pipe(prompt=self.prompt, image=img).images[0]

In my BaseImageTransform, I adjust the images in order to fit a CNN:

transform_steps = [
transforms.Resize((self.config.input_shape, self.config.input_shape)),
transforms.ToTensor(),
transforms.Normalize(mean=self.config.mean, std=self.config.std)
]

the values are in my config:
{
"mean": [0.485, 0.456, 0.406],
"std": [0.229, 0.224, 0.225],
"input_shape": 224,
"prompt": "Add a random object to the image."
}

Has anyone experienced a similar issue or has some idea, why I am not able to load the model?

have you resolved this issue?

Same issue.

Sign up or log in to comment