admin 管理员组

文章数量: 1086019

使用controlnet的过程中碰到以下问题,直接得到黑色图像

Potential NSFW content was detected in one or more images. A black image will be returned instead. Try again with a different prompt and/or seed.

搜索GitHub高赞解决方案:

pipe.safety_checker = lambda images, clip_input: (images, False)

然而,报错:

  File "xxxxx\diffusers\src\diffusers\pipelines\controlnet\pipeline_controlnet.py", line 1327, in __call__
    do_denormalize = [not has_nsfw for has_nsfw in has_nsfw_concept]
TypeError: 'bool' object is not iterable

 去pipeline_controlnet.py里看代码:

 因此,应该改为:

pipe.safety_checker = lambda images, clip_input: (images, None)

解决问题了 

本文标签: NSFW potential Diffuser images detected