4

Just got access to SDXL model, looking to test it for its upcoming release... Unfortunately, the code we currently use for our service seems to not work with stabilityai/stable-diffusion-xl-base-0.9, and I'm not entirely sure what is different with SDXL and what I need to change.

We are using a different pipeline so we can generate previews of the images, so its not the typical template that is provided on the SDXL model readme. The error seems to be happening in unet_2d_condition.py (in diffusers lib)

Traceback (most recent call last):
  File "C:\Users\myalt\Desktop\testing image grid\main.py", line 159, in <module>
    socker_listener.generate_image()
  File "C:\Users\myalt\Desktop\testing image grid\main.py", line 154, in generate_image
    foo = self.blocking_code()
  File "C:\Users\myalt\Desktop\testing image grid\main.py", line 109, in blocking_code
    noise_pred = self.unet(latent_model_input, t,
  File "C:\Users\myalt\Desktop\testing image grid\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\myalt\Desktop\testing image grid\venv\lib\site-packages\diffusers\models\unet_2d_condition.py", line 839, in forward
    if "text_embeds" not in added_cond_kwargs:
TypeError: argument of type 'NoneType' is not iterable

I've updated to diffusers==0.18.2.

Here is a example code which makes a bunch of images and puts them into a grid, using this a custom pipeline https://hatebin.com/tqppqfsehk

kamza
  • 75
  • 5

1 Answers1

1

Interesting, this looks like a bug in diffusers. added_cond_kwargs is specified as being optional, and the function signature explicitly defaults it to None. However, the subsequent code does not check for the None case, treating it as if it is a dictionary. It's worth filing an issue with diffusers if it hasn't already been reported. They can probably fix it by simply setting added_cond_kwargs to {} if it's passed as None.

In the meantime, you should be able to work around this by explicitly passing added_cond_kwargs={} to the unet function.

nneonneo
  • 171,345
  • 36
  • 312
  • 383
  • Doesn't seem to work. I'm getting this same error and it'll still throw an error because added_cond_kwargs needs to have "text_embeds" set it seems. – Mark Dabler Aug 23 '23 at 15:32
  • Same for me. I set added_cond_kwargs={}, but that does not work for me either. – Raj Aug 23 '23 at 20:25