comfyanonymous / ComfyUI

The most powerful and modular stable diffusion GUI, api and backend with a graph/nodes interface.
GNU General Public License v3.0
41.37k stars 4.4k forks source link

GLIGEN basic examples workflow error occurred when executing KSampler #3881

Open huaibi2008 opened 1 week ago

huaibi2008 commented 1 week ago

Your question

I used the GLIGEN workflow from Basic Examples. This problem arises when executing to Ksapler. No custom node.

Logs

Error occurred when executing KSampler:

Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_CUDA_cat)

File "D:\ComfyUIMax\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\nodes.py", line 1371, in sample
return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\nodes.py", line 1341, in common_ksampler
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\custom_nodes\Comfyui-StableSR\nodes.py", line 69, in hook_sample
return original_sample(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 22, in informative_sample
raise e
File "D:\ComfyUIMax\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 9, in informative_sample
return original_sample(*args, **kwargs) # This code helps interpret error messages that occur within exceptions but does not have any impact on other operations.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 410, in motion_sample
return orig_comfy_sample(model, noise, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\control_reference.py", line 47, in refcn_sample
return orig_comfy_sample(model, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\utils.py", line 111, in uncond_multiplier_check_cn_sample
return orig_comfy_sample(model, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\sample.py", line 43, in sample
samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 795, in sample
return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 697, in sample
return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 684, in sample
output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 663, in inner_sample
samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 568, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 875, in sample_unipc_bh2
return sample_unipc(model, noise, sigmas, extra_args, callback, disable, variant='bh2')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 870, in sample_unipc
x = uni_pc.sample(noise, timesteps=timesteps, skip_type="time_uniform", method="multistep", order=order, lower_order_final=True, callback=callback, disable_pbar=disable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 717, in sample
model_prev_list = [self.model_fn(x, vec_t)]
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 410, in model_fn
return self.data_prediction_fn(x, t)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 394, in data_prediction_fn
noise = self.noise_prediction_fn(x, t)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 388, in noise_prediction_fn
return self.model(x, t)
^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 329, in model_fn
return noise_pred_fn(x, t_continuous)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 297, in noise_pred_fn
output = model(x, t_input, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 861, in
lambda input, sigma, **kwargs: predict_eps_sigma(model, input, sigma, **kwargs),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\extra_samplers\uni_pc.py", line 845, in predict_eps_sigma
return (input - model(input, sigma_in, **kwargs)) / sigma
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 291, in __call__
out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 650, in __call__
return self.predict_noise(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 653, in predict_noise
return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 277, in sampling_function
out = calc_cond_batch(model, conds, x, timestep, model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\custom_nodes\ComfyUI-TiledDiffusion\.patches.py", line 4, in calc_cond_batch
return calc_cond_batch_original_tiled_diffusion_6771369b(model, conds, x_in, timestep, model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 151, in calc_cond_batch
p = get_area_and_mult(x, x_in, timestep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\samplers.py", line 80, in get_area_and_mult
gligen_patch = gligen_model.model.set_position(input_x.shape, gligen[2], input_x.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUIMax\ComfyUI\comfy\gligen.py", line 283, in set_position
conds = torch.cat(positive_embeddings +

Other

No response

BrechtCorbeel commented 1 week ago

I think you have either an IGPU that somehow is interfering with your GPU or some setting turned on that makes it think you have 2 devices, it does not know which to choose. Is what I make out of this.

huaibi2008 commented 1 week ago

thank you first。but my cpu have no IGPU。and I use \ComfyUI\ComfyUI\main.py" --windows-standalone-build --cuda-device 0 --listen 192.168.31.125 --port 8188 --gpu-only to start comfyui. I still don't know how to fix it.

I think you have either an IGPU that somehow is interfering with your GPU or some setting turned on that makes it think you have 2 devices, it does not know which to choose. Is what I make out of this.

BrechtCorbeel commented 1 week ago

After looking into it you might have ran out of Vram which made it try probably to offload on your CPU and Ram for some reason and then probably later down the line there's code that does not accept 2 devices GPU + CPU as an input.

Try making your image smaller and not overloading Vram see if that works.

jimwang2019 commented 5 days ago

hey,bro.have you solved this problem,i met this issue as you.

shawnington commented 3 days ago

What hardware are you running this on?

jimwang2019 commented 3 days ago

What hardware are you running this on?

Thanks for you reply. Now i can general sure that the model type i use for running not compatible between SD1.5 and SDXL, related to the base model ,controlnet plugin, and preprocessor....,but i can not definitely about this.

My hardware: 16G /N 4070,so i think this is enough for the testing workflow.

Thanks a lot.my bro.