imaginAIry icon indicating copy to clipboard operation
imaginAIry copied to clipboard

Larger size images always trigger safety filter on the M1

Open thisischrisswift opened this issue 2 years ago • 11 comments

-w 640 -h 896 and other larger-sized images seem to always trigger the safety filter no matter the prompt.

thisischrisswift avatar Sep 17 '22 21:09 thisischrisswift

Thanks I'll look into that. what system architecture are you on?

brycedrennan avatar Sep 17 '22 21:09 brycedrennan

Also did you try --upscale with just 512x512. Often times good enough

brycedrennan avatar Sep 17 '22 21:09 brycedrennan

MacBook Pro, M1 Max 32 GB. I have been able to make 512x768 and upscale, but I am trying to get printable images, so looking for as big as possible. Thanks for looking into it

thisischrisswift avatar Sep 17 '22 21:09 thisischrisswift

that makes sense, for a printable image I would use LDM upscaler, which takes much longer but I think works better. You might also want to look at "gobig" I don't have either of these integrated yet but I'm working on it. Links below

https://github.com/jquesnelle/txt2imghd https://github.com/sd-webui/stable-diffusion-webui

brycedrennan avatar Sep 17 '22 21:09 brycedrennan

I got this with the example command and no flags.

Generating 🖼 : "a photo of a dog" 512x512px seed:501863965 prompt-strength:7.5 steps:40 sampler-type:plms PLMS Sampler: 100%|███████████████████| 40/40 [00:30<00:00, 1.31it/s] ⚠️ Filtering NSFW image

abrambailey avatar Sep 19 '22 20:09 abrambailey

thanks for the reproducible case @abrambailey . I'll see if the filter can be made to have fewer false-positives

brycedrennan avatar Sep 20 '22 00:09 brycedrennan

@abrambailey I wasn't able to reproduce with that example actually. A hunch I have is that sometimes the generation fails, makes a black image, and that the filter that flags that blank image.

I did reproduce the larger images triggering the filter though. looking into that

brycedrennan avatar Sep 20 '22 04:09 brycedrennan

The images produced at -w 640 -h 896 on the M1 are just noise, which for some reason gets flagged by the safety filter. So the safety filter is only guilty of confusing us in this case. I'm not sure what the root cause is but the little debugging I did implies the error may be originating from the model itself and thus not much I can do about it.

Next steps are to try some other codebases and see if it works there or if it's a universal problem.

brycedrennan avatar Sep 20 '22 05:09 brycedrennan

Larger generations working fine on linux at least.

brycedrennan avatar Sep 20 '22 05:09 brycedrennan

This might not be directly related, but on a 2070 (Windows through docker/WSL2) upscale causes crashes on sizes above 256x256:

CUDA error: unknown error
CUDA kernel errors  might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

I don't have the stacktrace at hand, as this is running on a machine I don't have immediate access to but I should be able to provide more later today/tomorrow. This crash was from these parameters IIRC:

ImaginePrompt(
    prompt_text="hedgehogs in space",
    width=512, height=512,
    upscale=True, fix_faces=False,
    steps=50, prompt_strength=0.7
)

This same card is able to handle 1024x1024 just fine when upscale is not used. If this is unrelated to this issue, let me know and I will open a new issue with more detailed information.

NiclasEriksen avatar Sep 28 '22 17:09 NiclasEriksen

thanks for the report @NiclasEriksen . I do think this is unrelated. Would be great if you opened another ticket.

brycedrennan avatar Oct 03 '22 23:10 brycedrennan

As of 5.0.1 you can now generate larger images on the M1. It does take a lot longer though.

brycedrennan avatar Nov 13 '22 22:11 brycedrennan