ahgsql / StyleSelectorXL

This repository contains a Automatic1111 Extension allows users to select and apply different styles to their inputs using SDXL 1.0.
451 stars 45 forks source link

Cannot use Hires. fix #1

Open mwbdcz opened 12 months ago

mwbdcz commented 12 months ago

After enabling the StyleSelectorXL plugin, opening (Hires. fix) will report an error.It seems to be caused by not inputting prompt words.

Error completing request Arguments: ('task(kdl6yijpo2wttb3)', '1girl, ', '', [], 20, 18, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 1024, 1024, True, 0.7, 1.1, 'Latent', 20, 0, 0, 0, '', '', [], <gradio.routes.Request object at 0x000001BD0092BAF0>, 0, True, '3D Model', False,

Change the process (self, p, isenabled, style) in the program to process Batch (self, p, is_enabled, style, kwargs) can solve problems

ahgsql commented 12 months ago

Will check today and fix it soon

ahgsql commented 11 months ago

cant reproduce this issue, its working with Hires.Fix with no errors. Can you direct me to get your erros. In which stage or screen you saw that error

blacklockshoot commented 11 months ago

i got same problem when i use styleselect with Hires. fix,

TypeError: must be real number, not NoneType

dreamshaperXL checkpoint, hires step 0 and Denoising strength 0.45 size is 1024 x 1024

if i disable styleselect, all processing with no problem

Zibbibbo commented 11 months ago

I have the same problem

acezard commented 11 months ago

cant reproduce this issue, its working with Hires.Fix with no errors. Can you direct me to get your erros. In which stage or screen you saw that error

@ahgsql, please try following these steps in order to reproduce the error. On my end it is a 100% reproducible bug

When cycling through enabling and disabling the "hires fix" and "style selector" options, I encounter a TypeError: must be real number, not NoneType.

Steps to Reproduce:

  1. Initial Setup

    • Ensure "hires fix" is enabled.
    • Ensure "style selector" is enabled.
    • Result: Generation works without errors. (✅)
  2. Disabling Hires Fix

    • Disable "hires fix".
    • Ensure "style selector" is still enabled.
    • Result: Generation works without errors. (✅)
  3. Re-enabling Hires Fix

    • Enable "hires fix" again.
    • Result: Error encountered: TypeError: must be real number, not NoneType (❌)
  4. Disabling Either Option

    • Disable either "hires fix" OR "style selector".
    • Result: Generation works without errors. (✅)
  5. Re-enabling Disabled Option from Step 4

    • Enable the option you disabled in Step 4.
    • Result: Error encountered: TypeError: must be real number, not NoneType (❌)
naql commented 11 months ago

I ran into this error when I first downloaded your extension, then it went away by itself. THen I updated, I see you have added a bunch of new styles and the error has come back. Here is the full stack trace:

```Traceback (most recent call last):
  File "D:\stable-diffusion-webui\modules\call_queue.py", line 58, in f
    res = list(func(*args, **kwargs))
  File "D:\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "D:\stable-diffusion-webui\modules\txt2img.py", line 62, in txt2img
    processed = processing.process_images(p)
  File "D:\stable-diffusion-webui\modules\processing.py", line 677, in process_images
    res = process_images_inner(p)
  File "D:\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "D:\stable-diffusion-webui\modules\processing.py", line 783, in process_images_inner
    p.setup_conds()
  File "D:\stable-diffusion-webui\modules\processing.py", line 1204, in setup_conds
    self.calculate_hr_conds()
  File "D:\stable-diffusion-webui\modules\processing.py", line 1187, in calculate_hr_conds
    self.hr_uc = self.get_conds_with_caching(prompt_parser.get_learned_conditioning, self.hr_negative_prompts, self.steps * self.step_multiplier, [self.cached_hr_uc, self.cached_uc], self.hr_extra_network_data)
  File "D:\stable-diffusion-webui\modules\processing.py", line 353, in get_conds_with_caching
    cache[1] = function(shared.sd_model, required_prompts, steps)
  File "D:\stable-diffusion-webui\modules\prompt_parser.py", line 163, in get_learned_conditioning
    conds = model.get_learned_conditioning(texts)
  File "D:\stable-diffusion-webui\modules\sd_models_xl.py", line 24, in get_learned_conditioning
    "original_size_as_tuple": torch.tensor([height, width], **devices_args).repeat(len(batch), 1),
TypeError: must be real number, not NoneType```

For me, I do NOT get this error if it is "Base" selected, but any of the other styles do generate the error. I did not realize that "Hires-fix" was involved in this. I tried unchecking that and, sure enough, it did generate and use your style. As soon as I re-enable Hires-fix, it comes back and cannot generate until your styles are unselected.

wardensc2 commented 11 months ago

Please fix the issue with Hires Fix, I got the same bug as other people. I can only use Base Style without error. I test with SD 1.5, your extension work well but not SD XL not sure what happen.

mwbdcz commented 11 months ago

Roughly analyze process and process Batch is different. Process will only be called once during generation Batch is called before each generation. The reason for the error is not difficult to see from the stack trace that the prompt word after '3D Model' is missing, only this title. Hires.fix will be generated twice, but due to the fact that process is only called on the first generation and not called on the second, the prompt words before and after are inconsistent. So reported an error, I am not a professional. But change process() to process_ Batch() after , the problem was indeed resolved

eniora commented 11 months ago

Same here when using Hires fix with SDXL 1.0 "TypeError: must be real number, not NoneType"

wardensc2 commented 11 months ago

Roughly analyze process and process Batch is different. Process will only be called once during generation Batch is called before each generation. The reason for the error is not difficult to see from the stack trace that the prompt word after '3D Model' is missing, only this title. Hires.fix will be generated twice, but due to the fact that process is only called on the first generation and not called on the second, the prompt words before and after are inconsistent. So reported an error, I am not a professional. But change process() to process_ Batch() after , the problem was indeed resolved

Can you describe how to fix manually by editing some files ??

ahgsql commented 11 months ago

Tried all of steps, but just couldn't reproduce it. not sure why, no matter how many times i enable and disable hires, or change styles.

But it seems really annoying, And changing process to process_batch causing another errors thats needs to be fixed for general usage. Any one can fix, please create pull request. I am kinda busy these weeks

wardensc2 commented 11 months ago

Tried all of steps, but just couldn't reproduce it. not sure why, no matter how many times i enable and disable hires, or change styles.

But it seems really annoying, And changing process to process_batch causing another errors thats needs to be fixed for general usage. Any one can fix, please create pull request. I am kinda busy these weeks

Here is my screenshot when using hires fix

image

naql commented 10 months ago

with the latest, it's no longer blowing up, it's just not doing anything. uninstalling