gpt4 book ai didi

Diffusers SDXL "TypeError: argument of type 'NoneType' is not iterable"(Differs SDXL“TypeError:‘NoneType’类型的参数不可迭代”)

转载 作者:bug小助手 更新时间:2023-10-28 21:38:17 59 4
gpt4 key购买 nike



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.

刚刚获得了SDXL模型的访问权限,希望为即将发布的版本进行测试...不幸的是,我们当前用于我们服务的代码似乎不能与稳定ai/稳定-扩散-xl-base-0.9一起工作,我不完全确定SDXL有什么不同,以及我需要更改什么。


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)

我们使用的是不同的管道,所以我们可以生成图像预览,所以它不是SDXL模型自述文件中提供的典型模板。错误似乎发生在UNET_2d_Condition.py(在扩散器库中)


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.

我已经更新到扩散器==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

下面是一个示例代码,它制作了一堆图像并将它们放入网格中,使用此自定义管道https://hatebin.com/tqppqfsehk


更多回答

Did you ever find a solution to this? I'm running into the same problem.

你有没有找到解决这个问题的办法?我也遇到了同样的问题。

优秀答案推荐

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.

有趣的是,这看起来像是扩散器中的错误。added_cond_kwargs被指定为可选的,并且函数签名显式地将其默认为None。但是,后续代码不检查None情况,将其视为字典。如果还没有报告问题,值得向扩散器提交问题。如果added_cond_kwargs被传递为None,他们可能只需将其设置为{}就可以修复它。


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

同时,您应该能够通过显式地将ADDIND_COND_KWARGS={}传递给unet函数来解决这个问题。



I'm assuming you're using the StableDiffusionPipeline. Try using the StableDiffusionXLPipeline instead. This should solve your issue.

我假设您正在使用SableDiffusionPipeline。请尝试改用SableDiffusionXLPipeline。这应该可以解决你的问题。


https://huggingface.co/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline

Https://huggingface.co/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline


更多回答

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.

似乎不管用。我收到了这个相同的错误,但它仍然会抛出一个错误,因为好像需要设置“Text_Embedds”。

Same for me. I set added_cond_kwargs={}, but that does not work for me either.

我也一样。我设置了ADDED_COND_KWARGS={},但这对我也不起作用。

Issue persists for both XL and non-XL pipelines

XL和非XL管道都存在问题

@TedBrownlow can you share a notebook or code with your errors?

@TedBrownlow你能分享你的错误的笔记本或代码吗?

I think I was using some incompatible custom architecture. Using standard settings resolved the error for me

我想我使用的是一些不兼容的定制架构。使用标准设置为我解决了该错误

59 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com