Open ComplexRobot opened 1 month ago
Hey there, @ComplexRobot! I'm Dosu, a bot here to help you with bug fixes, questions, and becoming a contributor. Let's take a look at the issue you've reported.
The "invalid value encountered in cast" warning you're experiencing is likely due to the presence of NaN (Not a Number) or infinite values in the image data when attempting to cast it to np.uint8
. This can result in the generation of completely black images.
ADetailer modifies image data through denoising and inpainting processes, which can potentially lead to invalid values if not handled correctly [1]. The astype(np.uint8)
operation does not handle NaN or infinite values gracefully, which can cause this warning.
To address this issue, you can try the following:
Check Input Data: Ensure that the input data to the astype(np.uint8)
operation does not contain NaN or infinite values. You might need to add checks or preprocessing steps to handle these values before casting.
Error Handling: Implement error handling around the casting operation to catch and manage any invalid values. This could involve setting NaN or infinite values to a default value before casting.
Review Parameters: Adjust the parameters used in ADetailer's inpainting process to see if different settings prevent the occurrence of invalid values. For example, tweaking denoising_strength
or other related parameters might help [2].
These steps should help mitigate the issue and prevent the generation of black images.
To continue talking to Dosu, mention @dosu.
I am also using Forge (f2.0.1v1.10.1-previous-591-gb592142f) Using Adetailer version: v24.9.0 XL-based model.
I have a same issue as OP, it has been issue for me quite a while and it always seemed really random. I have knows for while that at least in my case the error is caused by Prompt Scheduling , but it didn't always trigger.
Now I finally found out a fairly consistent way to trigger the bug: For me it is caused by using more that one Prompt Schedules at same time. (May also be called knows as prompt editing IDK...)
So to add to OPs steps:
Steps to reproduce
This prompt works fine:
megami magazine, score_9, [anime:3d:0.3],
But this prompt triggers the bug:
megami magazine, score_9, [anime:3d:0.3], [1girl:1boy:0.2],
Now here is another oddity
So even perfectly successful Adetailer operation without prompt scheduling can create conditions for for the bug to trigger, even if Adetailer is no longer enabled. Weird.....
Key seems to be that Adetailer must run at least once.
Other observations:
I had been using prompt editing in all my prompts for a while. So this tracks with what I was experiencing.
What I experienced was after generating and running ADetailer one time, the next image I generate will fail with the error with or without ADetailer enabled.
Also, your explanations/testing seems to indicate that ADetailer is hooked into the prompt scheduling code, which may be the key to fixing the bug. Thank you!
EDIT: I was looking into fixing the bug, but it's tough to figure out what's causing it and why. It doesn't seem to make sense that ADetailer would affect generations after it's been used. It doesn't help that the bug is somewhat random and doesn't always happen.
Describe the bug
Sometimes after using ADetailer or u DDetailer, the next time I generate an image, this error happens:
The result image will then be completely black and from then on all generated images will be blank black images (with or without detailer enabled). I am using the newest version of stability ui forge. This bug has seemed to occur in forge for a long time and only happens after I use ADetailer or u DDetailer.
This error occurs as long as the ADetailer extension is installed. If I disable the ADetailer extension (unchecked in the Extensions tab + Apply and restart UI) the bug goes away. Also, I've noticed the generated image output before inpainting is slightly different with ADetailer installed. (All the same generation parameters, but having ADetailer installed changes how it's generated.)
(Sorry, I do not have the full console log, because reproducing the bug is semi-random.)
Steps to reproduce
Screenshots
No response
Console logs, from start to end.
List of installed extensions
Stable-Diffusion-Webui-Civitai-Helper sd-dynamic-prompts sd-webui-infinite-image-browsing stable-diffusion-webui-state uddetailer