ModelSurge / sd-webui-comfyui

An extension to integrate ComfyUI workflows into the Webui's pipeline
MIT License
504 stars 31 forks source link

Each interface has a comfy option. #176

Closed zhulinyv closed 9 months ago

zhulinyv commented 10 months ago

After updating this extension, the error occurred.

image

Then I found each interface has a comfy option, like this:

image

I am not sure whether it is a bug, but this version does not have this problem.

PladsElsker commented 10 months ago

Wow, this is quite surprising to me. I think this is caused by conflicts between one or multiple extensions.

Does it work if you launch the Webui with sd-webui-comfyui as the only extension enabled? If so, can you tell us which extension is conflicting?

zhulinyv commented 10 months ago

It works fine if I only use sd-webui-comfyui, after trying several times, I think it may be caused by sd-webui-mov2mov.

zcyc commented 9 months ago

@zhulinyv I get the same bug. @John-WL Can you fix it, what can i help you.

PladsElsker commented 9 months ago

@zhulinyv I get the same bug. @John-WL Can you fix it, what can i help you.

I've been super busy lately, I haven't looked much into it. If you think you know how to troubleshoot this and want to make a PR, I will happily review it. Otherwise, we'll look into it eventually.

zcyc commented 9 months ago

@ljleb John is busy, can you look into it, i use latest commit version, it is broken yet.

ljleb commented 9 months ago

If something needs to be done, it may have to be on the mov2mov extension mentioned above by @zhulinyv. I can help find what causes the incompatibility but I presume we can't do anything here. It could be better to open an issue on the other repo, but let's first see what the cause of the incompatibility is before making assumptions.

zhulinyv commented 9 months ago

If something needs to be done, it may have to be on the mov2mov extension mentioned above by @zhulinyv. I can help find what causes the incompatibility but I presume we can't do anything here. It could be better to open an issue on the other repo, but let's first see what the cause of the incompatibility is before making assumptions.

I think I have known why this error occurred, look:

https://github.com/Scholar01/sd-webui-mov2mov/commit/3e7ff26055c6d6dd748df1a0633cbed14178a21d

In this commit, the tab of mov2mov was be moved after the img2img, and I found similar code in this file:

https://github.com/ModelSurge/sd-webui-comfyui/blob/main/scripts/comfyui.py

Maybe it lead to the blocks have the same ID.

ljleb commented 9 months ago

I linked the existing issue in sd-webui-mov2mov. It appears to be a problem unrelated to sd-webui-comfyui. mov2mov might be running into a situation where it duplicates gradio components in a non-stable way.

zhulinyv commented 9 months ago

It is a problem unrelated to sd-webui-comfyui, I modified the code I mentioned above,

https://github.com/Scholar01/sd-webui-mov2mov/commit/3e7ff26055c6d6dd748df1a0633cbed14178a21d

...
def on_ui_tabs():
    scripts_mov2mov.initialize_scripts(is_img2img=True)

    with gr.Blocks(analytics_enabled=False) as mov2mov_interface:
    # with gr.TabItem(
    #     "mov2mov", id=f"tab_{id_part}", elem_id=f"tab_{id_part}"
    # ) as mov2mov_interface:
        toprow = Toprow(is_img2img=False, id_part=id_part)
...
...
# img2img_toprow: gr.Row = None

# def block_context_init(self, *args, **kwargs):
#     origin_block_context_init(self, *args, **kwargs)
# 
#     if self.elem_id == "tab_img2img":
#         self.parent.__enter__()
#         on_ui_tabs()
#         self.parent.__exit__()

# def on_app_reload():
#     global origin_block_context_init
#     if origin_block_context_init:
#         patches.undo(__name__, obj=gr.blocks.BlockContext, field="__init__")
#         origin_block_context_init = None

# origin_block_context_init = patches.patch(
#     __name__,
#     obj=gr.blocks.BlockContext,
#     field="__init__",
#     replacement=block_context_init,
# )
# script_callbacks.on_before_reload(on_app_reload)
script_callbacks.on_ui_settings(on_ui_settings)
script_callbacks.on_ui_tabs(on_ui_tabs)

Then sd-webui-comfyui and sd-webui-mov2mov all work fine.

But the tab of mov2mov will not be added behind img2img, if you really need you can change it in UI setting.

There may be a better solution, so I tried to contact the author from Tencent QQ, no result, I think he ran away. :(

image

image

ljleb commented 9 months ago

I appreciate your thorough research on this. I'd love to help here... Unfortunately, there's nothing we can do in sd-webui-comfyui to fix this. I will then close this as not planned.

If the original developer does not want to maintain the mov2mov extension, you can always fork it or use another fork by someone willing to maintain it. I personally don't have the resources to take care of it at the moment.