vladmandic / automatic

SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.29k stars 377 forks source link

[Issue]: Sampling Steps randomly change when doing any batch images #2641

Closed IzzyWizzy666 closed 6 months ago

IzzyWizzy666 commented 6 months ago

Issue Description

In text to image setting the batch count or size to anything other than 1 causes the sampling steps to randomly change to a different number usually on the second or third image.

Version Platform Description

Intel CPU, RTX3090, Windows 11

Console log for platform info:- 18:15:46-748705 INFO Starting SD.Next 18:15:46-755702 INFO Logger: file="D:\AI\vlad1111\sdnext.log" level=INFO size=12124200 mode=append 18:15:46-758712 INFO Python 3.10.6 on Windows 18:15:47-029439 INFO Version: app=sd.next updated=2023-12-19 hash=00281e15 url=https://github.com/vladmandic/automatic/tree/master 18:15:47-674301 INFO Platform: arch=AMD64 cpu=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel system=Windows release=Windows-10-10.0.22621-SP0 python=3.10.6 18:15:47-680301 INFO nVidia CUDA toolkit detected: nvidia-smi present 18:15:54-298739 INFO Startup: standard 18:15:54-300741 INFO Verifying requirements 18:15:54-324835 INFO Verifying packages 18:15:54-327839 INFO Verifying submodules 18:16:43-904163 INFO Extensions enabled: ['Lora', 'sd-extension-chainner', 'sd-extension-system-info', 'sd-webui-agent-scheduler', 'sd-webui-controlnet', 'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'adetailer', 'loopback_scaler', 'sd-civitai-browser-plus', 'sd-model-organizer', 'sd-webui-bmab', 'sd-webui-kohya-hiresfix', 'sd-webui-resharpen', 'sd-webui-supermerger', 'Stable-Diffusion-Webui-Civitai-Helper'] 18:16:43-907162 WARNING Extensions duplicates: ['sd-webui-agent-scheduler', 'sd-webui-controlnet'] 18:16:43-908162 INFO Verifying requirements 18:16:43-926353 INFO Updating Wiki 18:16:45-330174 INFO Extension preload: {'extensions-builtin': 0.01, 'extensions': 0.0} 18:16:45-332178 INFO Command line args: ['--upgrade', '--backend', 'diffusers', '--autolaunch', '--use-cuda', '--use-xformers'] autolaunch=True backend=diffusers upgrade=True use_cuda=True use_xformers=True 18:16:52-892545 INFO Load packages: torch=2.1.0+cu121 diffusers=0.24.0 gradio=3.43.2 18:16:54-479473 INFO Engine: backend=Backend.DIFFUSERS compute=cuda mode=no_grad device=cuda cross-optimization="xFormers" 18:16:54-571023 INFO Device: device=NVIDIA GeForce RTX 3090 n=1 arch=sm_90 cap=(8, 6) cuda=12.1 cudnn=8801 driver=546.17 18:17:05-249494 INFO Available VAEs: path="D:\AI\stable-diffusion-webui-1.6.0-RC\models\VAE" items=1 18:17:05-255494 INFO Skipping conflicting extension: extensions\sd-webui-agent-scheduler 18:17:05-256496 INFO Skipping conflicting extension: extensions\sd-webui-controlnet 18:17:05-258496 INFO Disabling uncompatible extensions: backend=Backend.DIFFUSERS ['sd-webui-controlnet', 'multidiffusion-upscaler-for-automatic1111', 'a1111-sd-webui-lycoris', 'sd-webui-animatediff'] 18:17:05-361289 INFO Available models: path="D:\AI\stable-diffusion-webui-1.6.0-RC\models\Stable-diffusion" items=120 time=0.10 18:17:08-820368 INFO Extension: script='extensions-builtin\sd-webui-agent-scheduler\scripts\task_scheduler.py' Using sqlite file: extensions-builtin\sd-webui-agent-scheduler\task_scheduler.sqlite3 18:17:11-779287 INFO Extension: script='extensions\adetailer\scripts!adetailer.py' [-] ADetailer initialized. version: 23.11.1, num models: 21 18:17:11-947834 INFO Extension: script='extensions\sd-civitai-browser-plus\scripts\civitai_api.py' [96mCivitAI Browser+[0m: Aria2 RPC started 18:17:12-260442 ERROR Module load: extensions\sd-webui-bmab\scripts\sd_webui_bmab.py: ImportError ╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮ │ D:\AI\vlad1111\modules\script_loading.py:25 in load_module │ │ │ │ 24 │ │ │ with contextlib.redirect_stdout(io.StringIO()) as stdout: │ │ ❱ 25 │ │ │ │ module_spec.loader.exec_module(module) │ │ 26 │ │ │ setup_logging() # reset since scripts can hijaack logging │ │ in exec_module:883 │ │ in _call_with_frames_removed:241 │ │ │ │ D:\AI\vlad1111\extensions\sd-webui-bmab\scripts\sd_webui_bmab.py:1 in │ │ │ │ ❱ 1 from sd_bmab.bmab import BmabExtScript │ │ 2 │ │ │ │ D:\AI\vlad1111\extensions\sd-webui-bmab\sd_bmab\bmab.py:7 in │ │ │ │ 6 from sd_bmab import parameters │ │ ❱ 7 from sd_bmab.base import context, filter │ │ 8 │ │ │ │ D:\AI\vlad1111\extensions\sd-webui-bmab\sd_bmab\base__init.py:2 in │ │ │ │ 1 from sd_bmab.base.common import VAEMethodOverride │ │ ❱ 2 from sd_bmab.base.context import Context │ │ 3 from sd_bmab.base.detectorbase import DetectorBase │ │ │ │ D:\AI\vlad1111\extensions\sd-webui-bmab\sd_bmab\base\context.py:6 in │ │ │ │ 5 │ │ ❱ 6 from sd_bmab.sd_override import StableDiffusionProcessingTxt2ImgOv, StableDiffusionProce │ │ 7 from sd_bmab.util import debug_print │ │ │ │ D:\AI\vlad1111\extensions\sd-webui-bmab\sd_bmab\sd_override\init__.py:1 in │ │ │ │ ❱ 1 from sd_bmab.sd_override.samper import override_samplers │ │ 2 from sd_bmab.sd_override.img2img import StableDiffusionProcessingImg2ImgOv │ │ │ │ D:\AI\vlad1111\extensions\sd-webui-bmab\sd_bmab\sd_override\samper.py:8 in │ │ │ │ 7 from modules import sd_samplers_common │ │ ❱ 8 from modules.script_callbacks import ExtraNoiseParams, extra_noise_callback │ │ 9 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ImportError: cannot import name 'ExtraNoiseParams' from 'modules.script_callbacks' (D:\AI\vlad1111\modules\script_callbacks.py) 18:17:12-596884 INFO Extension: script='extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\civitai_helper.py' Civitai Helper: Get Custom Model Folder 18:17:12-600877 INFO Extensions time: 6.31 { Lora=1.50 sd-extension-chainner=0.13 sd-webui-agent-scheduler=0.82 stable-diffusion-webui-images-browser=0.13 stable-diffusion-webui-rembg=2.17 adetailer=0.66 sd-civitai-browser-plus=0.21 sd-model-organizer=0.08 sd-webui-bmab=0.29 sd-webui-supermerger=0.13 Stable-Diffusion-Webui-Civitai-Helper=0.05 } 18:17:13-470529 INFO Load UI theme: name="black-teal" style=Dark base=sdnext.css Civitai Helper: Set Proxy: None fatal: No names found, cannot describe anything. 18:17:23-677755 INFO Local URL: http://127.0.0.1:7860/ 18:17:23-679755 INFO Initializing middleware 18:17:23-922841 INFO [AgentScheduler] Task queue is empty 18:17:23-924841 INFO [AgentScheduler] Registering APIs 18:17:24-210391 INFO Startup time: 38.87 { torch=4.88 gradio=2.59 diffusers=0.08 libraries=12.34 extensions=6.31 models=0.10 face-restore=0.93 upscalers=0.10 extra-networks=0.70 ui-extra-networks=2.84 ui-txt2img=0.07 ui-img2img=0.12 ui-settings=0.21 ui-extensions=6.15 ui-defaults=0.32 launch=0.48 api=0.11 app-started=0.41 } 18:17:24-215617 INFO Launching browser 18:17:37-130145 INFO MOTD: N/A 18:17:40-245708 INFO Browser session: user=None client=127.0.0.1 agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 18:22:22-096413 INFO Select: model="SDXLTURBO\sdxlMergeheaven_betaM15 [0003f193a7]" 18:22:22-099412 INFO Select: dict="SDXL\LahMysteriousSDXL_v40 [da5ddce194]" Loading model: D:\AI\stable-diffusion-webui-1.6.0-RC\models\Stable-diffusion\SDXLTURBO\sdxlMergeheaven_betaM15.safeten… 18:22:40-018396 INFO Torch override dtype: no-half set 18:22:40-020397 INFO Torch override VAE dtype: no-half set 18:22:40-022396 INFO Setting Torch parameters: device=cuda dtype=torch.float32 vae=torch.float32 unet=torch.float32 context=no_grad fp16=False bf16=False 18:22:40-024367 INFO Loading VAE: model=D:\AI\stable-diffusion-webui-1.6.0-RC\models\VAE\sdxl_vae.safetensors source=settings 18:22:40-026370 INFO Diffusers: vae="Stable Diffusion XL" class=StableDiffusionXLPipeline file="D:\AI\stable-diffusion-webui-1.6.0-RC\models\Stable-diffusion\SDXLTURBO\sdxlMergeheaven_b etaM15.safetensors" size=6617MB 18:22:40-338479 INFO Diffusers: model="Stable Diffusion XL" class=StableDiffusionXLPipeline file="D:\AI\stable-diffusion-webui-1.6.0-RC\models\Stable-diffusion\SDXLTURBO\sdxlMergeheaven_b etaM15.safetensors" size=6617MB 18:22:57-275753 INFO Load embeddings: loaded=0 skipped=0 time=0.00 18:22:57-657660 INFO Load model: time=35.17 { load=35.17 } native=512 {'ram': {'used': 10.11, 'total': 39.95}, 'gpu': {'used': 14.6, 'total': 24.0}, 'retries': 0, 'oom': 0} 18:22:57-660301 INFO Select: model="SDXL\LahMysteriousSDXL_v40 [da5ddce194]" 18:23:12-832219 INFO Reusing previous model dictionary Loading model: D:\AI\stable-diffusion-webui-1.6.0-RC\models\Stable-diffusion\SDXL\LahMysteriousSDXL_v40.safetensors 0… 18:23:33-215397 INFO Torch override dtype: no-half set 18:23:33-218397 INFO Torch override VAE dtype: no-half set 18:23:33-220399 INFO Setting Torch parameters: device=cuda dtype=torch.float32 vae=torch.float32 unet=torch.float32 context=no_grad fp16=False bf16=False

Relevant log output

Start a batch run steps at 8
20:34:23-261703 INFO     Processed: images=1 time=49.94 its=0.20 memory={'ram': {'used': 17.24, 'total': 39.95}, 'gpu':
                         {'used': 14.93, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:34:30-774018 INFO     Applying LoRA: ['OliviaXL', 'FaeTastic2', 'add-detail-xl'] patch=0.00 load=0.00
Progress  2.19s/it ███████████████████████████████████ 100% 8/8 00:17 00:00 Base

-----------------------------------------------------------^^^^---------------- Great

20:35:08-496731 ERROR    Running script postprocess: extensions\sd-webui-kohya-hiresfix\scripts\khrfix.py:
                         AttributeError
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ D:\AI\vlad1111\modules\scripts.py:551 in postprocess                                                                 │
│                                                                                                                      │
│   550 │   │   │   │   args = p.per_script_args.get(script.title(), p.script_args[script.args_f                       │
│ ❱ 551 │   │   │   │   script.postprocess(p, processed, *args)                                                        │
│   552 │   │   │   except Exception as e:                                                                             │
│                                                                                                                      │
│ D:\AI\vlad1111\extensions\sd-webui-kohya-hiresfix\scripts\khrfix.py:101 in postprocess                               │
│                                                                                                                      │
│   100 │   def postprocess(self, p, processed, *args):                                                                │
│ ❱ 101 │   │   for i, b in enumerate(p.sd_model.model.diffusion_model.input_blocks):                                  │
│   102 │   │   │   if isinstance(b, Scaler):                                                                          │
│                                                                                                                      │
│ D:\AI\vlad1111\venv\lib\site-packages\diffusers\configuration_utils.py:138 in __getattr__                            │
│                                                                                                                      │
│   137 │   │                                                                                                          │
│ ❱ 138 │   │   raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'"                       │
│   139                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'StableDiffusionXLPipeline' object has no attribute 'model'
20:35:09-089731 INFO
20:35:10-758705 INFO     0: 640x416 1 face, 946.0ms
20:35:10-760707 INFO     Speed: 5.1ms preprocess, 946.0ms inference, 3.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.23s/it ███████████████████████████████████ 100% 8/8 00:09 00:00 Base

-----------------------------------------------------------^^^^---------------- Adetailer is good

20:35:41-852017 INFO     Processed: images=1 time=31.06 its=0.26 memory={'ram': {'used': 17.35, 'total': 39.95}, 'gpu':
                         {'used': 14.99, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:35:42-274657 INFO
20:35:44-402486 INFO     0: 640x416 1 person, 1055.3ms
20:35:44-404548 INFO     Speed: 3.0ms preprocess, 1055.3ms inference, 3.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.91s/it ███████████████████████████████████ 100% 8/8 00:15 00:00 Base

-----------------------------------------------------------^^^^---------------- Adetailer is good

20:36:18-531710 INFO     Processed: images=1 time=34.08 its=0.23 memory={'ram': {'used': 18.49, 'total': 39.95}, 'gpu':
                         {'used': 19.38, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:36:18-958977 INFO
20:36:20-222298 INFO     0: 512x352 1 pussy, 562.3ms
20:36:20-224300 INFO     Speed: 3.0ms preprocess, 562.3ms inference, 3.0ms postprocess per image at shape (1, 3, 512,
                         352)
Progress  1.91s/it ███████████████████████████████████ 100% 8/8 00:15 00:00 Base

-----------------------------------------------------------^^^^---------------- Adetailer is good

20:36:53-703151 INFO     Processed: images=1 time=33.45 its=0.24 memory={'ram': {'used': 18.9, 'total': 39.95}, 'gpu':
                         {'used': 19.83, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:36:53-791754 INFO     Processed: images=1 time=143.02 its=0.06 memory={'ram': {'used': 18.86, 'total': 39.95}, 'gpu':
                         {'used': 19.86, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:37:51-192151 INFO     Applying LoRA: ['OliviaXL', 'FaeTastic2', 'add-detail-xl'] patch=0.00 load=0.00
Progress  2.61s/it ███████████████████████████████████ 100% 8/8 00:20 00:00 Base

-----------------------------------------------------------^^^^---------------- Next images is good

20:38:33-671565 ERROR    Running script postprocess: extensions\sd-webui-kohya-hiresfix\scripts\khrfix.py:
                         AttributeError
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ D:\AI\vlad1111\modules\scripts.py:551 in postprocess                                                                 │
│                                                                                                                      │
│   550 │   │   │   │   args = p.per_script_args.get(script.title(), p.script_args[script.args_f                       │
│ ❱ 551 │   │   │   │   script.postprocess(p, processed, *args)                                                        │
│   552 │   │   │   except Exception as e:                                                                             │
│                                                                                                                      │
│ D:\AI\vlad1111\extensions\sd-webui-kohya-hiresfix\scripts\khrfix.py:101 in postprocess                               │
│                                                                                                                      │
│   100 │   def postprocess(self, p, processed, *args):                                                                │
│ ❱ 101 │   │   for i, b in enumerate(p.sd_model.model.diffusion_model.input_blocks):                                  │
│   102 │   │   │   if isinstance(b, Scaler):                                                                          │
│                                                                                                                      │
│ D:\AI\vlad1111\venv\lib\site-packages\diffusers\configuration_utils.py:138 in __getattr__                            │
│                                                                                                                      │
│   137 │   │                                                                                                          │
│ ❱ 138 │   │   raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'"                       │
│   139                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'StableDiffusionXLPipeline' object has no attribute 'model'
20:38:34-277881 INFO
20:38:36-094530 INFO     0: 640x416 1 face, 994.2ms
20:38:36-096531 INFO     Speed: 3.0ms preprocess, 994.2ms inference, 3.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.23s/it ███████████████████████████████████ 100% 8/8 00:09 00:00 Base

-----------------------------------------------------------^^^^---------------- Adetailer is good

20:39:07-492223 INFO     Processed: images=1 time=31.36 its=0.26 memory={'ram': {'used': 17.14, 'total': 39.95}, 'gpu':
                         {'used': 15.1, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:39:07-816651 INFO
20:39:08-773698 INFO     0: 640x416 1 vagina_exposed, 462.3ms
20:39:08-776698 INFO     Speed: 4.0ms preprocess, 462.3ms inference, 3.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.95s/it ███████████████████████████████████ 100% 8/8 00:15 00:00 Base

-----------------------------------------------------------^^^^---------------- Adetailer is good

-----------------------------------------------------------^^^^---------------- Adetailer is good

20:39:43-940037 INFO     Processed: images=1 time=35.13 its=0.23 memory={'ram': {'used': 18.66, 'total': 39.95}, 'gpu':
                         {'used': 19.06, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:39:44-459745 INFO
20:39:44-635541 INFO     0: 640x416 1 breast_pair, 67.3ms
20:39:44-637544 INFO     Speed: 3.0ms preprocess, 67.3ms inference, 3.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.91s/it ███████████████████████████████████ 100% 8/8 00:15 00:00 Base

-----------------------------------------------------------^^^^---------------- Adetailer is good

20:40:18-377441 INFO     Processed: images=1 time=33.71 its=0.24 memory={'ram': {'used': 18.88, 'total': 39.95}, 'gpu':
                         {'used': 19.68, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:40:18-494988 INFO     Applying LoRA: ['OliviaXL', 'FaeTastic2', 'add-detail-xl'] patch=0.00 load=0.00
Progress  2.20s/it █████████████████████████████████ 100% 40/40 01:28 00:00 Base

-----------------------------------------------------------^^^^---------------- Third image is not good - step are now 40 - it can be various different number,s I've seem 40, 19, 25 etc.

20:42:04-613695 ERROR    Running script postprocess: extensions\sd-webui-kohya-hiresfix\scripts\khrfix.py:
                         AttributeError
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ D:\AI\vlad1111\modules\scripts.py:551 in postprocess                                                                 │
│                                                                                                                      │
│   550 │   │   │   │   args = p.per_script_args.get(script.title(), p.script_args[script.args_f                       │
│ ❱ 551 │   │   │   │   script.postprocess(p, processed, *args)                                                        │
│   552 │   │   │   except Exception as e:                                                                             │
│                                                                                                                      │
│ D:\AI\vlad1111\extensions\sd-webui-kohya-hiresfix\scripts\khrfix.py:101 in postprocess                               │
│                                                                                                                      │
│   100 │   def postprocess(self, p, processed, *args):                                                                │
│ ❱ 101 │   │   for i, b in enumerate(p.sd_model.model.diffusion_model.input_blocks):                                  │
│   102 │   │   │   if isinstance(b, Scaler):                                                                          │
│                                                                                                                      │
│ D:\AI\vlad1111\venv\lib\site-packages\diffusers\configuration_utils.py:138 in __getattr__                            │
│                                                                                                                      │
│   137 │   │                                                                                                          │
│ ❱ 138 │   │   raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'"                       │
│   139                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'StableDiffusionXLPipeline' object has no attribute 'model'
20:42:05-354649 INFO
20:42:05-422162 INFO     0: 640x416 1 face, 24.5ms
20:42:05-426158 INFO     Speed: 2.0ms preprocess, 24.5ms inference, 3.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.11s/it ███████████████████████████████████ 100% 8/8 00:08 00:00 Base
20:42:31-848111 INFO     Processed: images=1 time=26.39 its=0.30 memory={'ram': {'used': 18.87, 'total': 39.95}, 'gpu':
                         {'used': 18.05, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:42:32-261205 INFO
20:42:32-315722 INFO     0: 640x416 1 vagina_exposed, 17.0ms
20:42:32-316730 INFO     Speed: 4.0ms preprocess, 17.0ms inference, 2.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.93s/it ███████████████████████████████████ 100% 8/8 00:15 00:00 Base
20:43:06-669971 INFO     Processed: images=1 time=34.32 its=0.23 memory={'ram': {'used': 18.89, 'total': 39.95}, 'gpu':
                         {'used': 20.11, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:43:07-097704 INFO
20:43:07-183240 INFO     0: 640x416 1 breast_pair, 26.0ms
20:43:07-185241 INFO     Speed: 7.0ms preprocess, 26.0ms inference, 4.0ms postprocess per image at shape (1, 3, 640,
                         416)
Progress  1.94s/it ███████████████████████████████████ 100% 8/8 00:15 00:00 Base
20:43:41-921059 INFO     Processed: images=1 time=34.70 its=0.23 memory={'ram': {'used': 18.89, 'total': 39.95}, 'gpu':
                         {'used': 17.88, 'total': 24.0}, 'retries': 0, 'oom': 0}
20:43:42-041574 INFO     Applying LoRA: ['OliviaXL', 'FaeTastic2', 'add-detail-xl'] patch=0.00 load=0.00
Progress  2.71s/it ████████▎                          25% 10/40 00:27 01:21 Base
-------------------------------------------------------------^^-------------------------------
20:44:10-991917 INFO     Interrupted...

Backend

Original

Branch

Master

Model

SD-XL

Acknowledgements

vladmandic commented 6 months ago

fixed in dev branch, will be merged to master in the next release.