lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.06k stars 789 forks source link

[Bug]: Error when doing batch size 2 or more with SDXL, Lora and UniPC Sampler #184

Closed slashedstar closed 8 months ago

slashedstar commented 8 months ago

Checklist

What happened?

Title

Steps to reproduce the problem

Open webui, load sdxl, add a lora, set sampler to unipc, batch size to 2 or more

What should have happened?

Two images should've been produced

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

sysinfo-2024-02-11-01-52.json

Console logs

venv "E:\blankforge\stable-diffusion-webui-forge\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f0.0.10-latest-76-g291ec743
Commit hash: 291ec743b603fdcd9c58e60dc5ed3d866c53bc4c
Launching Web UI with arguments: --ckpt-dir E:/stable-diffusion-webui/models/Stable-diffusion --lora-dir X:LoRa
Total VRAM 8192 MB, total RAM 32610 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3060 Ti : native
VAE dtype: torch.bfloat16
Using pytorch cross attention
ControlNet preprocessor location: E:\blankforge\stable-diffusion-webui-forge\models\ControlNetPreprocessor
Loading weights [67ab2fd8ec] from E:/stable-diffusion-webui/models/Stable-diffusion\ponyDiffusionV6XL_v6StartWithThisOne.safetensors
2024-02-10 22:57:17,119 - ControlNet - INFO - ControlNet UI callback registered.
Running on local URL:  http://127.0.0.1:7861

To create a public link, set `share=True` in `launch()`.
model_type EPS
UNet ADM Dimension 2816
Startup time: 8.4s (prepare environment: 2.0s, import torch: 2.7s, import gradio: 0.7s, setup paths: 0.6s, other imports: 0.5s, load scripts: 1.0s, create ui: 0.5s, gradio launch: 0.4s).
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
extra {'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids'}
To load target model SDXLClipModel
Begin to load 1 model
Moving model(s) has taken 0.30 seconds
Model loaded in 4.6s (load weights from disk: 0.6s, forge load real models: 3.6s, calculate empty prompt: 0.5s).
To load target model SDXLClipModel
Begin to load 1 model
unload clone 0
Moving model(s) has taken 1.11 seconds
To load target model SDXL
Begin to load 1 model
Moving model(s) has taken 1.22 seconds
*** Error completing request
*** Arguments: ('task(6vrfv93fcdeczda)', <gradio.routes.Request object at 0x0000027B4622CF40>, ' <lora:Oil Painting Style SDXL_LoRA_10r_5e_56i_nr32_a16_Pony Diffusion V6 XL:1>', '', [], 15, 'UniPC', 1, 3, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], 0, False, '', 0.8, -1, False, -1, 0, 0, 0, UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], generated_image=None, mask_image=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced'), UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], generated_image=None, mask_image=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced'), UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], generated_image=None, mask_image=None, hr_option='Both', enabled=False, module='None', model='None', weight=1, image=None, resize_mode='Crop and Resize', processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced'), False, 1.01, 1.02, 0.99, 0.95, False, 256, 2, 0, False, False, 3, 2, 0, 0.35, True, 'bicubic', 'bicubic', False, 0.5, 2, False, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "E:\blankforge\stable-diffusion-webui-forge\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "E:\blankforge\stable-diffusion-webui-forge\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\txt2img.py", line 110, in txt2img
        processed = processing.process_images(p)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\processing.py", line 749, in process_images
        res = process_images_inner(p)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\processing.py", line 920, in process_images_inner
        samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\processing.py", line 1275, in sample
        samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
      File "E:\blankforge\stable-diffusion-webui-forge\modules\sd_samplers_timesteps.py", line 173, in sample
        samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "E:\blankforge\stable-diffusion-webui-forge\modules\sd_samplers_common.py", line 260, in launch_sampling
        return func()
      File "E:\blankforge\stable-diffusion-webui-forge\modules\sd_samplers_timesteps.py", line 173, in <lambda>
        samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "E:\blankforge\stable-diffusion-webui-forge\modules\sd_samplers_timesteps_impl.py", line 135, in unipc
        x = unipc_sampler.sample(x, steps=len(timesteps), t_start=t_start, skip_type=shared.opts.uni_pc_skip_type, method="multistep", order=shared.opts.uni_pc_order, lower_order_final=shared.opts.uni_pc_lower_order_final)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\models\diffusion\uni_pc\uni_pc.py", line 760, in sample
        model_prev_list = [self.model_fn(x, vec_t)]
      File "E:\blankforge\stable-diffusion-webui-forge\modules\models\diffusion\uni_pc\uni_pc.py", line 455, in model_fn
        return self.data_prediction_fn(x, t)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\models\diffusion\uni_pc\uni_pc.py", line 439, in data_prediction_fn
        noise = self.noise_prediction_fn(x, t)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\models\diffusion\uni_pc\uni_pc.py", line 433, in noise_prediction_fn
        return self.model(x, t)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\sd_samplers_timesteps_impl.py", line 124, in model
        res = self.cfg_model(x, t_input, **self.extra_args)
      File "E:\blankforge\stable-diffusion-webui-forge\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "E:\blankforge\stable-diffusion-webui-forge\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "E:\blankforge\stable-diffusion-webui-forge\modules\sd_samplers_cfg_denoiser.py", line 165, in forward
        x = x * (real_sigma ** 2.0 + real_sigma_data ** 2.0) ** 0.5
    RuntimeError: The size of tensor a (64) must match the size of tensor b (3) at non-singleton dimension 3

---

Additional information

No response

lllyasviel commented 8 months ago

update and try again?

slashedstar commented 8 months ago

update and try again?

Fixed!