Koishi-Star / Euler-Smea-Dyn-Sampler

A sampler base on Euler, aim at generating better picture/一种基于Euler的采样方法,旨在生成更好的图片
Apache License 2.0
135 stars 11 forks source link

A1111 1.8.0 - Doesn't work with Batch Size > 1 #3

Open Targren opened 2 months ago

Targren commented 2 months ago

Disabled all extra extensions.

When setting Batch Size > 1, after following the instructions and selecting one of the new samplers, setting Batch Size to a value > 1 causes generation to fail. The following message appears in the output window

RuntimeError: shape '[1, 4, 1024, 2, 2]' is invalid for input of size 32768
(For batch_size = 2. Input size scales to batch size, 16k * batch_size)

The console Log follows


Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Launching Web UI with arguments: --medvram-sdxl --xformers --api --skip-python-version-check --no-download-sd-model --listen --enable-insecure-extension-access --theme dark --gradio-allowed-path E:\A1111 Web UI\StabilityMatrixData\Images
*** "Disable all extensions" option was set, will only load built-in extensions ***
Loading weights [879db523c3] from E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\models\Stable-diffusion\00. Favorites\dreamshaper_8.safetensors
Creating model from config: E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\configs\v1-inference.yaml
Running on local URL:  http://0.0.0.0:7860
Applying attention optimization: xformers... done.
Model loaded in 1.9s (load weights from disk: 0.1s, create model: 0.3s, apply weights to model: 1.0s, load textual inversion embeddings: 0.2s, calculate empty prompt: 0.1s).

To create a public link, set `share=True` in `launch()`.
Startup time: 13.5s (prepare environment: 1.8s, import torch: 3.4s, import gradio: 0.8s, setup paths: 0.8s, initialize shared: 0.1s, other imports: 0.4s, list SD models: 0.1s, load scripts: 0.7s, create ui: 1.2s, gradio launch: 4.1s, add APIs: 0.1s).
  6%|▌         | 2/35 [00:00<00:15,  2.10it/s]
*** Error completing request
*** Arguments: ('task(6j0yccn1nrvkvh4)', <gradio.routes.Request object at 0x000001CDADAE9660>, 'A Puppy with a ball', '', [], 35, 'Euler Dy', 1, 2, 7, 512, 512, False, 0.4, 2, '4x_foolhardy_Remacri', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], 0, False, '', 0.8, -1, False, -1, 0, 0, 0, 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:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\txt2img.py", line 110, in txt2img
        processed = processing.process_images(p)
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\processing.py", line 785, in process_images
        res = process_images_inner(p)
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\processing.py", line 921, 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:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\processing.py", line 1257, in sample
        samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\sd_samplers_kdiffusion.py", line 236, 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:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\sd_samplers_common.py", line 261, in launch_sampling
        return func()
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\modules\sd_samplers_kdiffusion.py", line 236, 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:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\repositories\k-diffusion\k_diffusion\sampling.py", line 762, in sample_euler_dy
        x = dy_sampling_step(x, model, dt, sigma_hat, **extra_args)
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "E:\A1111 Web UI\StabilityMatrixData\Packages\Stable Diffusion WebUI\repositories\k-diffusion\k_diffusion\sampling.py", line 719, in dy_sampling_step
        a_list = x.unfold(2, 2, 2).unfold(3, 2, 2).contiguous().view(1, 4, m * n, 2, 2)
    RuntimeError: shape '[1, 4, 1024, 2, 2]' is invalid for input of size 32768

---

Total progress:   6%|▌         | 2/35 [00:19<00:02, 13.47it/s]```
rltgjqmcpgjadyd commented 2 months ago

Same problem confirmed

Koishi-Star commented 2 months ago

Get it. Trying to fix the bug……

Koishi-Star commented 2 months ago

I've fixed the crash issue when the batch size is greater than 1. On a side note, I highly recommend using multiple batches for generation instead of generating multiple within a single batch, as this will increase GPU memory usage. The fix for the extension is coming soon.

Targren commented 2 months ago

Edit: Nevermind. Pre-coffee idiocy on my part. Looks like it's working after all.