adieyal / sd-dynamic-prompts

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation
MIT License
1.96k stars 253 forks source link

Double wildcard manager tab bug when installed with replacer extension #765

Open rltgjqmcpgjadyd opened 2 months ago

rltgjqmcpgjadyd commented 2 months ago

스크린샷 2024-04-18 114407

webui 1.9.0

Enable only two extensions sd-dynamic-prompts & sd-webui-replacer

I've confirmed this doesn't happen with other extensions

I don't know which extension is the problem

See also https://github.com/adieyal/sd-dynamic-prompts/pull/481

light-and-ray commented 2 months ago

I can't see why my extension can affects on other extension's on tab callback. Also I don't see it among your tabs in the screenshot

rltgjqmcpgjadyd commented 2 months ago

I can't see why my extension can affects on other extension's on tab callback. Also I don't see it among your tabs in the screenshot

you don't see the replacer tab because I don't have enabled segment-anything

스크린샷 2024-04-18 140129

Enable segment-anything like this and you'll see the tab

light-and-ray commented 2 months ago

I add my second tab here https://github.com/light-and-ray/sd-webui-replacer/blob/375e20260e2b9fbdba21a816679f65af07e3f0ec/scripts/replacer_main_ui.py#L37 but it's on dedicated page. Maybe this extension has a kind of onAfterComponent callbacks, which listens all new tabs. I can reproduce this error, but I don't have any other ideas

Tillerz commented 2 months ago

I can confirm this bug for https://github.com/vladmandic/automatic - shows the tab twice.

image

Tillerz commented 2 months ago

See a fix suggestion by vladmantic here: https://discord.com/channels/1101998836328697867/1199450263556198492/1202268975288045578

sd_dynmic_prompts/dynamic_prompting.py

        global loaded_count
        loaded_count += 1
        if loaded_count % 2 == 0:
            return

this code needs to be removed and do things right also, we have THREE tabs, txt2img/img2img/control, so this will ALWAYS load two copies as only one is skipped. at the very least, do this:

        if loaded_count > 0:
            return
        loaded_count += 1

it still uses silly hack, but at least math is not wrong

light-and-ray commented 2 months ago

if loaded_count % 2 == 0:

Nice vladmandic style 👍 What happens if the bug happens 3 or more times...

The idea is okay. But better to make global bool variable, set it on initialization, and reset it on unload callback

Tillerz commented 1 month ago

Whatever, someone just fix it. :P