Closed rexelbartolome closed 10 months ago
upon checking, reverting to auto-sd's krita_diff brought the same krita errors, so it might be because of StabilityMatrix's reinstallation of my Python
Thanks for opening a detailed issue. I think what StabilityMatrix is doing is likely the cause of the problem like you suspect, however fixing it is desirable nonetheless. I will test this myself to see if I can recreate the issue first. I can't give you a time estimate, but considering this is the only issue right now it's the priority haha.
If in the meantime you find a fix, more information, or some update from StabilityMatrix fixes it, please share that here.
So I reverted back successfully to Interpause/auto-sd + A1111 but not really sure what fixed it. Did lots of things but I think the events that happened before it worked was:
Thought it was a Python issue so I reinstalled/upgraded my Python 3.10.7 to 3.10.11 (which isn't recommended because I think A1111's Python recommends installing 3.10.7) but Krita startup errors still shows up
I went back to the auto-sd-guide Installation tab to see how to do a fresh install, after fiddling I found out that turning off Stable Diffusion Plugin
in the Python Plugin Manager
in the Krita settings then closing Krita, then opening it again, would make the Krita startup errors disappear. Enabling the plugin, then closing, then opening Krita again would make the errors appear again if I remember correctly.
I realized after testing that, I haven't completely closed/terminated both my running A1111 instance and Krita simultaneously. One was always open when I was troubleshooting the other. So I did just that:
I disabled the plugin, closed Krita. Closed A1111. Opened Krita, no errors so far, then enabled the plugin, closed Krita. I opened Krita again, but this time no errors and I think this was the point the tabs showed up again. Opened A1111 and the plugin was working as normal.
So I think it's better to just delete the symlinks or the copy of krita_diff
files in the Krita directory at the start OR disable the plugin while updating/replacing the extension. That way the plugin disappears (as well as the errors) from the Python Plugin Manager
and you'd have to reenable it again as part of the installation process. Haven't encountered this issue when updating Interpause's before but I rarely updated that anyway (since it always broke w every A1111 update lol)
I'll report back once I have more time to have another go at poipoi300/auto-sd + SD.Next :)
After a round of troubleshooting again, disabling and enabling doesn't seem to be the one that fixed it.
The three Krita start up errors mainly show up if there's no running instance of SD that it can connect to. Once theres a running SD instance, some errors pop up but the tabs still show up but at first Krita doesn't show the img2img tab. Just restart Krita once again and all the tabs show up fine with no errors popping up.
It seems to consistently show those Krita errors if I use StabilityMatrix, then the tabs don't show up either. It works fine if I use a normal installation of SD.Next though.
I spent a little time debugging this issue and found a possible cause. It seems that a common field options_cfg
takes in either a single string or a list of strings. Somehow in the case of QComboBoxLayout
and QMultiCheckBoxLayout
options_cfg sometimes gets set as a list of list of strings (list[list[str],...]
)
So i just made sure that if options_cfg
is a list, we flatten it first. These values get set in the constructor so you can probably move the flattening there to be safer but im not even sure where these parameters get set in the first place so theres definitely an earlier place to do this. But i believe you should be able to get past the errors from there. I'm currently working on merging these fixes with the controlnet version of sd-krita and i dont remember if this fixed all the issues exactly but i think it should.
So in my QComboBoxLayout.init
looks like:
def __init__(
self,
cfg: Config,
options_cfg: list,
selected_cfg: str,
label: str = None,
*args,
**kwargs
):
"""Layout for labelled multi-select CheckBox.
Args:
cfg (Config): Config to connect to.
options_cfg (list): List of options.
selected_cfg (str): Config key to read/write selected options to.
label (str, optional): Label, uses `selected_cfg` if None. Defaults to None.
"""
super(QMultiCheckBoxLayout, self).__init__(*args, **kwargs)
self.cfg = cfg
self.options_cfg = options_cfg
self.selected_cfg = selected_cfg
self.qlabel = QLabel(self.selected_cfg if label is None else label)
# TODO: flexbox-like row breaking
self.row = QHBoxLayout()
self.qcheckboxes = []
if isinstance(self.options_cfg, list):
self.options_cfg = [item for row in self.options_cfg for item in row]
for opt in self.options_cfg:
checkbox = _QCheckBox(opt)
self.qcheckboxes.append(checkbox)
self.row.addWidget(checkbox)
self.addWidget(self.qlabel)
self.addLayout(self.row)
and the start of QMultiCheckBoxLayout.cfg_init
looks like:
def cfg_init(self):
if isinstance(self.options_cfg, list):
self.options_cfg = [item for row in self.options_cfg for item in row]
Hey thanks for that, that helped me out.
I've currently tracked down the problem further down to frontends/krita/krita_diff/client.py:278-289
.
EDIT: Deleting these lines allows krita to open without errors and tabs to show up (scripts are missing options though, of course) but the extension still won't work, maybe because of the new way parameters are sent to the txt2img/img2img modules.
This file is where the frontend queries the backend for config options and sets them in the frontend config. The lines I mentioned are where the frontend sets values for script options like outpainting direction for instance.
Speaking of that, I've found that some of the data is duplicated. Here's a snippet from the json received from the A41 WebUI (I assume it's the raw data, but I would need to investigate more to be certain).
{
"type": "multiselect",
"label": "Outpainting direction",
"val": [
"left",
"right",
"up",
"down"
],
"is_index": false,
"opts": [
[
"left",
"left"
],
[
"right",
"right"
],
[
"up",
"up"
],
[
"down",
"down"
]
]
}
This is probably where our list of lists is coming from? Currently trying to resolve it there and probing around that area, although this may be all the time I have for today. Will have more tomorrow for sure.
This is now fixed and the implementation should not break with older webUI versions. I also fixed an unrelated bug which would've prevented the extension to work. I'm not sure that I implemented the fix as deep as it could go, but my quick attempt at going a level deeper did not work. I hate the debugging (or lack of) for this.
Feel free to update WebUI to 1.6.0 and the extension using git pull. Release coming tomorrow.
I've installed SD.Next through StabilityMatrix, basically an SD installation manager. Installed
https://github.com/poipoi300/auto-sd-krita-ext-xl
in the extensions tab. Relinked/repasted the krita_diff/desktop to the Krita directory. Rechecked if Stable Diffusion plugin is checked in the Python Plugin Manager but the other tabs still don't show up.22:16:45-646722 INFO Python 3.10.11 on Windows
22:16:45-689265 INFO Version: d45e6a04 Wed Aug 30 08:49:27 2023 -0400
22:16:45-936031 INFO Latest published version: df65df3f367862117dd0e0fc1dc76dd54707276d
These show up when I open Krita. The first one I pasted its entirety, the other two is just screenshot with the end of its log.