nullquant / ComfyUI-BrushNet

ComfyUI BrushNet nodes
Apache License 2.0
641 stars 24 forks source link

Loading Ksampler error <The size of tensor a (640) must match the size of tensor b (320) at non-singleton dimension 1> #152

Open TinkTL opened 4 days ago

TinkTL commented 4 days ago

After upgrading Comfyui, there was an error when loading the XL model. I saw similar feedback in the issues section and hope the author can fix it. Your plugin has been very helpful. If it cannot be fixed, please let me know. Thank you

nullquant commented 4 days ago

Please, post ComfyUI startup and error logs.

Orenji-Tangerine commented 3 days ago

I have the same error

Error on console on the below:

PowerPaint base CLIP file:
B:/WebUI/models/clip/model.fp16.safetensors

Successfully add external embeddings: P_ctxt, P_shape, P_obj. current

Successfully add trainable external embeddings: P_ctxt, P_shape, P_obj current

PowerPaint CLIP file: A:\ComfyUI\models\inpaint\PowerPaint\PowerPaint Clip.bin PowerPaint model type: SD1.5

PowerPaint model file:

A:\ComfyUI\models\inpaint\PowerPaint\PowerPaint v2.safetensors PowerPaint model is loaded Base model type: SD1.5 BrushNet image.shape = torch.Size([1, 768, 490, 3]) mask.shape = torch.Size([1, 768, 490]) BrushNet CL: image_latents shape = torch.Size([1, 4, 96, 61]) interpolated_mask shape = torch.Size([1, 1, 96, 61]) You should add to positive prompt: "empty scene" Requested to load SD1ClipModel Loading 1 new model loaded completely 0.0 308.26318359375 True Requested to load BaseModel Loading 1 new model BrushNet inference: do_classifier_free_guidance is True BrushNet inference, step = 0: image batch = 1, got 2 latents, starting from 0

BrushNet inference: sample torch.Size([2, 4, 96, 61]) , CL torch.Size([2, 5, 96, 61]) dtype torch.float16

BrushNet can't find <class 'comfy.ops.disable_weight_init.Conv2d'> layer in 0 input block: None

!!! Exception during processing !!! The size of tensor a (640) must match the size of tensor b (320) at non-singleton dimension 1 Traceback (most recent call last): File "A:\ComfyUI\execution.py", line 323, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "A:\ComfyUI\execution.py", line 198, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "A:\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "A:\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(inputs)) File "A:\ComfyUI\nodes.py", line 1486, in sample return common_ksampler(model, noise_seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise, disable_noise=disable_noise, start_step=start_at_step, last_step=end_at_step, force_full_denoise=force_full_denoise) File "A:\ComfyUI\nodes.py", line 1419, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "A:\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 22, in informative_sample raise e File "A:\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 "A:\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 420, in motion_sample return orig_comfy_sample(model, noise, args, kwargs) File "A:\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\sampling.py", line 116, in acn_sample return orig_comfy_sample(model, *args, kwargs) File "A:\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\utils.py", line 117, in uncond_multiplier_check_cn_sample return orig_comfy_sample(model, *args, *kwargs) File "A:\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 "A:\ComfyUI\custom_nodes\ComfyUI_smZNodes\smZNodes.py", line 118, in KSampler_sample return orig_fn(args, kwargs) File "A:\ComfyUI\comfy\samplers.py", line 855, 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 "A:\ComfyUI\custom_nodes\ComfyUI-BrushNet\model_patch.py", line 126, in modified_sample return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) File "A:\ComfyUI\comfy\samplers.py", line 740, in sample output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) File "A:\ComfyUI\comfy\samplers.py", line 719, in inner_sample samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "A:\ComfyUI\custom_nodes\ComfyUI_smZNodes\smZNodes.py", line 101, in KSAMPLER_sample return orig_fn(args, kwargs) File "A:\ComfyUI\comfy\samplers.py", line 624, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, self.extra_options) File "A:\ComfyUI\python\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context return func(args, kwargs) File "A:\ComfyUI\comfy\k_diffusion\sampling.py", line 821, in sample_dpmpp_2m_sde_gpu return sample_dpmpp_2m_sde(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, eta=eta, s_noise=s_noise, noise_sampler=noise_sampler, solver_type=solver_type) File "A:\ComfyUI\python\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context return func(*args, *kwargs) File "A:\ComfyUI\comfy\k_diffusion\sampling.py", line 724, in sample_dpmpp_2m_sde denoised = model(x, sigmas[i] s_in, extra_args) File "A:\ComfyUI\comfy\samplers.py", line 299, in call out = self.inner_model(x, sigma, model_options=model_options, seed=seed) File "A:\ComfyUI\comfy\samplers.py", line 706, in call return self.predict_noise(*args, kwargs) File "A:\ComfyUI\comfy\samplers.py", line 709, 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 "A:\ComfyUI\custom_nodes\ComfyUI_smZNodes\smZNodes.py", line 176, in sampling_function out = orig_fn(args, kwargs) File "A:\ComfyUI\comfy\samplers.py", line 279, in sampling_function out = calc_cond_batch(model, conds, x, timestep, model_options) File "A:\ComfyUI\comfy\samplers.py", line 226, in calc_cond_batch output = model_options['model_function_wrapper'](model.apply_model, {"input": inputx, "timestep": timestep, "c": c, "cond_or_uncond": cond_or_uncond}).chunk(batch_chunks) File "A:\ComfyUI\custom_nodes\ComfyUI-BrushNet\model_patch.py", line 58, in brushnet_model_function_wrapper return apply_model_method(x, timestep, options_dict['c']) File "A:\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\utils.py", line 69, in apply_model_uncond_cleanup_wrapper return orig_apply_model(self, args, kwargs) File "A:\ComfyUI\comfy\model_base.py", line 144, in apply_model model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, extra_conds).float() File "A:\ComfyUI\python\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "A:\ComfyUI\python\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(args, kwargs) File "A:\ComfyUI\custom_nodes\SeargeSDXL\modules\custom_sdxl_ksampler.py", line 71, in new_unet_forward x0 = old_unet_forward(self, x, timesteps, context, y, control, transformer_options, kwargs) File "A:\ComfyUI\custom_nodes\FreeU_Advanced\nodes.py", line 176, in tempforward 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 "A:\ComfyUI\comfy\ldm\modules\diffusionmodules\openaimodel.py", line 44, in forward_timestep_embed x = layer(x, context, transformer_options) File "A:\ComfyUI\python\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "A:\ComfyUI\python\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(args, kwargs) File "A:\ComfyUI\custom_nodes\ComfyUI-BrushNet\brushnet_nodes.py", line 1057, in forward_patched_by_brushnet h += to_add.to(h.dtype).to(h.device) RuntimeError: The size of tensor a (640) must match the size of tensor b (320) at non-singleton dimension 1

Orenji-Tangerine commented 3 days ago

136 -> This seems to do the trick...

image

kanxun88 commented 3 days ago

![Uploading 微信截图_20241110194413.png…]()

AlonDan commented 2 days ago

I have the exact same issue, any simple solution?