Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! #79

Open
0jiuxian0 opened this issue Dec 2, 2024 · 0 comments

Comments

@0jiuxian0
Copy link

Error 报错

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 mat1 in method wrapper_CUDA_addmm)

Problem description 问题描述

This problem only occurs when I am using this all-in-one ControlNet: xinsir/controlnet-union-sdxl-1.0
这个问题只有我在使用这个多合一的controlNet的时候才会出现:xinsir/controlnet-union-sdxl-1.0
There is no problem when I use this ControlNet specifically for processing OpenPose: xinsir/controlnet-openpose-sdxl-1.0.
当我使用这个专门处理OpenPose的ControlNet的时候是没问题的:xinsir/controlnet-openpose-sdxl-1.0
Other control types also have the same problem.
其他的控制类型也是有相同的问题

image
image

System Messgae 系统信息

Windows 11 22H2
GPU: RTX4060 8G
Stable Diffusion WebUI: c19d044

Detail Logs 详细日志

    Traceback (most recent call last):
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\call_queue.py", line 74, in f
        res = list(func(*args, **kwargs))
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\call_queue.py", line 53, in f
        res = func(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\txt2img.py", line 109, in txt2img
        processed = processing.process_images(p)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\processing.py", line 847, in process_images
        res = process_images_inner(p)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 59, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\processing.py", line 988, 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 "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\hook.py", line 470, in process_sample
        return process.sample_before_CN_hack(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\processing.py", line 1346, in sample
        samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_samplers_kdiffusion.py", line 230, 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 "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_samplers_common.py", line 272, in launch_sampling
        return func()
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_samplers_kdiffusion.py", line 230, 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 "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\repositories\k-diffusion\k_diffusion\sampling.py", line 145, in sample_euler_ancestral
        denoised = model(x, sigmas[i] * s_in, **extra_args)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_samplers_cfg_denoiser.py", line 249, in forward
        x_out = self.inner_model(x_in, sigma_in, cond=make_condition_dict(cond_in, image_cond_in))
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\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 "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\repositories\k-diffusion\k_diffusion\external.py", line 138, in get_eps
        return self.inner_model.apply_model(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_models_xl.py", line 43, in apply_model
        return self.model(x, t, cond)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1582, in _call_impl
        result = forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_hijack_utils.py", line 22, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_hijack_utils.py", line 34, in __call__
        return self.__sub_func(self.__orig_func, *args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\modules\sd_hijack_unet.py", line 50, in apply_model
        result = orig_func(self, x_noisy.to(devices.dtype_unet), t.to(devices.dtype_unet), cond, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\repositories\generative-models\sgm\modules\diffusionmodules\wrappers.py", line 28, in forward
        return self.diffusion_model(
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\hook.py", line 905, in forward_webui
        raise e
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\hook.py", line 902, in forward_webui
        return forward(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\hook.py", line 613, in forward
        control = param.control_model(
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\cldm.py", line 32, in forward
        return self.control_model(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions\sd-webui-controlnet\scripts\cldm.py", line 364, in forward
        emb = self.time_embed(t_emb)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1582, in _call_impl
        result = forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\container.py", line 217, in forward
        input = module(input)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
        return forward_call(*args, **kwargs)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\extensions-builtin\Lora\networks.py", line 584, in network_Linear_forward
        return originals.Linear_forward(self, input)
      File "F:\AI\AI Paint\Stable Diffusion\sd-webui-aki-v4.9\python\lib\site-packages\torch\nn\modules\linear.py", line 116, in forward
        return F.linear(input, self.weight, self.bias)
    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 mat1 in method wrapper_CUDA_addmm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant