stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Seed may not working with Prompt matrix script (@txt2img)

Open plmsuper8 opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Somehow it treate the input seed as float (actually int)? and throw a TypeError like this: TypeError: SeedSequence expects int or sequence of ints for entropy not 3514726657.0

Steps to reproduce the problem

  1. start up
  2. in txt2img mode
  3. input a seed
  4. choose prompt matrix script, input multiple prompt split by |
  5. generate (ONLY failed after both 3 + 4 steps )

What should have happened?

generate a image matrix

Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--listen --gradio-auth pptest:goodtest8 --deepdanbooru --xformers --enable-insecure-extension-access

List of extensions

Extension URL Version Update
a1111-sd-webui-tagcomplete https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git 6269c405 (Sat Feb 18 12:25:13 2023) unknown
sd-webui-controlnet https://github.com/Mikubill/sd-webui-controlnet a24089a6 (Sun Feb 19 07:08:12 2023) unknown
stable-diffusion-webui-cafe-aesthetic https://github.com/p1atdev/stable-diffusion-webui-cafe-aesthetic.git d2e7b647 (Sun Feb 12 08:52:28 2023) unknown
stable-diffusion-webui-depthmap-script https://github.com/thygate/stable-diffusion-webui-depthmap-script.git 189e30ad (Mon Feb 6 12:13:59 2023) unknown
stable-diffusion-webui-images-browser https://github.com/AlUlkesh/stable-diffusion-webui-images-browser.git 3f6fb330 (Sun Feb 19 15:49:33 2023) unknow

Console logs

(sd) F:\stable-diffusion-webui>CALL  bash F:\stable-diffusion-webui\startup1.bash
Python 3.10.6 | packaged by conda-forge | (main, Oct  7 2022, 20:14:50) [MSC v.1916 64 bit (AMD64)]
Commit hash: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
Installing requirements for Web UI
Installing requirement for sd-webui-controlnet

Installing imageio-ffmpeg requirement for depthmap script
Installing pyqt5 requirement for depthmap script


Launching Web UI with arguments: --listen --gradio-auth pptest:goodtest8 --deepdanbooru --xformers --enable-insecure-extension-access
Loading weights [95afa0d9ea] from F:\stable-diffusion-webui\models\Stable-diffusion\real\chilloutmix_NiPrunedFp32.safetensors
Creating model from config: F:\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(10): EasyNegative, hiten_1, mai_style, megumi_惠, midiexiang, mignon, nahida2-25000, ng_deepnegative_v1_75t, shenqi, ulzzang-6500
Model loaded in 7.0s (create model: 0.4s, apply weights to model: 2.9s, apply half(): 0.6s, move model to device: 0.6s, load textual inversion embeddings: 2.4s).
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:47<00:00,  2.37s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:44<00:00,  2.24s/it]
Prompt matrix will create 1 images using a total of 1 batches.
Error completing request
Arguments: ('task(8ma1klvxpn8k085)', 'lolita fashion, gothic, gothic lolita, lolita hairband,', '|paintings, sketches, ((monochrome)), ((grayscale))|EasyNegative |NG_DeepNegative_V1_75T', [], 20, 3, False, False, 1, 1, 8, 3514726657.0, -1.0, 0, 0, 0, False, 768, 512, False, 0.7, 1.75, 'SwinIR_4x', 12, 0, 0, [], 1, False, 7, 100, 'Constant', 0, 'Constant', 0, 4, False, 'none', 'None', 1, None, False, 'Scale to Fit (Inner Fit)', False, False, 64, 64, 64, 1, True, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0, 0, 0, 512, 512, False, False, True, True, True, False, False, 1, False, False, 2.5, 4, 0, False, 0, 1, False, False, 'u2net', False, False, False, False) {}
Traceback (most recent call last):
  File "F:\stable-diffusion-webui\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "F:\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "F:\stable-diffusion-webui\modules\txt2img.py", line 53, in txt2img
    processed = modules.scripts.scripts_txt2img.run(p, *args)
  File "F:\stable-diffusion-webui\modules\scripts.py", line 376, in run
    processed = script.run(p, *script_args)
  File "F:\stable-diffusion-webui\scripts\prompt_matrix.py", line 100, in run
    processed = process_images(p)
  File "F:\stable-diffusion-webui\modules\processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "F:\stable-diffusion-webui\modules\processing.py", line 632, in process_images_inner
    samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength, prompts=prompts)
  File "F:\stable-diffusion-webui\modules\processing.py", line 832, in sample
    samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
  File "F:\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 345, in sample
    noise_sampler = self.create_noise_sampler(x, sigmas, p)
  File "F:\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 284, in create_noise_sampler
    return BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=current_iter_seeds)
  File "F:\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 110, in __init__
    self.tree = BatchedBrownianTree(x, t0, t1, seed)
  File "F:\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 80, in __init__
    self.trees = [torchsde.BrownianTree(t0, w0, t1, entropy=s, **kwargs) for s in seed]
  File "F:\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 80, in <listcomp>
    self.trees = [torchsde.BrownianTree(t0, w0, t1, entropy=s, **kwargs) for s in seed]
  File "D:\miniconda3\envs\sd\lib\site-packages\torchsde\_brownian\derived.py", line 155, in __init__
    self._interval = brownian_interval.BrownianInterval(t0=t0,
  File "D:\miniconda3\envs\sd\lib\site-packages\torchsde\_brownian\brownian_interval.py", line 537, in __init__
    generator = np.random.SeedSequence(entropy=entropy, pool_size=pool_size)
  File "bit_generator.pyx", line 299, in numpy.random.bit_generator.SeedSequence.__init__
TypeError: SeedSequence expects int or sequence of ints for entropy not 3514726657.0

Additional information

No response

plmsuper8 avatar Feb 21 '23 16:02 plmsuper8

I'm having this problem also It happens with "DPM++ SDE Karras" but not with "Euler a"

Thiago-Morais avatar Feb 24 '23 13:02 Thiago-Morais

Changing the file repositories/k-diffusion/k_diffusion/sampling.py line 80 into

self.trees = [torchsde.BrownianTree(t0, w0, t1, entropy=int(s), **kwargs) for s in seed]

will provide a quick fix to this issue. This will just convert the float to int as it passes the seed value. Which should have been an int to begin with, so there may be a bug further up.

grumpyland avatar Apr 28 '23 06:04 grumpyland