ljleb / prompt-fusion-extension

auto1111 webui extension for all sorts of prompt interpolations!
MIT License
268 stars 16 forks source link

Hijack needs disable when model is SDXL #56

Closed Kadah closed 1 year ago

Kadah commented 1 year ago

A1111 added SDXL support. Many extensions that hook or hijack part of the gen cycle are breaking things if the model is SDXL.

Seems the fix/workaround is have the extension disable itself when the loaded model is SDXL. Would be cool to get SDXL support at some point.

Related: https://github.com/Mikubill/sd-webui-controlnet/issues/1834

    Traceback (most recent call last):
      File "/ai/stable-diffusion-webui/modules/call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "/ai/stable-diffusion-webui/modules/call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "/ai/stable-diffusion-webui/modules/txt2img.py", line 62, in txt2img
        processed = processing.process_images(p)
      File "/ai/stable-diffusion-webui/modules/processing.py", line 677, in process_images
        res = process_images_inner(p)
      File "/ai/stable-diffusion-webui/modules/processing.py", line 783, in process_images_inner
        p.setup_conds()
      File "/ai/stable-diffusion-webui/modules/processing.py", line 1191, in setup_conds
        super().setup_conds()
      File "/ai/stable-diffusion-webui/modules/processing.py", line 364, in setup_conds
        self.uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, negative_prompts, self.steps * self.step_multiplier, [self.cached_uc], self.extra_network_data)
      File "/ai/stable-diffusion-webui/modules/processing.py", line 353, in get_conds_with_caching
        cache[1] = function(shared.sd_model, required_prompts, steps)
      File "/ai/stable-diffusion-webui/extensions/prompt-fusion-extension/lib_prompt_fusion/hijacker.py", line 15, in wrapper
        return function(*args, **kwargs, original_function=self.__original_functions[attribute])
      File "/ai/stable-diffusion-webui/extensions/prompt-fusion-extension/scripts/promptlang.py", line 34, in _hijacked_get_learned_conditioning
        empty_cond.init(model)
      File "/ai/stable-diffusion-webui/extensions/prompt-fusion-extension/lib_prompt_fusion/empty_cond.py", line 11, in init
        _empty_cond = model.get_learned_conditioning([''])[0]
    KeyError: 0
ljleb commented 1 year ago

Thank you for spotting it. I am currently afk unfortunately, but I can review a PR if you want this fixed sooner. I'll be able to fix this myself in about a week otherwise.

ljleb commented 1 year ago

Support for SDXL implemented in #61