sddebz / stable-diffusion-krita-plugin

GNU Affero General Public License v3.0
425 stars 35 forks source link

KeyError: 'upscalers' #26

Open petekay opened 1 year ago

petekay commented 1 year ago

Hi, I am getting this error, if i try to execute txt2img.

I have already the web-ui running without problems (using it already), but my web-ui is without upscalers. do I need to install upscalers, or does it also work with the base size?

KeyError
Python 3.8.1: C:\Program Files\Krita (x64)\bin\krita.exe
Sat Sep 10 16:09:55 2022

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Users\myusername\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py in <lambda>()
  229         )
  230         self.txt2img_start_button.released.connect(
  231             lambda: script.action_txt2img()
  232         )
  233 
global script = <krita_diff.krita_diff.Script object>
script.action_txt2img = <bound method Script.action_txt2img of <krita_diff.krita_diff.Script object>>

 C:\Users\myusername\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in action_txt2img(self=<krita_diff.krita_diff.Script object>)
  327         if self.working:
  328             pass
  329         self.update_config()
  330         self.try_fix_aspect_ratio()
  331         self.apply_txt2img()
self = <krita_diff.krita_diff.Script object>
self.update_config = <bound method Script.update_config of <krita_diff.krita_diff.Script object>>

 ...

Traceback (most recent call last):
  File "C:\Users\myusername\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py", line 231, in <lambda>
    lambda: script.action_txt2img()
  File "C:\Users\myusername\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 329, in action_txt2img
    self.update_config()
  File "C:\Users\myusername\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 75, in update_config
    for upscaler in self.opt['upscalers']:
KeyError: 'upscalers'
C21Silarion commented 1 year ago

HI, I have the same error fresh install of the Krita plugin and WebUi works fine also.

KeyError
Python 3.8.1: C:\Program Files\Krita (x64)\bin\krita.exe
Sat Sep 10 16:56:10 2022

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Users\yvang\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py in <lambda>()
  229         )
  230         self.txt2img_start_button.released.connect(
  231             lambda: script.action_txt2img()
  232         )
  233 
global script = <krita_diff.krita_diff.Script object>
script.action_txt2img = <bound method Script.action_txt2img of <krita_diff.krita_diff.Script object>>

 C:\Users\yvang\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in action_txt2img(self=<krita_diff.krita_diff.Script object>)
  327         if self.working:
  328             pass
  329         self.update_config()
  330         self.try_fix_aspect_ratio()
  331         self.apply_txt2img()
self = <krita_diff.krita_diff.Script object>
self.update_config = <bound method Script.update_config of <krita_diff.krita_diff.Script object>>

 C:\Users\yvang\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in update_config(self=<krita_diff.krita_diff.Script object>)
   73             self.opt = json.loads(res)
   74 
   75         for upscaler in self.opt['upscalers']:
   76             if upscaler not in upscalers:
   77                 upscalers.append(upscaler)
upscaler undefined
self = <krita_diff.krita_diff.Script object>
self.opt = {'components': [{'id': 249, 'props': {'style': {}, 'visible': True}, 'type': 'tabs'}, {'id': 250, 'props': {'id': 'txt2img', 'label': 'txt2img', 'style': {}, 'visible': True}, 'type': 'tabitem'}, {'id': 1, 'props': {'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 2, 'props': {'elem_id': 'txt2img_prompt', 'label': 'Prompt', 'lines': 1, 'max_lines': 20, 'name': 'textbox', 'placeholder': 'Prompt', 'show_label': False, 'style': {}, 'value': '', 'visible': True}, 'type': 'textbox'}, {'id': 3, 'props': {'elem_id': 'txt2img_negative_prompt', 'label': 'Negative prompt', 'lines': 1, 'max_lines': 20, 'name': 'textbox', 'placeholder': 'Negative prompt', 'show_label': False, 'style': {}, 'value': '', 'visible': False}, 'type': 'textbox'}, {'id': 4, 'props': {'choices': ['None'], 'elem_id': 'style_index', 'label': 'Style', 'name': 'dropdown', 'show_label': False, 'style': {}, 'value': 'None', 'visible': False}, 'type': 'dropdown'}, {'id': 5, 'props': {'elem_id': 'txt2img_roll', 'name': 'button', 'style': {}, 'value': 'Roll', 'variant': 'secondary', 'visible': True}, 'type': 'button'}, {'id': 6, 'props': {'elem_id': 'txt2img_generate', 'name': 'button', 'style': {}, 'value': 'Generate', 'variant': 'primary', 'visible': True}, 'type': 'button'}, {'id': 7, 'props': {'elem_id': 'check_progress', 'name': 'button', 'style': {}, 'value': 'Check progress', 'variant': 'secondary', 'visible': False}, 'type': 'button'}, {'id': 8, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 9, 'props': {'style': {'equal_height': False}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 10, 'props': {'min_width': 320, 'scale': 1, 'style': {}, 'type': 'column', 'variant': 'panel', 'visible': True}, 'type': 'column'}, {'id': 11, 'props': {'label': 'Sampling Steps', 'maximum': 150, 'minimum': 1, 'name': 'slider', 'show_label': True, 'step': 1, 'style': {}, 'value': 20, 'visible': True}, 'type': 'slider'}, {'id': 12, 'props': {'choices': ['Euler a', 'Euler', 'LMS', 'Heun', 'DPM2', 'DPM2 a', 'DDIM', 'PLMS'], 'elem_id': 'txt2img_sampling', 'label': 'Sampling method', 'name': 'radio', 'show_label': True, 'style': {}, 'value': 'Euler a', 'visible': True}, 'type': 'radio'}, {'id': 13, 'props': {'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 14, 'props': {'label': 'Restore faces', 'name': 'checkbox', 'show_label': True, 'style': {}, 'value': False, 'visible': True}, 'type': 'checkbox'}, {'id': 15, 'props': {'label': 'Tiling', 'name': 'checkbox', 'show_label': True, 'style': {}, 'value': False, 'visible': True}, 'type': 'checkbox'}, {'id': 16, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 17, 'props': {'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 18, 'props': {'label': 'Batch count', 'maximum': 16, 'minimum': 1, 'name': 'slider', 'show_label': True, 'step': 1, 'style': {}, 'value': 1, 'visible': True}, 'type': 'slider'}, ...], 'css': '.output-html p {margin: 0 0.5em;}\n.performance {...ortant; }\n.meta-text { display:none!important; }\n', 'dependencies': [{'api_name': None, 'backend_fn': True, 'inputs': [29], 'js': None, 'outputs': [28, 32, 33, 34], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [29], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [37], 'js': None, 'outputs': [37, 38, 40, 41, 44, 45], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [37], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [2, 3, 4, 11, 12, 14, 15, 18, 19, 21, 27, 28, 32, 33, 34, 23, 24, 37, 38, 40, ...], 'js': 'submit', 'outputs': [53, 65, 64], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [2], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [2, 3, 4, 11, 12, 14, 15, 18, 19, 21, 27, 28, 32, 33, 34, 23, 24, 37, 38, 40, ...], 'js': 'submit', 'outputs': [53, 65, 64], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [6], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [62, 52, 52], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [7], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [60], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [65, 53], 'js': None, 'outputs': [64, 64, 64], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [56], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [2], 'js': None, 'outputs': [2], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [5], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [120], 'js': None, 'outputs': [119, 123, 124, 125], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [120], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [128], 'js': None, 'outputs': [128, 129, 130, 131, 132, 133, 134, 135, 137, 138, 141, 142], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [128], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [78, 85], 'js': None, 'outputs': [79, 80, 81, 82, 85, 90, 91, 105, 106, 102, 99, 93, 94, 111], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [78], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [85], 'js': None, 'outputs': [79, 80, 82], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [85], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [69, 70, 71, 79, 80, 82, 85, 88, 89, 90, 91, 97, 98, 78, 105, 106, 109, 110, 111, 118, ...], 'js': 'submit', 'outputs': [149, 162, 161], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [69], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [69, 70, 71, 79, 80, 82, 85, 88, 89, 90, 91, 97, 98, 78, 105, 106, 109, 110, 111, 118, ...], 'js': 'submit', 'outputs': [149, 162, 161], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [72], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [158, 148, 148], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [73], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [156], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [162, 149], 'js': None, 'outputs': [161, 161, 161], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [152], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [159, 2], 'js': 'ask_for_style_name', 'outputs': [4, 71], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [61], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [159, 69], 'js': 'ask_for_style_name', 'outputs': [4, 71], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [157], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [169, 179, 182, 183, 170, 172, 175, 176], 'js': None, 'outputs': [188, 189, 190], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [185], ...}, ...], 'dev_mode': False, 'enable_queue': False, 'is_space': False, 'layout': {'children': [{'children': [{'children': [...], 'id': 250}, {'children': [...], 'id': 251}, {'children': [...], 'id': 252}, {'children': [...], 'id': 253}, {'children': [...], 'id': 254}], 'id': 249}], 'id': 248}, 'mode': 'blocks', 'show_error': False, 'theme': 'default', ...}
KeyError: 'upscalers'
    __cause__ = None
    __class__ = <class 'KeyError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of KeyError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of KeyError object>
    __doc__ = 'Mapping key not found.'
    __eq__ = <method-wrapper '__eq__' of KeyError object>
    __format__ = <built-in method __format__ of KeyError object>
    __ge__ = <method-wrapper '__ge__' of KeyError object>
    __getattribute__ = <method-wrapper '__getattribute__' of KeyError object>
    __gt__ = <method-wrapper '__gt__' of KeyError object>
    __hash__ = <method-wrapper '__hash__' of KeyError object>
    __init__ = <method-wrapper '__init__' of KeyError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of KeyError object>
    __lt__ = <method-wrapper '__lt__' of KeyError object>
    __ne__ = <method-wrapper '__ne__' of KeyError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of KeyError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of KeyError object>
    __repr__ = <method-wrapper '__repr__' of KeyError object>
    __setattr__ = <method-wrapper '__setattr__' of KeyError object>
    __setstate__ = <built-in method __setstate__ of KeyError object>
    __sizeof__ = <built-in method __sizeof__ of KeyError object>
    __str__ = <method-wrapper '__str__' of KeyError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('upscalers',)
    with_traceback = <built-in method with_traceback of KeyError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "C:\Users\yvang\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py", line 231, in <lambda>
    lambda: script.action_txt2img()
  File "C:\Users\yvang\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 329, in action_txt2img
    self.update_config()
  File "C:\Users\yvang\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 75, in update_config
    for upscaler in self.opt['upscalers']:
KeyError: 'upscalers'

`

petekay commented 1 year ago

I understand now the error, my assumptions was, that we can communicate with another running project like (https://github.com/AUTOMATIC1111/stable-diffusion-webui) but this is not possible. so this project, contains also a webserver, and if you put your model.cpkt etc. into it, and install the kitra.bat file, you can run the server (it starts on port 8000).

i would be better, if the sd-forks, would work together, otherwise, we have to copy many big files in rather similar projects. in this case we would have a main sd-project (the orignal one), and then sub-repos with extensions (Fast-API like this) or web-ui like from automatic1111.

C21Silarion commented 1 year ago

Ohh.. Thank you for your answer ! I did not understand the setup of this one. I was also thinking that the plugin used the Automatic1111 server. I used the krita.bat of this repo and now the plugin works correctly.

sddebz commented 1 year ago

The problem with using automatic1111's version is that they change internal api often. I mean like img2img() function gets new arguments regularly and you just can't pass named arguments there. That's why I'm not sure how I can make plugin work with the most recent version from automatic1111's repository without manually changing bindings every time.

So currently you need to run webui's code from this repository, otherwise it won't work. If anyone has ideas how to make it work with latest automatic1111's version, I will consider implementing it.

Expar commented 1 year ago

Hello! I have the same error but I am using this Stable Diffusion Server

Python 3.8.1: E:\gamedev\Krita (x64)\bin\krita.exe
Tue Sep 20 11:01:14 2022

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Users\Roman\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py in <lambda>()
  240         )
  241         self.txt2img_start_button.released.connect(
  242             lambda: script.action_txt2img()
  243         )
  244 
global script = <krita_diff.krita_diff.Script object>
script.action_txt2img = <bound method Script.action_txt2img of <krita_diff.krita_diff.Script object>>

 C:\Users\Roman\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in action_txt2img(self=<krita_diff.krita_diff.Script object>)
  336         if self.working:
  337             pass
  338         self.update_config()
  339         self.try_fix_aspect_ratio()
  340         self.apply_txt2img()
self = <krita_diff.krita_diff.Script object>
self.update_config = <bound method Script.update_config of <krita_diff.krita_diff.Script object>>

 C:\Users\Roman\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in update_config(self=<krita_diff.krita_diff.Script object>)
   76             self.opt = json.loads(res)
   77 
   78         for upscaler in self.opt['upscalers']:
   79             if upscaler not in upscalers:
   80                 upscalers.append(upscaler)
upscaler undefined
self = <krita_diff.krita_diff.Script object>
self.opt = {'components': [{'id': 365, 'props': {'style': {}, 'visible': True}, 'type': 'tabs'}, {'id': 366, 'props': {'id': 'txt2img', 'label': 'txt2img', 'style': {}, 'visible': True}, 'type': 'tabitem'}, {'id': 1, 'props': {'elem_id': 'toprow', 'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 2, 'props': {'min_width': 320, 'scale': 4, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 3, 'props': {'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 4, 'props': {'min_width': 320, 'scale': 8, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 5, 'props': {'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 6, 'props': {'elem_id': 'prompt', 'label': 'Prompt', 'lines': 2, 'max_lines': 20, 'name': 'textbox', 'placeholder': 'Prompt', 'show_label': False, 'style': {}, 'value': '', 'visible': True}, 'type': 'textbox'}, {'id': 7, 'props': {'elem_id': 'roll', 'name': 'button', 'style': {}, 'value': 'Roll', 'variant': 'secondary', 'visible': True}, 'type': 'button'}, {'id': 8, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 9, 'props': {'elem_id': 'style_pos_col', 'min_width': 320, 'scale': 1, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 10, 'props': {'choices': ['None'], 'elem_id': 'style_index', 'label': 'Style 1', 'name': 'dropdown', 'show_label': True, 'style': {}, 'value': 'None', 'visible': False}, 'type': 'dropdown'}, {'id': 11, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 12, 'props': {'style': {}, 'type': 'row', 'visible': True}, 'type': 'row'}, {'id': 13, 'props': {'min_width': 320, 'scale': 8, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 14, 'props': {'elem_id': 'negative_prompt', 'label': 'Negative prompt', 'lines': 2, 'max_lines': 20, 'name': 'textbox', 'placeholder': 'Negative prompt', 'show_label': False, 'style': {}, 'value': '', 'visible': True}, 'type': 'textbox'}, {'id': 15, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 16, 'props': {'elem_id': 'style_neg_col', 'min_width': 320, 'scale': 1, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 17, 'props': {'choices': ['None'], 'elem_id': 'style2_index', 'label': 'Style 2', 'name': 'dropdown', 'show_label': True, 'style': {}, 'value': 'None', 'visible': False}, 'type': 'dropdown'}, {'id': 18, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, ...], 'css': '.output-html p {margin: 0 0.5em;}\n\n.performance ...ortant; }\n.meta-text { display:none!important; }\n', 'dependencies': [{'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [51], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [52], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [61], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [62], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [56], 'js': None, 'outputs': [58, 67], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [56], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [73], 'js': None, 'outputs': [74, 75], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [73], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [72], 'js': None, 'outputs': [72, 73, 74, 75, 76, 78, 79, 82, 83, 85], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [72], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [92, 94, 94], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [96], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [92, 94, 94], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [97], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [107, 25], 'js': '(x, y) => [x, selected_gallery_index()]', 'outputs': [51, 25], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [53], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [107, 25], 'js': '(x, y) => [x, selected_gallery_index()]', 'outputs': [61, 25], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [63], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [6, 14, 10, 17, 28, 29, 31, 32, 40, 41, 43, 51, 61, 65, 69, 68, 46, 45, 33, 36, ...], 'js': 'submit', 'outputs': [95, 107, 106], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [6], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [6, 14, 10, 17, 28, 29, 31, 32, 40, 41, 43, 51, 61, 65, 69, 68, 46, 45, 33, 36, ...], 'js': 'submit', 'outputs': [95, 107, 106], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [21], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [33], 'js': None, 'outputs': [35], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [33], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [104], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [107, 95, 106], 'js': '(x, y, z) => [x, y, selected_gallery_index()]', 'outputs': [106, 106, 106], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [100], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [6], 'js': None, 'outputs': [6], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [7], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [179], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [180], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [189], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [190], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [184], 'js': None, 'outputs': [186, 195], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'status_tracker': None, 'targets': [184], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [220], 'js': None, 'outputs': [221, 222], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [220], ...}, {'api_name': None, 'backend_fn': True, 'inputs': [200], 'js': None, 'outputs': [200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, ...], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'status_tracker': None, 'targets': [200], ...}, ...], 'dev_mode': False, 'enable_queue': False, 'is_space': False, 'layout': {'children': [{'children': [{'children': [...], 'id': 366}, {'children': [...], 'id': 367}, {'children': [...], 'id': 368}, {'children': [...], 'id': 369}, {'children': [...], 'id': 370}], 'id': 365}, {'children': [{'id': 371}], 'id': 372}], 'id': 364}, 'mode': 'blocks', 'show_api': True, 'show_error': False, ...}
KeyError: 'upscalers'
    __cause__ = None
    __class__ = <class 'KeyError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of KeyError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of KeyError object>
    __doc__ = 'Mapping key not found.'
    __eq__ = <method-wrapper '__eq__' of KeyError object>
    __format__ = <built-in method __format__ of KeyError object>
    __ge__ = <method-wrapper '__ge__' of KeyError object>
    __getattribute__ = <method-wrapper '__getattribute__' of KeyError object>
    __gt__ = <method-wrapper '__gt__' of KeyError object>
    __hash__ = <method-wrapper '__hash__' of KeyError object>
    __init__ = <method-wrapper '__init__' of KeyError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of KeyError object>
    __lt__ = <method-wrapper '__lt__' of KeyError object>
    __ne__ = <method-wrapper '__ne__' of KeyError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of KeyError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of KeyError object>
    __repr__ = <method-wrapper '__repr__' of KeyError object>
    __setattr__ = <method-wrapper '__setattr__' of KeyError object>
    __setstate__ = <built-in method __setstate__ of KeyError object>
    __sizeof__ = <built-in method __sizeof__ of KeyError object>
    __str__ = <method-wrapper '__str__' of KeyError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('upscalers',)
    with_traceback = <built-in method with_traceback of KeyError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "C:\Users\Roman\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py", line 242, in <lambda>
    lambda: script.action_txt2img()
  File "C:\Users\Roman\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 338, in action_txt2img
    self.update_config()
  File "C:\Users\Roman\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 78, in update_config
    for upscaler in self.opt['upscalers']:
KeyError: 'upscalers'
sddebz commented 1 year ago

Hello. I think you used the wrong backend url in the config tab. You should probably use http://127.0.0.1:8000 instead of http://127.0.0.1:7860. The latter url is for webui. It runs on separate port because I'm too lazy to make full webui integration.

After you start server you should see something like this in the log:

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Running on local URL:  http://127.0.0.1:7860

Please use uvicorn url in krita plugin config tab.

Expar commented 1 year ago

Oh thanks you!

mapleroyal commented 1 year ago

@sddebz I'm also getting this error. Can we get some clarification on the linux process?

For example, what does this mean? "Linux installation Please look at parent repo, try to run webui.sh following instructions. You should run webui.sh from this repository, not from others."

The parent repo is automatic1111.

I made a fresh automatic1111 install, made sure everything works in it, then I pasted your webui.sh in automatic1111's base directory and ran it. It seems to just start a normal webui server, directing the krita plugin to that returns OP's error.

What is the actual correct process (on linux)? Thanks!

sddebz commented 1 year ago

Ok, my documentation is not in a very good shape right now.

You should do the following:

git clone https://github.com/sddebz/stable-diffusion-krita-plugin.git
cd stable-diffusion-krita-plugin
./webui.sh

This should work. Not sure how to write it down in English properly though.

mapleroyal commented 1 year ago

Thanks for the clarification! I haven't tried it yet because I ended up getting it working a different way, but hopefully that clears things up.

For anyone else coming here, here's what worked for me:

> install automatic1111 until everything is working > copy everything but the folder's from this git into the directory automatic1111 creates, merging/replacing with the files from here as needed > run the webui.sh from here, inside of that directory

If you get an error about C++, run the following to sync up torch and torchvision with versions that are compatible (I don't know the logic behind what this fixes or why it works, but I've seen it around and it worked for me on multiple installs, and it has to do with some table of which versions are compatible and the automatic installer not grabbing the appropriate versions):

pip uninstall torch torchvision
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
galexa commented 1 year ago

In case it helps anyone else, I put a symlink to the model ckpt of the automatic1111 installation and the plugin accepted that. Running command prompt as administrator: mklink <path-to-plugin-models-folder\filename.ckpt> <path-to-target-model\filename.ckpt>

Mignolyx commented 1 year ago

Please, just help me. I got installed the stable diffusion on mi C drive C:\stable-diffusion-webui and it works perfectly with Blender. http://127.0.0.1:7860/

but if i try to let it work with Krita, i got always this error.

KeyError Python 3.8.1: C:\Program Files\Krita (x64)\bin\krita.exe Sun Nov 20 18:26:20 2022

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

C:\Users\Aurex\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py in () 240 ) 241 self.txt2img_start_button.released.connect( 242 lambda: script.action_txt2img() 243 ) 244 global script = script.action_txt2img = <bound method Script.action_txt2img of >

C:\Users\Aurex\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in action_txt2img(self=) 336 if self.working: 337 pass 338 self.update_config() 339 self.try_fix_aspect_ratio() 340 self.apply_txt2img() self = self.update_config = <bound method Script.update_config of >

C:\Users\Aurex\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py in update_config(self=) 76 self.opt = json.loads(res) 77 78 for upscaler in self.opt['upscalers']: 79 if upscaler not in upscalers: 80 upscalers.append(upscaler) upscaler undefined self = self.opt = {'components': [{'id': 620, 'props': {'elem_id': 'quicksettings', 'style': {}, 'type': 'row', 'variant': 'default', 'visible': True}, 'type': 'row'}, {'id': 621, 'props': {'choices': ['model.ckpt [7460a6fa]'], 'elem_id': 'setting_sd_model_checkpoint', 'label': 'Stable Diffusion checkpoint', 'name': 'dropdown', 'show_label': True, 'style': {}, 'value': 'model.ckpt [7460a6fa]', 'visible': True}, 'type': 'dropdown'}, {'id': 622, 'props': {'elem_id': 'refresh_sd_model_checkpoint', 'name': 'button', 'style': {}, 'value': '🔄', 'variant': 'secondary', 'visible': True}, 'type': 'button'}, {'id': 623, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 624, 'props': {'elem_id': 'tabs', 'style': {}, 'visible': True}, 'type': 'tabs'}, {'id': 625, 'props': {'elem_id': 'tab_txt2img', 'id': 'txt2img', 'label': 'txt2img', 'style': {}, 'visible': True}, 'type': 'tabitem'}, {'id': 1, 'props': {'elem_id': 'toprow', 'style': {}, 'type': 'row', 'variant': 'default', 'visible': True}, 'type': 'row'}, {'id': 2, 'props': {'min_width': 320, 'scale': 6, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 3, 'props': {'style': {}, 'type': 'row', 'variant': 'default', 'visible': True}, 'type': 'row'}, {'id': 4, 'props': {'min_width': 320, 'scale': 80, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 5, 'props': {'style': {}, 'type': 'row', 'variant': 'default', 'visible': True}, 'type': 'row'}, {'id': 6, 'props': {'elem_id': 'txt2img_prompt', 'label': 'Prompt', 'lines': 2, 'max_lines': 20, 'name': 'textbox', 'placeholder': 'Prompt (press Ctrl+Enter or Alt+Enter to generate)', 'show_label': False, 'style': {}, 'value': '', 'visible': True}, 'type': 'textbox'}, {'id': 7, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 8, 'props': {'style': {}, 'type': 'row', 'variant': 'default', 'visible': True}, 'type': 'row'}, {'id': 9, 'props': {'min_width': 320, 'scale': 80, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 10, 'props': {'style': {}, 'type': 'row', 'variant': 'default', 'visible': True}, 'type': 'row'}, {'id': 11, 'props': {'elem_id': 'txt2img_neg_prompt', 'label': 'Negative prompt', 'lines': 2, 'max_lines': 20, 'name': 'textbox', 'placeholder': 'Negative prompt (press Ctrl+Enter or Alt+Enter to generate)', 'show_label': False, 'style': {}, 'value': '', 'visible': True}, 'type': 'textbox'}, {'id': 12, 'props': {'style': {}, 'type': 'form', 'visible': True}, 'type': 'form'}, {'id': 13, 'props': {'elem_id': 'roll_col', 'min_width': 320, 'scale': 1, 'style': {}, 'type': 'column', 'variant': 'default', 'visible': True}, 'type': 'column'}, {'id': 14, 'props': {'elem_id': 'roll', 'name': 'button', 'style': {}, 'value': '🎨', 'variant': 'secondary', 'visible': True}, 'type': 'button'}, ...], 'css': '.container {\n max-width: 100%;\n}\n\n#txt2img_to...ortant; }\n.meta-text { display:none!important; }\n', 'dependencies': [{'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [621], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [622], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [22], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [23], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [37, 38, 38, 39], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [40], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [37, 38, 38, 39], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [41], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [68], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [69], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [78], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [79], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [73], 'js': None, 'outputs': [75, 84], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [73], 'trigger': 'change'}, {'api_name': None, 'backend_fn': True, 'inputs': [91], 'js': None, 'outputs': [92, 93], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [91], 'trigger': 'change'}, {'api_name': None, 'backend_fn': True, 'inputs': [89], 'js': None, 'outputs': [89, 90, 91, 92, 93, 95, 96, 99, 100, 102, 103, 104], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [89], 'trigger': 'change'}, {'api_name': None, 'backend_fn': True, 'inputs': [128, 32], 'js': '(x, y) => [x, selected_gallery_index()]', 'outputs': [68, 32], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [70], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [128, 32], 'js': '(x, y) => [x, selected_gallery_index()]', 'outputs': [78, 32], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [80], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [6, 11, 27, 30, 44, 45, 51, 52, 61, 62, 64, 68, 78, 82, 86, 85, 73, 48, 47, 53, ...], 'js': 'submit', 'outputs': [113, 128, 127], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [6], 'trigger': 'submit'}, {'api_name': None, 'backend_fn': True, 'inputs': [6, 11, 27, 30, 44, 45, 51, 52, 61, 62, 64, 68, 78, 82, 86, 85, 73, 48, 47, 53, ...], 'js': 'submit', 'outputs': [113, 128, 127], 'queue': None, 'scroll_to_output': False, 'show_progress': False, 'targets': [24], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [33], 'js': None, 'outputs': [6, 33], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [33], 'trigger': 'change'}, {'api_name': None, 'backend_fn': True, 'inputs': [53], 'js': None, 'outputs': [55], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [53], 'trigger': 'change'}, {'api_name': None, 'backend_fn': True, 'inputs': [128, 113, 122, 127], 'js': '(x, y, z, w) => [x, y, z, selected_gallery_index()]', 'outputs': [125, 127, 127, 127], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [116], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [6], 'js': 'update_txt2img_tokens', 'outputs': [6], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [14], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [6, 44], 'js': None, 'outputs': [18], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [19], 'trigger': 'click'}, {'api_name': None, 'backend_fn': True, 'inputs': [], 'js': None, 'outputs': [], 'queue': None, 'scroll_to_output': False, 'show_progress': True, 'targets': [154], 'trigger': 'click'}, ...], 'dev_mode': False, 'enable_queue': False, 'is_space': False, 'layout': {'children': [{'children': [{'children': [...], 'id': 623}, {'id': 622}], 'id': 620}, {'children': [{'children': [...], 'id': 625}, {'children': [...], 'id': 626}, {'children': [...], 'id': 627}, {'children': [...], 'id': 628}, {'children': [...], 'id': 629}, {'children': [...], 'id': 630}, {'children': [...], 'id': 631}], 'id': 624}, {'children': [{'id': 632}], 'id': 633}], 'id': 619}, 'mode': 'blocks', 'show_api': True, 'show_error': False, ...} KeyError: 'upscalers' cause = None class = <class 'KeyError'> context = None delattr = <method-wrapper 'delattr' of KeyError object> dict = {} dir = doc = 'Mapping key not found.' eq = <method-wrapper 'eq' of KeyError object> format = ge = <method-wrapper 'ge' of KeyError object> getattribute = <method-wrapper 'getattribute' of KeyError object> gt = <method-wrapper 'gt' of KeyError object> hash = <method-wrapper 'hash' of KeyError object> init = <method-wrapper 'init' of KeyError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of KeyError object> lt = <method-wrapper 'lt' of KeyError object> ne = <method-wrapper 'ne' of KeyError object> new = reduce = reduce_ex = <built-in method reduce_ex of KeyError object> repr = <method-wrapper 'repr' of KeyError object> setattr = <method-wrapper 'setattr' of KeyError object> setstate = sizeof = str = <method-wrapper 'str' of KeyError object> subclasshook = __suppress_context = False traceback__ = args = ('upscalers',) with_traceback =

The above is a description of an error in a Python program. Here is the original traceback:

Traceback (most recent call last): File "C:\Users\Aurex\AppData\Roaming\krita\pykrita\krita_diff\krita_diff_ui.py", line 242, in lambda: script.action_txt2img() File "C:\Users\Aurex\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 338, in action_txt2img self.update_config() File "C:\Users\Aurex\AppData\Roaming\krita\pykrita\krita_diff\krita_diff.py", line 78, in update_config for upscaler in self.opt['upscalers']: KeyError: 'upscalers'

Can you help me? I changed in Krita plugin preference the port (7860/8000) but it doesn't work

galexa commented 1 year ago

Check the readme - this repo will not be updated, this is suggested as replacement: https://github.com/Interpause/auto-sd-paint-ext

Mignolyx commented 1 year ago

I follow your suggestion but no way to add auto-df-paint-ex Guide Panel on Web Ui of 1111. Please, really, help me to let it work with Krita...

Launching Web UI with arguments: --opt-split-attention --medvram --listen --api Error loading script: main.py Traceback (most recent call last): File "C:\stable-diffusion-webui\modules\scripts.py", line 159, in load_scripts exec(compiled, module.dict) File "C:\stable-diffusion-webui\extensions\auto-sd-paint-ext-main\scripts\main.py", line 132, in script_callbacks.on_app_started(on_app_started) AttributeError: module 'modules.script_callbacks' has no attribute 'on_app_started'

LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Loading weights [7460a6fa] from C:\stable-diffusion-webui\models\Stable-diffusion\model.ckpt Global Step: 470000 Applying cross attention optimization (Doggettx). Model loaded. Loaded a total of 0 textual inversion embeddings. Embeddings: Running on local URL: http://0.0.0.0:7860

galexa commented 1 year ago

I haven't tried the other extension so can't help. Probably best to post your issue over there.