lllyasviel / lllyasviel/sd-forge-layerdiffuse
for sd 1.5 ,RuntimeError: CUDA error: invalid configuration argument
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 352
- PR merge metrics
- No merged PRs in 30d
Description
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f0.0.17v1.8.0rc-latest-276-g29be1da7
Commit hash: 29be1da7cf2b5dccfc70fbdd33eb35c56a31ffb7
CUDA 12.1
Launching Web UI with arguments: --xformers --ckpt-dir J:\AI\condaEnv\stable-diffusion-webui/models/Stable-diffusion --hypernetwork-dir J:\AI\condaEnv\stable-diffusion-webui/models/hypernetworks --embeddings-dir J:\AI\condaEnv\stable-diffusion-webui/embeddings --lora-dir J:\AI\condaEnv\stable-diffusion-webui/models/Lora --vae-dir J:\AI\condaEnv\stable-diffusion-webui/models/VAE
Total VRAM 8192 MB, total RAM 32646 MB
xformers version: 0.0.24
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 Ti : native
Hint: your device supports --pin-shared-memory for potential speed improvements.
Hint: your device supports --cuda-malloc for potential speed improvements.
Hint: your device supports --cuda-stream for potential speed improvements.
VAE dtype: torch.bfloat16
CUDA Stream Activated: False
Using xformers cross attention
ControlNet preprocessor location: J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\models\ControlNetPreprocessor
[-] ADetailer initialized. version: 24.1.2, num models: 16
sd-webui-prompt-all-in-one background API service started successfully.
01:37:21 - ReActor - STATUS - Running v0.7.0-a2 on Device: CUDA
Loading weights [15012c538f] from J:\AI\condaEnv\stable-diffusion-webui\models\Stable-diffusion\realisticVisionV51_v51VAE.safetensors
2024-03-13 01:37:22,668 - ControlNet - INFO - ControlNet UI callback registered.
model_type EPS
UNet ADM Dimension 0
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Using xformers attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using xformers attention in VAE
Startup time: 119.9s (prepare environment: 5.9s, import torch: 5.1s, import gradio: 1.1s, setup paths: 0.6s, initialize shared: 0.3s, other imports: 0.6s, load scripts: 103.3s, create ui: 0.9s, gradio launch: 1.0s, app_started_callback: 0.8s).
extra {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale'}
To load target model SD1ClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 7091.9296875
[Memory Management] Model Memory (MB) = 454.2076225280762
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 5613.722064971924
Moving model(s) has taken 0.11 seconds
Model loaded in 4.2s (load weights from disk: 0.8s, forge load real models: 2.4s, calculate empty prompt: 0.9s).
To load target model BaseModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 6730.8017578125
[Memory Management] Model Memory (MB) = 1639.4137649536133
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 4067.3879928588867
Moving model(s) has taken 0.41 seconds
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 10.73it/s]
To load target model AutoencoderKL█████████████████████████████████████████████████████| 20/20 [00:01<00:00, 13.58it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 5061.75244140625
[Memory Management] Model Memory (MB) = 159.55708122253418
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 3878.195360183716
Moving model(s) has taken 0.13 seconds
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 10.53it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:03<00:00, 5.04it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00, 4.43it/s]
[Layer Diffusion] LayerMethod.JOINT_SD15███████████████████████████████████████████████| 20/20 [00:04<00:00, 5.37it/s]
Reuse 1 loaded models
To load target model BaseModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 4879.0224609375
[Memory Management] Model Memory (MB) = 0.0
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 3855.0224609375
Moving model(s) has taken 0.55 seconds
0%| | 0/20 [00:00
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 "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\repositories\k-diffusion\k_diffusion\sampling.py", line 594, in sample_dpmpp_2m
denoised = model(x, sigmas[i] * s_in, **extra_args)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\modules\sd_samplers_cfg_denoiser.py", line 182, in forward
denoised = forge_sampler.forge_sample(self, denoiser_params=denoiser_params,
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\modules_forge\forge_sampler.py", line 88, in forge_sample
denoised = sampling_function(model, x, timestep, uncond, cond, cond_scale, model_options, seed)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\modules\samplers.py", line 289, in sampling_function
cond_pred, uncond_pred = calc_cond_uncond_batch(model, cond, uncond_, x, timestep, model_options)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\modules\samplers.py", line 258, in calc_cond_uncond_batch
output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\modules\model_base.py", line 90, in apply_model
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float()
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\diffusionmodules\openaimodel.py", line 867, in forward
h = forward_timestep_embed(module, h, emb, context, transformer_options, time_context=time_context, num_video_frames=num_video_frames, image_only_indicator=image_only_indicator)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\diffusionmodules\openaimodel.py", line 55, in forward_timestep_embed
x = layer(x, context, transformer_options)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\attention.py", line 620, in forward
x = block(x, context=context[i], transformer_options=transformer_options)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\attention.py", line 447, in forward
return checkpoint(self._forward, (x, context, transformer_options), self.parameters(), self.checkpoint)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\diffusionmodules\util.py", line 194, in checkpoint
return func(*inputs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\attention.py", line 507, in _forward
n = self.attn1(n, context=context_attn1, value=value_attn1, transformer_options=extra_options)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\extensions\sd-forge-layerdiffuse\lib_layerdiffusion\attention_sharing.py", line 131, in forward
x = optimized_attention(q, k, v, self.heads)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\ldm_patched\ldm\modules\attention.py", line 314, in attention_xformers
out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=mask)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\xformers\ops\fmha\__init__.py", line 223, in memory_efficient_attention
return _memory_efficient_attention(
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\xformers\ops\fmha\__init__.py", line 321, in _memory_efficient_attention
return _memory_efficient_attention_forward(
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\xformers\ops\fmha\__init__.py", line 341, in _memory_efficient_attention_forward
out, *_ = op.apply(inp, needs_gradient=False)
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\xformers\ops\fmha\flash.py", line 458, in apply
out, softmax_lse, rng_state = cls.OPERATOR(
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\_ops.py", line 755, in __call__
return self._op(*args, **(kwargs or {}))
File "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\system\python\lib\site-packages\xformers\ops\fmha\flash.py", line 106, in _flash_fwd
) = _C_flashattention.fwd(
RuntimeError: CUDA error: invalid configuration argument
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
CUDA error: invalid configuration argument
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
*** Error completing request
*** Arguments: ('task(tmuo2818gmet6lo)', , 'an apple on table,high quality,4k,', '(worst quality, low quality, normal quality, lowres, low details, oversaturated, undersaturated, overexposed, underexposed, grayscale, bw, bad photo, bad photography, bad art:1.4),(watermark, signature, text font, username, error, logo, words, letters, digits, autograph, trademark, name:1.2),(blur, blurry, grainy),morbid,ugly,asymmetrical,mutated malformed,mutilated,poorly lit,bad shadow,draft,cropped,out of frame,cut off,censored,jpeg artifacts,out of focus,glitch,duplicate,(airbrushed, cartoon, anime, semi-realistic, cgi, render, blender, digital art, manga, amateur:1.3),(3D ,3D Game, 3D Game Scene, 3D Character:1.1),(bad hands, bad anatomy, bad body, bad face, bad teeth, bad arms, bad legs, deformities:1.3),', [], 20, 'DPM++ 2M Karras', 1, 3, 6, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], 0, False, '', 0.8, 1591002429, False, -1, 0, 0, 0, False, False, {'ad_model': 'mediapipe_face_full', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M Karras', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M Karras', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, True, '(SD1.5) Generate Everything Together (need batch size 3)', 1, 1, None, None, None, 'Crop and Resize', False, '', '', '', None, False, '0', '0', 'inswapper_128.onnx', 'CodeFormer', 1, True, 'None', 1, 1, False, True, 1, 0, 0, False, 0.5, True, False, 'CUDA', False, 0, 'None', '', None, False, False, 0.5, 0, ControlNetUnit(input_mode=, 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', save_detected_map=True), ControlNetUnit(input_mode=, 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', save_detected_map=True), ControlNetUnit(input_mode=, 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', save_detected_map=True), False, 7, 1, 'Constant', 0, 'Constant', 0, 1, 'enable', 'MEAN', 'AD', 1, False, 1.01, 1.02, 0.99, 0.95, False, 0.5, 2, False, 256, 2, 0, False, False, 3, 2, 0, 0.35, True, 'bicubic', 'bicubic', False, 0, 'anisotropic', 0, 'reinhard', 100, 0, 'subtract', 0, 0, 'gaussian', 'add', 0, 100, 127, 0, 'hard_clamp', 5, 0, 'None', 'None', False, 'MultiDiffusion', 768, 768, 64, 4, False, False, 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 "J:\AI\condaEnv\webuiforge\webui_forge_cu121_torch21\webui\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
TypeError: 'NoneType' object is not iterable
---
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback in extensions/sd-forge-layerdiffuse/lib_layerdiffusion/attention_sharing.py at line 131 and follow the call into ldm_patched/ldm/modules/attention.py at line 314. Reproduce the SD 1.5 failure using the reported Python, CUDA, xformers, GPU, and launch arguments, then determine the affected configuration and document or verify a fix for the invalid-configuration error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100