Closed Sporking closed 6 months ago
Hi @Sporking,
Thank you for reaching out and for the detailed bug report.
I was looking into the [img2img]
shortcode last night and drew the same conclusions as you have - the underlying WebUI function takes a different set of arguments in v1.9.0. It isn't clear to me yet how to pass in the sampler_name
and scheduler
values. If anyone knows more, please feel free to chime in.
I'll attach the current, work-in-progress update for [img2img]
if anyone wants to take a swing at it. Otherwise, I should have some time later this week to debug.
Hi,
After some trial and error, I found I was able to resolve the issue by creating a patched version of the WebUI's img2img()
method and supplying it with the missing variables. This approach should be a bit more resilient to future WebUI updates.
I'll attach the fixed shortcode here. It will be included in the Unprompted v10.10.0 release, coming soon™.
This fix is now live in v10.10.0. Let me know if it gives you any further trouble. Thank you!
Due diligence
Describe the bug
I attempted to use the prompt
on current updates of Automatic1111 and Unprompted, and got thrown exceptions and no images as output.
(Note: this same prompt was used in #190, and worked fine at that time.)
When I tried this, I noticed that only the following files were created (due to 'debug' in the prompt):
I got errors in the console that looked like this:
Note that the error message above seems to be complaining that the '
denoising_strength
' parameter has the valueNone
rather than being a float in the expected range of 0..1.I investigated and found this call to to the '
img2img
' function, inC:\A1111 Web UI Autoinstaller\stable-diffusion-webui\extensions\unprompted/shortcodes\stable_diffusion\img2img.py
:However, the
img2img
function that is being called, located inC:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\img2img.py
, has a different (incompatible) function signature:In particular, in the call to this function, the '
request
' parameter is being passed in the second-to-last argument position (betweenimg2img_batch_png_info_dir
and*self.Unprompted.main_p.script_args
), but the function apparently expects to receive it in the second argument position (betweenid_task
andmode
). Also, the arguments 'steps
' and 'sampler_mode
' being passed in the function call don't seem to have any corresponding function parameters at all, which will result in all other arguments after them being off by two positions.It appears to me that the function signature of the Automatic1111
img2img
function has changed, and the unprompted plugin's call to it therefore needs to be changed to match it.As an experiment, I tried making this change myself (move the
request
parameter, and delete thesteps
andsampler_mode
parameters), but that resulted in getting a different error:so there may still be other problems to be fixed.
Also, please notice the "
AttributeError: 'str' object has no attribute 'save'
" error message that eventually occurs because of these earlier errors. It looks as though an incorrectly typed value is being returned from a function (e.g. returning an error message instead of an image object that was expected by the caller). This situation should probably have been detected in a different way (throw an exception instead of returning a string, or have the caller detect the returned string and handle it as an error?) and should then have resulted in an error message that described what went wrong more clearly, like "Attempt to execute img2img failed due to unexpected exception: <exception error message text goes here>
".When fixing this bug, I suggest looking at other calls to Automatic1111 functions that Unprompted makes (txt2img, etc.), and ensuring that they don't have similar problems. Whoever changed the signature of the img2img function might have changed others as well.
Prompt
See above.
Log output
See above.
Unprompted version
8cc97ad8 | 2024-04-19 00:20:07
WebUI version
v1.9.0 adadb4e3c7382bf3e4f7519126cd6c70f4f8557b, Python 3.10.11