auto-sd-paint-ext: The extension doesn't work at all (img2img() missing 3 required positional arguments)

Describe the bug Getting the error each time I click “start inpaint/img2img/txt2img” in Krita.

To Reproduce Steps to reproduce the behavior:

  1. Insert any settings
  2. Click “start inpaint/img2img/txt2img”

Screenshots WB0N0DR

auto-sd-paint-ext:WARNING: Interrupted!
auto-sd-paint-ext:INFO: img2img:
{'restore_faces': False, 'face_restorer': 'None', 'codeformer_weight': 0.0, 'inpainting_fill': 1, 'inpaint_full_res': False, 'inpaint_full_res_padding': 0, 'mask_blur': 0, 'invert_mask': False, 'inpaint_mask_weight': 1.0, 'sd_model': 'anything-v4.5-inpainting.safetensors [6d9a152b7a]', 'sd_vae': 'blessed2.vae.pt', 'clip_skip': 2, 'script': 'None', 'script_args': [], 'prompt': 'flawless, highly detailed, high resolution, sharp focus, 4k, vivid colors, best quality, perfect lighting, trending on artstation', 'negative_prompt': 'Negative_ng_deepnegative_v1_75t, Negative_badhandv4, (extra fingers, deformed hands:1.15), (worst quality, low quality, poor quality, bad quality:1.35), logo, watermark, text', 'seed': -1, 'seed_enable_extras': False, 'subseed': -1, 'subseed_strength': 0.0, 'seed_resize_from_h': 0, 'seed_resize_from_w': 0, 'sampler_name': 'DPM++ 2M Karras', 'steps': 20, 'cfg_scale': 10.0, 'denoising_strength': 0.4, 'batch_count': 1, 'batch_size': 1, 'base_size': 512, 'max_size': 768, 'disable_sddebz_highres': False, 'tiling': False, 'highres_fix': False, 'firstphase_height': 512, 'firstphase_width': 512, 'upscaler_name': 'None', 'filter_nsfw': False, 'include_grid': False, 'sample_path': 'outputs/krita-out', 'save_samples': True, 'is_inpaint': True, 'resize_mode': 1, 'color_correct': True, 'do_exact_steps': True}
auto-sd-paint-ext:INFO: img size: 1074x1432 -> 512x688, aspect ratio: 0.75 -> 0.74, -0.78% change
*** Error completing request
*** Arguments: ('', 4, 'flawless, highly detailed, high resolution, sharp focus, 4k, vivid colors, best quality, perfect lighting, trending on artstation', 'Negative_ng_deepnegative_v1_75t, Negative_badhandv4, (extra fingers, deformed hands:1.15), (worst quality, low quality, poor quality, bad quality:1.35), logo, watermark, text', 'None', <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=1074x1432 at 0x2387BFC8A00>, None, None, None, None, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=1074x1432 at 0x2387BFC8A00>, <PIL.Image.Image image mode=L size=1074x1432 at 0x2387BD3C910>, 20, 2, 0, None, 1, False, False, 1, 1, 10.0, 0, 0.4, -1, -1, 0.0, 0, 0, False, 1, 688, 512, 1.0, 1, False, 0, False, '', '', '', [], 0) {}
    Traceback (most recent call last):
      File "E:\AI\stable-diffusion-webui-directml\modules\call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "E:\AI\stable-diffusion-webui-directml\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
    TypeError: img2img() missing 3 required positional arguments: 'img2img_batch_png_info_props', 'img2img_batch_png_info_dir', and 'request'

Desktop (please complete the following information):

  • OS: Windows 11 64 bit.
  • WebUI commit revision: 4873e6aaba62c2fa2e4481798e85098e50e1e2c6
  • Extension commit revision: 00714355890aefa9a09e7fdb1f9a136c46a17618

Additional context Doesn’t work since 1.5.1 Automatic update. Worked fine before that.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 53

Most upvoted comments

FYI, SD.Next just pushed out an update that seems to have fixed my version of the extension for txt2img and img2img (they sanitized some bad script-info data in the API). And my robustness changes worked!

image

That parameter refiner_steps would have completely broken the old version of this app, requiring all the manual checks outlined earlier. By guessing a default value, the image was allowed to complete and Krita worked like normal. Yes, the terminal has A TON of errors from various scripts that were expecting additional data in the *args, but as long as you can use the plugin to make art who cares!

Since @poipoi300 copied the robustness changes to his code, I’m guessing his version should work on the latest SD.Next as well now.

(Also, I’ve started work on a new Krita plugin using the API. I was able to get txt2img to work via API on the command line, so now the challenge is the Krita specific stuff)

@Miraihi Check my fork directly. I updated it to be working with 1.6.0 2 days ago. Could’ve been a lot earlier if I had kept on top of the versions or didn’t assume an issue to be caused by something else 😅

I’m also not really testing SD.Next at all, its support is(was?) pretty much a miracle thanks to @DrCyanide lmao. Speaking of, did you try my fork on SD.Next? Because the issues with A1111 were also on the frontend. If we’re lucky it was the same exact issue and I fixed both.

Also would like to see ControlNet added to krita. Being able to edit openpose/depth map/whatever straight in krita seems really powerful. Someone left a comment on one of my fork’s issues saying they were working towards merging our recent fixes with the controlnet fork. I thnk they were referencing this one? It hasn’t been worked on in 2 months it looks like, but most of the code is probably still fine and the author even said the ControlNet part used the official API.

Unfortunately, past making sure my fork works, I don’t have much time for this. Most of my already little free time is spent working on images rather than coding. If I somehow 5x my speed at making images, then the time saved can go into coding 😂

Wow, if only I had found the discussion here before fixing it…

I have follow along posts and i got it to work in the end.

first i added the gradio to the import in app.py

from __future__ import annotations

import logging
import os
import time
import gradio as gr #added by user

and after that i go down past output = wrap_gradio_gpu_call(modules.img2img.img2img) to add the new args

        [],  # override_settings_texts (unsupported)
		False,	# img2img_batch_use_png_info (added by user)
		[],	# img2img_batch_png_info_props (added by user)
		"",	# img2img_batch_png_info_dir (added by user)
		gr.Request(),	# request (added by user)
        *args,

@DrCyanide and @Miraihi thanks for the post it was really helpfull

(Also, I’ve started work on a new Krita plugin using the API. I was able to get txt2img to work via API on the command line, so now the challenge is the Krita specific stuff)

As a follow-up to my previous post, I’ve uploaded the first working version of my API based plugin. I’ve tested it and it works with both A1111 and SD.Next.

https://github.com/DrCyanide/cyanic-sd-krita

This will be the only time I bring up my plugin here. I only do so because the conversation about fixing this plugin is what pushed me into developing it, so I figure the people here would be the most interested in it at this point.

I consider this to be in a “Usable Alpha” state. I think I’ve made some usability improvements over auto-sd-paint-ext (beyond just “does it work?”), such as preview images being displayed in canvas, support for Styles that a user has defined in the WebUI, more compact layout, etc.

I’m trying to add the features I use in Stable Diffusion the most first. This means that things like ControlNet and After Detailer will likely be added before things like Upscaling, CFG scale, or Face Restore. Some things (like Scripts) I don’t plan to add anytime soon, and may not be added at all.

Edit: Inpainting and ControlNet now included.

Making some early notes for anyone else trying to figure this out (looking at you, @poipoi300 )

SD.Next’s issue comes from some value passed to Krita that the Krita frontend doesn’t handle well. I believe these are related to the SD Scripts, but I haven’t tracked down exactly what/why is breaking. The terminal looks clean, which means the plugin didn’t get far enough along to actually ask SD.Next to do anything. The parameters fix might still be working here, but the frontend needs some attention before we can find out.


A1111 broke the one assumption I made: that the backend would work with it’s own default values. A1111 is crashing on a default value it picks if it can’t find a certain key. It’s in modules/options.py, lines 90 and 91. 90 sets the value of info to None, then line 91 doesn’t check if info is None, it just tries to use it anyway.

Changing line 91 to be if info == None or info.do_not_save: gets further, but it still crashes. That *args that is at the end of txt2img and img2img parameters? Looks like A1111 changed what it expects there. In this extension, those *args have been handled by backend\script_hack.py. I can’t automate a system to check for what parameters it expects there, so fixes for changes like this will have to be completely manual.


Personally, I want to see ControlNet integrated into a Krita plugin that I can use with SD.Next or A1111. The only way I see that happening is by switching from our lovely little hacking to using the API. Since that will basically be a full re-write of the app (since the SD.Next issues are on the frontend anyway), I think my hobby dev time would be better spent trying to make a new Krita plugin to accomplish that goal.

@DrCyanide Not familiar with Vlad’s webUI at all. Is it just calling the txt2img/img2img that needs to be different? I feel either the user could select which UI they’re using or the backend just polls the backend for the info. I imagine there are many different identifiable things on the API.

I don’t know how much is different right off (not at my PC), but I know at the very least that Vlad’s doesn’t have the request parameter.

@Fhalo48 Have you tried using the fix that @poipoi300 posted a pull request for. https://github.com/poipoi300/auto-sd-krita-ext-xl

hi ! I also have the exact same problem and tried to slove but i couldn’t, I am also too bad to fix it (ended up with a few more error for gr and user.img2img). Just wanted to say thx for trying to help !