-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The extension doesn't work at all (img2img() missing 3 required positional arguments) #158
Comments
I've fixed this on my local copy a few times now. A few weeks ago I had it working, then the SD XL updates it broke again, and I fixed it once again. This method will help you fix it each time it breaks in the future. I'm using SD.Next (vlads), but the process should be identical for A1111
The quick-and-dirty way to fix the extension each time it breaks is to open up those modules and go item by item through their parameters and line them up with the app.py version. After you've done that, save app.py and restart your stable diffusion server. When you try to use the Krita extension, you'll see a lot of output in the server logs, including errors, but it should work. It's tedious, it sucks, and I'm sure there's a better way to do it, but for right now that's what you need to do. |
Same her, getting following errors:- auto-sd-paint-ext:WARNING: Interrupted! |
@DrCyanide Thanks for a really good hint, I was wondering what I can do myself about that! Getting such error
What I did exactly is wedged
between In img2img.py the "request" argument looks like that: I tried just putting "gr.Request" as a string like |
Have you tried passing |
@DrCyanide |
|
Yes, exactly the same error that traces back to |
Have you restarted A1111 after saving your changes to app.py? Because the only way you should be able to get that error is if you skipped that last step, and A1111 is using the cached version of app.py. |
I restart it properly after each change. |
What's "properly" in this case? Through the UI? I don't know if that does a full restart. Try killing it in the command line and starting it up from scratch. |
"Properly" means pressing ctrl+c on cmd window and closing it. Look, I wouldn't come that far without knowing such basic things. |
Just needed to make sure. As a longer term fix, I think it might be possible to name each parameter that's passed in (example: |
@DrCyanide There has actually been the offset issue (I didn't put one argument that sd-auto wasn't complaining about). But the error stays pretty much the same, with the minor changes
It's still a mystery how to get around that "username". Right now the last few lines of img2img section of my
|
Well, that's progress at least! There's built-in API documentation for A1111 that might explain how to populate the request parameter correctly. This wiki link doesn't have a screenshot of the current version, but if you follow the steps (and the built-in version is updated) then it might be the last step you need. https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API |
Well, I tried. But it's time to realize I'm not good enough to really fix it myself, so for the time being I'll be using Photoshop extension that seems to be working just fine. |
I know you said you're done with it, but I have one last idea to try if you (or someone else reading this down the road) is willing to try it. Just doing a quick search of the code, it looks like Since it's basically unused, this could make for an easy fix for A1111 users. Add |
hi ! |
I have follow along posts and i got it to work in the end. first i added the
and after that i go down past
@DrCyanide and @Miraihi thanks for the post it was really helpfull |
Hi Great!! It works to img2img, any syggestions for txt2img? |
Oh yep its working ! Thx ! |
I;ll try again for txt2img |
In my case I'm getting following err: my code layout
|
Oh I cheked the wrong lines (sry very tired) you need to replace the arg that gives you errors, for me it was |
@Fhalo48 hey here is the fix i use for txt2img add after
|
Wow, if only I had found the discussion here before fixing it... |
@DrCyanide Thanks for all the help and solution seeking. |
@Ripsomeone , you are a star. That works, thank you and everyone else/ |
@Miraihi It's likely to break in the future again unfortunately. Not even mentioning the random new positional arguments that can be added. For the request object, I'm passing the internal pydantic request objects that I added a "username" field to. It seems like txt2img and img2img are accessing the passed "gradio" request with a generic property accessor, so if they keep doing that it should be as simple as just adding new fields in the pydantic models at least. I'm considering picking this up since interpause has been inactive for a while, and there is at least one QoL thing I want implemented. |
Hi Spoken to soon :( Could some check if the following code is correct fro img2img |
@Fhalo48 Try my fork. |
@Fhalo48 Have you tried using the fix that @poipoi300 posted a pull request for. |
The next question will be how do we handle the different parameters between A1111 and Vlad's SD.Next? I don't think it's worth forking over (since it's only a few lines that are different), but we need an elegant solution that provides what each API needs. A dictionary of kwargs could work, but we need a way to identify which project the extension is being called from. |
Thanks again. I'll try the fork/ |
@thanks again pyhon, experts. The fork works :) |
@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. Edit for clarity: |
@Fhalo48 🤣 I wish recruiters regarded me as an "expert". Glad to help though. |
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 |
Here's the current differences between Vlads and A1111's Img2Img:Vlads ADDS Txt2Img:Vlads ADDS So 10-12 keyword arguments change between calling one endpoint and calling the other. |
Thank you everybody for your work, now it is alive, although it has some problems with other extensions (control net, segment anything and so on), but it is not big problem, as I can finally generate and edit pictures again with more precision than original webui. Thank you everybody again. |
@DrCyanide Maybe worth checking then. Ideally it would support everything, but it's never that simple of course. A1111, Vlad, Comfy, Invoke and more lol. I have some experience building these kinds of pipelines, but I'm not well-versed in the current codebase at all, so I can't guarantee anything on that front or even in general lol. I think a rewrite to use the A1111 API would be a good start. @XenHunt What kind of problems? Mine has been spitting errors for nearly every extension present but that was the case since the start. The fact that the code is essentially hijacking functions might have something to do with that. I am definitely interested in fixing that as well since it's been bugging me. BTW this discussion section is getting pretty off-topic now. I'm going to work on adding the stuff I'm interested in to my fork for now, and issues like #158 would definitely get taken care of quickly as I use this extension myself every day. I would look at PRs too. For anything else, no guarantees. |
@poipoi300 yeah, it is just spitting errors as you say, not something big, and I wanted to fix it too (for control net especially as it will empower krita really great), but I am not master of python (I am noob) and so on, so it will be hard. Good luck with your fork! |
I've put in a pull request that should make this kind of error never show up again - or at least be drastically faster to fix! It programmatically checks what parameters the backend wants (thanks to Python's And as a result of all of that, my pull request is A1111 and SD.Next compatible, and should have some forwards and backwards compatibility! A new copy of the extension will work with an older copy of the UI, and a newer copy of the UI will work with this version of the extension. I really hope it gets pulled, because it would be a massive help for maintenance. |
@DrCyanide Mind doing a PR on my fork for that? I don't agree with all the changes and just reading the code I see that a bug which was fixed on my fork has been reintroduced, but other than that it looks good if it works. Edit: Mostly don't agree with the verbosity and specificity of the added text in the README. The goal of the readme is not to inform users how the code works or how it has been changed. |
Hate to resurrect that thread after all the work you've done guys, but the extension fork by DrCyanide and poipoi300 only works up to Automatic version 1.5.2 and breaks again at 1.6.0. Seems like the new implementation is still not robust enough. Also doesn't work correctly for the latest commits of SD Next, at least for me. |
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. Changing line 91 to be 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. |
@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 😂 |
@poipoi300 Thanks, I see it now. I haven't realized that you have the entire fork unassociated with a pull request. It seems to work fine. |
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! That parameter 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) |
Unfortunately I needed to stop using the internal txt2img and img2img functions because they no longer take in a seed as parameter. I had to sidestep them to get seeds working again. I kept the main idea of your robustness change, but it's mostly removed because it's not applicable to the way it works now. It's a dataclass where all fields have defaults instead of a func, so I just fill whatever params we do have into the dataclass. Unfortunately this also broke SD.Next support. It may be possible to get it back, as images are still being generated through the extension and it's very close to giving back the image to the frontend when it does raise an exception. Just that right now it doesn't work anymore. Will look into SD.Next support next weekend. On the bright side, I think doing it this way may make it easier to suppress those pesky errors and get scripts working again. |
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. |
@DrCyanide your fork looks promising too! Thanks for sharing, I'll try testing it out soon :) |
Great job, @DrCyanide! I desperately need the inpainting feature, but as soon as you implement that I'll be switching for good. |
Inpaint is added now (as well as ControlNet). Please leave issues with any bugs you find in it on my project's page - I'm sure there's a lot of stuff I don't have hooked up right. |
Describe the bug
Getting the error each time I click "start inpaint/img2img/txt2img" in Krita.
To Reproduce
Steps to reproduce the behavior:
Screenshots
Desktop (please complete the following information):
Additional context
Doesn't work since 1.5.1 Automatic update. Worked fine before that.
The text was updated successfully, but these errors were encountered: