ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Error for SDXL control net for older GPUs

Open Kfredric opened this issue 3 years ago • 3 comments

Hi I have been trying to use SDXL control net and nothing that I have tried is working I've tried everything even reinstalling but it looks like this is an error for older GPUs that do not support Fp16 and --force-fp32 does not fix it. others with this issue can be found on reddit here and here Here are the logs:

Setting up MemoryEfficientCrossAttention. Query dim is 1280, context_dim is None and using 20 heads.
Setting up MemoryEfficientCrossAttention. Query dim is 1280, context_dim is 2048 and using 20 heads.
  0%|                                                                                           | 0/30 [00:00<?, ?it/s]
!!! Exception during processing !!!
Traceback (most recent call last):
  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "D:\ComfyUI_windows_portable\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:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1206, in sample
    return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1176, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py", line 93, in sample
    samples = sampler.sample(noise, positive_copy, negative_copy, 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:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 733, in sample
    samples = getattr(k_diffusion_sampling, "sample_{}".format(self.sampler))(self.model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\sampling.py", line 154, in sample_euler_ancestral
    denoised = model(x, sigmas[i] * s_in, **extra_args)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 323, in forward
    out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, cond_concat=cond_concat, model_options=model_options, seed=seed)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\external.py", line 125, in forward
    eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\k_diffusion\external.py", line 151, in get_eps
    return self.inner_model.apply_model(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 311, in apply_model
    out = sampling_function(self.inner_model.apply_model, x, timestep, uncond, cond, cond_scale, cond_concat, model_options=model_options, seed=seed)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 289, in sampling_function
    cond, uncond = calc_cond_uncond_batch(model_function, cond, uncond, x, timestep, max_total_area, cond_concat, model_options)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\samplers.py", line 241, in calc_cond_uncond_batch
    c['control'] = control.get_control(input_x, timestep_, c, len(cond_or_uncond))
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 813, in get_control
    control = self.control_model(x=x_noisy.to(self.control_model.dtype), hint=self.cond_hint, timesteps=t, context=context.to(self.control_model.dtype), y=y)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\cldm\cldm.py", line 283, in forward
    emb = self.time_embed(t_emb)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\container.py", line 217, in forward
    input = module(input)
  File "D:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 866, in forward
    return torch.nn.functional.linear(input, self.weight.to(input.device) + (torch.mm(self.up.flatten(start_dim=1), self.down.flatten(start_dim=1))).reshape(self.weight.shape).type(input.dtype), self.bias)
RuntimeError: self and mat2 must have the same dtype

Prompt executed in 48.63 seconds

I am using a laptop gtx 1650 and am on the most current update for comfyUI workflow I am using is just the SDXL controlnet canny example but with the rank128 model for increased chance of success.

Kfredric avatar Aug 22 '23 00:08 Kfredric

Should be fixed with: https://github.com/comfyanonymous/ComfyUI/commit/763b0cf024c8fd462343ab0a8cfdab099714168b

comfyanonymous avatar Aug 22 '23 00:08 comfyanonymous

yes works now

Kfredric avatar Aug 22 '23 01:08 Kfredric

Have exact same issue & the updates do not fix the issue for me. Card not working is 980ti (6gb vram). All files updated, SDXL works fine otherwise, and SD 1.5 ControlNet works fine ( canny, depth, openpose, etc tested ). ONLY these NEW SDXL only models cause this exact error. Note: Running Comfy on 3-4x different PCs concurrently and only the OLD (980ti) continues to have this error with new models.

DougPP avatar Aug 22 '23 23:08 DougPP