Open kkget opened 8 months ago
I got the same error using "--use-cpu all", If you modify this segment of modules/devices.py
def get_device_for(task):
if task in shared.cmd_opts.use_cpu:
return cpu
return get_optimal_device()
to just return CPU it properly forces CN onto the CPU as well. Which points to the issue being with it looking for a task tied to use_cpu and not finding it. Digging into CN's code, it calls get_device_for("controlnet"). So I reverted the code and tried something different.
I'm guessing you're using the same flag, just "--use-cpu all"?
I got it working with the original code by replacing that with "--use-cpu all controlnet". This would effectively make use_cpu an array holding "all" and "controlnet", allowing CN to find itself and get CPU.
Another fix for this might be
def get_device_for(task):
if task in shared.cmd_opts.use_cpu or "all" in shared.cmd_opts.use_cpu:
return cpu
return get_optimal_device()
which makes 'all' behave as implied by the term, forcing CPU on everything, this also applies to something called swinir (which from what I can tell was also missed by "all" previously). This would be a fix code-side, whereas adding controlnet to the argument list is user-side and easier to do.
Also I applaud the courage with which you just posted that prompt loll, I'd have at least generated a sfw prompt to attach before posting logs.
另外,我为您刚刚发布该提示的勇气鼓掌,哈哈,我至少会在发布日志之前生成一个 sfw 提示以附加。
If you can try using this prompt word, it is normal
我使用“--use-cpu all”得到了同样的错误,如果您修改这部分模块/设备.py
def get_device_for(task): if task in shared.cmd_opts.use_cpu: return cpu return get_optimal_device()
只是为了返回 CPU,它也会正确地将 CN 强制到 CPU 上。这表明问题在于它正在寻找与use_cpu相关的任务而没有找到它。深入研究 CN 的代码,它调用 get_device_for(“controlnet”)。所以我恢复了代码并尝试了一些不同的东西。
我猜你使用的是相同的标志,只是“--use-cpu all”?
我通过将其替换为“--use-cpu all controlnet”来使用它来使用原始代码。这将有效地使use_cpu成为一个包含“all”和“controlnet”的数组,允许CN找到自己并获取CPU。
另一个解决方法可能是
def get_device_for(task): if task in shared.cmd_opts.use_cpu or "all" in shared.cmd_opts.use_cpu: return cpu return get_optimal_device()
这使得“all”的行为与术语所暗示的那样,迫使 CPU 在所有事情上,这也适用于称为 swinir 的东西(据我所知,以前“all”也遗漏了它)。这将是代码端的修复,而将 controlnet 添加到参数列表是用户端的,更容易做到。
Thank you for your answer. I'll give it a try
我使用“--use-cpu all”得到了同样的错误,如果您修改这部分模块/设备.py
def get_device_for(task): if task in shared.cmd_opts.use_cpu: return cpu return get_optimal_device()
只是为了返回 CPU,它也会正确地将 CN 强制到 CPU 上。这表明问题在于它正在寻找与use_cpu相关的任务而没有找到它。深入研究 CN 的代码,它调用 get_device_for(“controlnet”)。所以我恢复了代码并尝试了一些不同的东西。 我猜你使用的是相同的标志,只是“--use-cpu all”? 我通过将其替换为“--use-cpu all controlnet”来使用它来使用原始代码。这将有效地使use_cpu成为一个包含“all”和“controlnet”的数组,允许CN找到自己并获取CPU。 另一个解决方法可能是
def get_device_for(task): if task in shared.cmd_opts.use_cpu or "all" in shared.cmd_opts.use_cpu: return cpu return get_optimal_device()
这使得“all”的行为与术语所暗示的那样,迫使 CPU 在所有事情上,这也适用于称为 swinir 的东西(据我所知,以前“all”也遗漏了它)。这将是代码端的修复,而将 controlnet 添加到参数列表是用户端的,更容易做到。
Thank you for your answer. I'll give it a try
I forgot to mention you might need to add --no-half-controlnet - it's the controlnet version of --no-half that seems necessary to run on CPU
我使用“--use-cpu all”得到了同样的错误,如果您修改这部分模块/设备.py
def get_device_for(task): if task in shared.cmd_opts.use_cpu: return cpu return get_optimal_device()
只是为了返回 CPU,它也会正确地将 CN 强制到 CPU 上。这表明问题在于它正在寻找与use_cpu相关的任务而没有找到它。深入研究 CN 的代码,它调用 get_device_for(“controlnet”)。所以我恢复了代码并尝试了一些不同的东西。 我猜你使用的是相同的标志,只是“--use-cpu all”? 我通过将其替换为“--use-cpu all controlnet”来使用它来使用原始代码。这将有效地使use_cpu成为一个包含“all”和“controlnet”的数组,允许CN找到自己并获取CPU。 另一个解决方法可能是
def get_device_for(task): if task in shared.cmd_opts.use_cpu or "all" in shared.cmd_opts.use_cpu: return cpu return get_optimal_device()
这使得“all”的行为与术语所暗示的那样,迫使 CPU 在所有事情上,这也适用于称为 swinir 的东西(据我所知,以前“all”也遗漏了它)。这将是代码端的修复,而将 controlnet 添加到参数列表是用户端的,更容易做到。
Thank you for your answer. I'll give it a try
I forgot to mention you might need to add --no-half-controlnet - it's the controlnet version of --no-half that seems necessary to run on CPU
It is very likely that this is the reason. I tried and replied. Thank you very much
The issue also occurs with general NVIDIA GPUs so I think it may have nothing to do with use-cpu
arg.
The issue also occurs with general NVIDIA GPUs so I think it may have nothing to do with
use-cpu
arg.
Same error text, "but found at least two devices, cpu and cuda:0!", or are the two devices found different?
If it's the same text and you're not using use-cpu then something must be falling back on cpu for some reason for it to be listed in the error. What's your parameters and what's the top of the stack trace when it throws the error? Maybe you have an extension with fallback behavior? I have an nvidia gpu but only get this error when using use-cpu
The issue also occurs with general NVIDIA GPUs so I think it may have nothing to do with
use-cpu
arg.Same error text, "but found at least two devices, cpu and cuda:0!", or are the two devices found different?
If it's the same text and you're not using use-cpu then something must be falling back on cpu for some reason for it to be listed in the error. What's your parameters and what's the top of the stack trace when it throws the error? Maybe you have an extension with fallback behavior? I have an nvidia gpu but only get this error when using
use-cpu
Same error text and stack traces. It also went through sd-webui-controlnet and have AnimateDiff enabled.
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.6.0-2-g4afaaf8a0
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
current transparent-background 1.2.9
Launching Web UI with arguments: --medvram-sdxl --theme dark --xformers --opt-channelslast --api --autolaunch
=================================================================================
You are running xformers 0.0.19.
The program is tested to work with xformers 0.0.20.
To reinstall the desired version, run with commandline flag --reinstall-xformers.
Use --skip-version-check commandline argument to disable this check.
=================================================================================
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Civitai Helper: No setting file, use default
========================= a1111-sd-webui-lycoris =========================
Starting from stable-diffusion-webui version 1.5.0
a1111-sd-webui-lycoris extension is no longer needed
All its features have been integrated into the native LoRA extension
LyCORIS models can now be used as if there are regular LoRA models
This extension has been automatically deactivated
Please remove this extension
==========================================================================
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 23.11.1, num models: 9
[AddNet] Updating model hashes...
[AddNet] Updating model hashes...
2023-12-03 03:02:20,707 - ControlNet - INFO - ControlNet v1.1.419
ControlNet preprocessor location: D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\annotator\downloads
2023-12-03 03:02:20,842 - ControlNet - INFO - ControlNet v1.1.419
sd-webui-prompt-all-in-one background API service started successfully.
Loading weights [d819c8be6b] from D:\sd-webui-aki\sd-webui-aki-v4.1\models\Stable-diffusion\majicmixRealistic_v4.safetensors
2023-12-03 03:02:22,270 - AnimateDiff - INFO - Injecting LCM to UI.
2023-12-03 03:02:22,872 - AnimateDiff - INFO - Hacking i2i-batch.
Running on local URL: http://127.0.0.1:7860
Creating model from config: D:\sd-webui-aki\sd-webui-aki-v4.1\configs\v1-inference.yaml
Loading VAE weights specified in settings: D:\sd-webui-aki\sd-webui-aki-v4.1\models\VAE\vae-ft-mse-840000-ema-pruned.safetensors
Applying attention optimization: xformers... done.
Model loaded in 3.5s (load weights from disk: 1.7s, create model: 0.3s, apply weights to model: 1.1s, load VAE: 0.1s, calculate empty prompt: 0.1s).
To create a public link, set `share=True` in `launch()`.
Startup time: 25.3s (prepare environment: 9.2s, import torch: 3.8s, import gradio: 1.2s, setup paths: 0.7s, initialize shared: 0.4s, other imports: 0.6s, setup codeformer: 0.1s, load scripts: 4.9s, create ui: 1.4s, gradio launch: 2.4s, app_started_callback: 0.5s).
2023-12-03 03:03:09,599 - ControlNet - INFO - Preview Resolution = 512
2023-12-03 03:03:19,571 - ControlNet - INFO - Loading model: control_v11f1p_sd15_depth [cfd03158]
2023-12-03 03:03:20,009 - ControlNet - INFO - Loaded state_dict from [D:\sd-webui-aki\sd-webui-aki-v4.1\models\ControlNet\control_v11f1p_sd15_depth.pth]
2023-12-03 03:03:20,009 - ControlNet - INFO - controlnet_default_config
2023-12-03 03:03:22,302 - ControlNet - INFO - ControlNet model control_v11f1p_sd15_depth [cfd03158] loaded.
2023-12-03 03:03:22,373 - ControlNet - INFO - Loading preprocessor: depth
2023-12-03 03:03:22,374 - ControlNet - INFO - preprocessor resolution = 512
2023-12-03 03:03:22,923 - ControlNet - INFO - ControlNet Hooked - Time = 3.8737494945526123
0: 640x448 1 face, 67.8ms
Speed: 2.0ms preprocess, 67.8ms inference, 1.0ms postprocess per image at shape (1, 3, 640, 448)
2023-12-03 03:03:36,832 - ControlNet - INFO - Loading model from cache: control_v11f1p_sd15_depth [cfd03158]
2023-12-03 03:03:36,833 - ControlNet - INFO - Loading preprocessor: depth
2023-12-03 03:03:36,833 - ControlNet - INFO - preprocessor resolution = 512
2023-12-03 03:03:36,910 - ControlNet - INFO - ControlNet Hooked - Time = 0.2124333381652832
2023-12-03 03:03:42,439 - ControlNet - INFO - Loading model from cache: control_v11f1p_sd15_depth [cfd03158]
2023-12-03 03:03:42,441 - ControlNet - INFO - Loading preprocessor: depth
2023-12-03 03:03:42,441 - ControlNet - INFO - preprocessor resolution = 512
2023-12-03 03:03:42,486 - ControlNet - INFO - ControlNet Hooked - Time = 0.05086398124694824
0: 640x448 1 face, 66.8ms
Speed: 2.0ms preprocess, 66.8ms inference, 1.0ms postprocess per image at shape (1, 3, 640, 448)
2023-12-03 03:03:55,246 - ControlNet - INFO - Loading model from cache: control_v11f1p_sd15_depth [cfd03158]
2023-12-03 03:03:55,248 - ControlNet - INFO - Loading preprocessor: depth
2023-12-03 03:03:55,248 - ControlNet - INFO - preprocessor resolution = 512
2023-12-03 03:03:55,293 - ControlNet - INFO - ControlNet Hooked - Time = 0.04989433288574219
2023-12-03 03:06:03,301 - AnimateDiff - INFO - AnimateDiff process start.
2023-12-03 03:06:03,301 - AnimateDiff - INFO - Loading motion module mm_sd_v15_v2.ckpt from D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-animatediff\model\mm_sd_v15_v2.ckpt
2023-12-03 03:06:03,907 - AnimateDiff - INFO - Guessed mm_sd_v15_v2.ckpt architecture: MotionModuleType.AnimateDiffV2
2023-12-03 03:06:06,584 - AnimateDiff - WARNING - Missing keys <All keys matched successfully>
2023-12-03 03:06:07,605 - AnimateDiff - INFO - Injecting motion module mm_sd_v15_v2.ckpt into SD1.5 UNet middle block.
2023-12-03 03:06:07,605 - AnimateDiff - INFO - Injecting motion module mm_sd_v15_v2.ckpt into SD1.5 UNet input blocks.
2023-12-03 03:06:07,606 - AnimateDiff - INFO - Injecting motion module mm_sd_v15_v2.ckpt into SD1.5 UNet output blocks.
2023-12-03 03:06:07,606 - AnimateDiff - INFO - Setting DDIM alpha.
2023-12-03 03:06:07,610 - AnimateDiff - INFO - Injection finished.
2023-12-03 03:06:07,610 - AnimateDiff - INFO - Hacking loral to support motion lora
2023-12-03 03:06:07,610 - AnimateDiff - INFO - Hacking CFGDenoiser forward function.
2023-12-03 03:06:07,610 - AnimateDiff - INFO - Hacking ControlNet.
2023-12-03 03:06:07,621 - ControlNet - INFO - Loading model from cache: control_v11f1p_sd15_depth [cfd03158]
2023-12-03 03:06:07,622 - ControlNet - INFO - Loading preprocessor: depth
2023-12-03 03:06:07,623 - ControlNet - INFO - preprocessor resolution = 512
2023-12-03 03:06:07,701 - ControlNet - INFO - ControlNet Hooked - Time = 0.08377456665039062
*** Error completing request
*** Arguments: ('task(gj8o5m70yq4yyhy)', '(sky1.6),(field:1.6),(grass:1.6),samira \\(league of legends\\),league of legends,1girl,jewelry,tattoo,eyepatch,earrings,green eyes,braid,long hair,dark skin,gloves,armor,navel,bracelet,lips,hair over shoulder,smile,looking at viewer,arm tattoo,mole,mole above mouth,<lora:沙弥啦:1>,best quality,masterpiece,illustration,an extremely delicate and beautiful,extremely detailed,CG,unity,8k wallpaper,Amazing,finely detail,masterpiece,best quality,official art,extremely detailed CG unity 8k wallpaper,absurdres,incredibly absurdres,huge filesize,ultra-detailed,highres,extremely detailed,beautiful detailed girl,extremely detailed eyes and face,beautiful detailed eyes,light on face,(pureerosface_v1:0.5),(ulzzang-6500-v1.1:0.5),', 'NSFW,sketches,(worst quality:2),(low quality:2),(normal quality:2),lowres,normal quality,((monochrome)),((grayscale)),skin spots,acnes,skin blemishes,bad anatomy,(long hair:1.4),DeepNegative,(fat:1.2),facing away,looking away,tilted head,{Multiple people},lowres,bad anatomy,bad hands,text,error,missing fingers,extra digit,fewer digits,cropped,worstquality,low quality,normal quality,jpegartifacts,signature,watermark,username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digit,extra arms,extra leg,extra foot,(bad-hands-5:0.8),(bad_prompt_version2:0.8),', [], 20, 'DPM++ 2M alt Karras', 1, 1, 7, 768, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], <gradio.routes.Request object at 0x00000250F145AC80>, 0, False, '', 0.8, 3456605177, False, -1, 0, 0, 0, True, False, {'ad_model': 'face_yolov8n.pt', 'ad_prompt': '<lora:韩国脸:1>,', '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': 'Euler a', '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': 'Euler a', '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': ()}, False, 'MultiDiffusion', False, True, 1024, 1024, 96, 96, 48, 1, 'None', 2, False, 10, 1, 1, 64, False, False, False, False, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 1536, 96, True, True, True, False, False, 7, 100, 'Constant', 0, 'Constant', 0, 4, True, 'MEAN', 'AD', 1, False, False, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, None, 'Refresh models', <scripts.animatediff_ui.AnimateDiffProcess object at 0x00000250F1704FA0>, UiControlNetUnit(enabled=True, module='depth_midas', model='control_v11f1p_sd15_depth [cfd03158]', weight=1, image={'image': array([[[145, 125, 118],
*** [145, 125, 118],
*** [145, 125, 118],
*** ...,
*** [199, 177, 169],
*** [199, 177, 169],
*** [199, 177, 169]],
***
*** [[145, 125, 118],
*** [145, 125, 118],
*** [145, 125, 118],
*** ...,
*** [199, 177, 169],
*** [199, 177, 169],
*** [199, 177, 169]],
***
*** [[145, 125, 118],
*** [145, 125, 118],
*** [145, 125, 118],
*** ...,
*** [199, 177, 169],
*** [199, 177, 169],
*** [199, 177, 169]],
***
*** ...,
***
*** [[102, 80, 74],
*** [102, 80, 74],
*** [102, 79, 75],
*** ...,
*** [122, 97, 93],
*** [122, 97, 93],
*** [122, 97, 93]],
***
*** [[104, 80, 74],
*** [104, 80, 74],
*** [104, 80, 75],
*** ...,
*** [122, 99, 92],
*** [122, 99, 92],
*** [122, 99, 92]],
***
*** [[103, 79, 67],
*** [103, 79, 67],
*** [103, 79, 67],
*** ...,
*** [122, 97, 94],
*** [122, 97, 94],
*** [122, 97, 94]]], dtype=uint8), 'mask': array([[[0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0],
*** ...,
*** [0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0]],
***
*** [[0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0],
*** ...,
*** [0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0]],
***
*** [[0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0],
*** ...,
*** [0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0]],
***
*** ...,
***
*** [[0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0],
*** ...,
*** [0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0]],
***
*** [[0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0],
*** ...,
*** [0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0]],
***
*** [[0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0],
*** ...,
*** [0, 0, 0],
*** [0, 0, 0],
*** [0, 0, 0]]], dtype=uint8)}, resize_mode='Crop and Resize', low_vram=False, processor_res=512, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=512, threshold_a=64, threshold_b=64, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=512, threshold_a=64, threshold_b=64, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), 'NONE:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1\nINS:1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0\nIND:1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0\nINALL:1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0\nMIDD:1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0\nOUTD:1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0\nOUTS:1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1\nOUTALL:1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1\nALL0.5:0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5', True, 0, 'values', '0,0.25,0.5,0.75,1', 'Block ID', 'IN05-OUT05', 'none', '', '0.5,1', 'BASE,IN00,IN01,IN02,IN03,IN04,IN05,IN06,IN07,IN08,IN09,IN10,IN11,M00,OUT00,OUT01,OUT02,OUT03,OUT04,OUT05,OUT06,OUT07,OUT08,OUT09,OUT10,OUT11', 1.0, 'black', '20', False, 'ATTNDEEPON:IN05-OUT05:attn:1\n\nATTNDEEPOFF:IN05-OUT05:attn:0\n\nPROJDEEPOFF:IN05-OUT05:proj:0\n\nXYZ:::1', False, False, '🔄', False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False, 'None', '', '', 1, 'FirstGen', False, False, 'Current', False, 1 2 3
*** 0 , False, '', False, 1, False, False, 30, '', False, False, False, '', '', '', '', '', None, None, False, None, None, False, None, None, False, 50, 'NONE:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1\nINS:1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0\nIND:1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0\nINALL:1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0\nMIDD:1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0\nOUTD:1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0\nOUTS:1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1\nOUTALL:1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1\nALL0.5:0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5', True, 0, 'values', '0,0.25,0.5,0.75,1', 'Block ID', 'IN05-OUT05', 'none', '', '0.5,1', 'BASE,IN00,IN01,IN02,IN03,IN04,IN05,IN06,IN07,IN08,IN09,IN10,IN11,M00,OUT00,OUT01,OUT02,OUT03,OUT04,OUT05,OUT06,OUT07,OUT08,OUT09,OUT10,OUT11', 1.0, 'black', '20', False, 'ATTNDEEPON:IN05-OUT05:attn:1\n\nATTNDEEPOFF:IN05-OUT05:attn:0\n\nPROJDEEPOFF:IN05-OUT05:proj:0\n\nXYZ:::1', False, False) {}
Traceback (most recent call last):
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\txt2img.py", line 55, in txt2img
processed = processing.process_images(p)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\processing.py", line 732, in process_images
res = process_images_inner(p)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-animatediff\scripts\animatediff_cn.py", line 119, in hacked_processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\processing.py", line 867, 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 "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\scripts\hook.py", line 420, in process_sample
return process.sample_before_CN_hack(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\processing.py", line 1140, in sample
samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\sd_samplers_kdiffusion.py", line 267, 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 "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\sd_samplers_common.py", line 261, in launch_sampling
return func()
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\sd_samplers_kdiffusion.py", line 267, 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 "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\sd_samplers_kdiffusion.py", line 59, in sample_dpmpp_2m_alt
denoised = model(x, sigmas[i] * s_in, **extra_args)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-animatediff\scripts\animatediff_infv2v.py", line 269, in mm_cfg_forward
x_out[a:b] = self.inner_model(x_in[a:b], sigma_in[a:b], cond=make_condition_dict(c_crossattn, image_cond_in[a:b]))
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\repositories\k-diffusion\k_diffusion\external.py", line 112, in forward
eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\repositories\k-diffusion\k_diffusion\external.py", line 138, in get_eps
return self.inner_model.apply_model(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\sd_hijack_utils.py", line 17, in <lambda>
setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
File "D:\sd-webui-aki\sd-webui-aki-v4.1\modules\sd_hijack_utils.py", line 28, in __call__
return self.__orig_func(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 858, in apply_model
x_recon = self.model(x_noisy, t, **cond)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1335, in forward
out = self.diffusion_model(x, t, context=cc)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\scripts\hook.py", line 827, in forward_webui
raise e
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\scripts\hook.py", line 824, in forward_webui
return forward(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\scripts\hook.py", line 561, in forward
control = param.control_model(x=x_in, hint=hint, timesteps=timesteps, context=context, y=y)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\scripts\cldm.py", line 31, in forward
return self.control_model(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions\sd-webui-controlnet\scripts\cldm.py", line 300, in forward
guided_hint = self.input_hint_block(hint, emb, context)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\repositories\generative-models\sgm\modules\diffusionmodules\openaimodel.py", line 102, in forward
x = layer(x)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\extensions-builtin\Lora\networks.py", line 444, in network_Conv2d_forward
return originals.Conv2d_forward(self, input)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument weight in method wrapper_CUDA___slow_conv2d_forward)
---
Interesting... The error definitely points to something (either SD itself, controlnet, or AnimateDiff) is being shunted to the CPU. I tried your arguments, and don't get the same error either nor am I seeing that shunting happening. I don't have AnimateDiff, but I don't see why it would be shunting to CPU when your arguments don't cause that for either SD or CN
sd-webui-aki, where did that come from? This repro is stable-diffusion-webui, I'm wondering if there's code differences between the two, I'd be willing to install sd-webui-aki to troubleshoot it and figure out what's going on.
Are you comfortable with python? If you can track down that devices.py file in your setup, you could print() the task when devices are fetched to see who's getting shunted. If you can get me a copy of just that devices.py file i could send you back a debug version to probe this a bit (it'd return info on who is requesting a device and what they get to the output).
I'd be curious if you get the issue when not using AnimateDiff? Like, if you just use Controlnet and StableDiffusion. From what I'm understanding of the logs it looks like controlnet does it's thing quite happily and the crash is happening when AnimateDiff tries to grab hold of it - if AnimateDiff alone is having the issue then I'll take a look at that.
sd-webui-aki, where did that come from? This repro is stable-diffusion-webui, I'm wondering if there's code differences between the two, I'd be willing to install sd-webui-aki to troubleshoot it and figure out what's going on.
It's literally stable-diffusion-webui
packed with python, torch, etc. Codes are the same.
I am not experiencing that either, or I'd debug it on my own. It is some random guys on forum that had this.
I'd be curious if you get the issue when not using AnimateDiff? Like, if you just use Controlnet and StableDiffusion. From what I'm understanding of the logs it looks like controlnet does it's thing quite happily and the crash is happening when AnimateDiff tries to grab hold of it - if AnimateDiff alone is having the issue then I'll take a look at that.
I went through my error reporting warehouse and it seems the error only happens when both Controlnet and Animatediff are involved. I fail to find any instance where only Controlnet or Animatediff exists. Also the number of such events and users are pretty low (somewhere around 30-40 in 14 days so it is a pretty rare one).
FYI on one of the instances these extensions are installed:
我很好奇您在不使用 AnimateDiff 时是否遇到问题?比如,如果你只使用 Controlnet 和 StableDiffusion。根据我对日志的理解,看起来 controlnet 做得非常高兴,当 AnimateDiff 试图抓住它时,崩溃正在发生 - 如果只有 AnimateDiff 有问题,那么我会看看。
There are no errors when using Controlnet alone or Animatediff alone, and there are issues with the combination of the two
Thanks for the answers - i'll install and test animatediff tomorrow to see if I can repro the issue.
So I found something relevant and perhaps worth testing - but I can't get it working myself (I'm running this raw in windows, not using a docker instance). When I just use --xformers it falls back to doggettx, if I force xformers i get an error that xformers fails to load because it's missing triton and triton doesn't exist on windows. I can import xformers in an interactive python shell, but not xformers.ops (this throws the triton error). It then hard-crashes on generation. That said, this might be worth testing on your end, from animatediff's docs :
Attention
Adding --xformers / --opt-sdp-attention to your command lines can significantly reduce VRAM and improve speed. However, due to a bug in xformers, you may or may not get CUDA error. If you get CUDA error, please either completely switch to --opt-sdp-attention, or preserve --xformers -> go to Settings/AnimateDiff -> choose "Optimize attention layers with sdp (torch >= 2.0.0 required)".
kkget were you using xformers too? If you don't use xformers or use opt-sdp-attention instead of xformers does it affect the error at all? It might simply be the issue listed in animatediff's repo.
That said, this might be better approached from AnimateDiff's repo, on top of this one. It seems to be an issue with AnimateDiff itself from what you guys are saying. I did find a few places where CPU-shunting could be happening, gonna test that then if it still fails I'll bite the bullet and try to get this set up in linux so I can test xformers myself with triton installed.
Triton is not involved in any way here so it is fine to leave that alone.
xformers can work raw in Windows just make sure the version matches with the torch.
I found out that both SDP and xformers are having this in a similar fashion so it might be irrelevant.
https://github.com/continue-revolution/sd-webui-animatediff/issues/302#issuecomment-1806700246
Fair enough. This is a known issue when Pad prompt/negative prompt to be same length
ia not enabled.
Triton is not involved in any way here so it is fine to leave that alone.
xformers can work raw in Windows just make sure the version matches with the torch.
I found out that both SDP and xformers are having this in a similar fashion so it might be irrelevant.
but I use Animatediff is not have the error
So I found something relevant and perhaps worth testing - but I can't get it working myself (I'm running this raw in windows, not using a docker instance). When I just use --xformers it falls back to doggettx, if I force xformers i get an error that xformers fails to load because it's missing triton and triton doesn't exist on windows. I can import xformers in an interactive python shell, but not xformers.ops (this throws the triton error). It then hard-crashes on generation. That said, this might be worth testing on your end, from animatediff's docs :
Attention
Adding --xformers / --opt-sdp-attention to your command lines can significantly reduce VRAM and improve speed. However, due to a bug in xformers, you may or may not get CUDA error. If you get CUDA error, please either completely switch to --opt-sdp-attention, or preserve --xformers -> go to Settings/AnimateDiff -> choose "Optimize attention layers with sdp (torch >= 2.0.0 required)".
kkget were you using xformers too? If you don't use xformers or use opt-sdp-attention instead of xformers does it affect the error at all? It might simply be the issue listed in animatediff's repo.
That said, this might be better approached from AnimateDiff's repo, on top of this one. It seems to be an issue with AnimateDiff itself from what you guys are saying. I did find a few places where CPU-shunting could be happening, gonna test that then if it still fails I'll bite the bullet and try to get this set up in linux so I can test xformers myself with triton installed. Yes, I used xfomers in the settings, but my Torch version is Torch: 2.0.0+cu118
Thank you very much,I tried this setting and it can work now
Is there an existing issue for this?
What happened?
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument weight in method wrapper_CUDA___slow_conv2d_forward) 提示:Python 运行时抛出了一个异常。请检查疑难解答页面。
Steps to reproduce the problem
normal use
What should have happened?
use Animatediff and controlnet
Sysinfo
python: 3.10.11 • torch: 2.0.0+cu118 • xformers: 0.0.17 • gradio: 3.41.2
What browsers do you use to access the UI ?
No response
Console logs
Additional information
No response