Outputs noise

#1
by sal076 - opened

Only outputs noisy images

Same for me. Outputs only latent noise.
Latest comfyui, testing branch of chroma loader (FluxMod).

Hello, could you perhaps try the pull request for Chroma and see if that works? It should work with native ComfyUI nodes when used.

git fetch
git pull
git fetch origin pull/7355/head:chroma-support
git switch chroma-support

If it still outputs noise, I believe it may be related to native FP8 ops. There might be a way to force ComfyUI to not utilize native FP8 operations, such as --fp16-unet as a launch argument? I unfortunately don't have a 4000 series or newer NVIDIA GPU with native FP8, so it's quite difficult for me to get tests done around this.

Don't forget to load with Default as the weight type!

@Clybius , Tried pulling it into two separate ComfyUI installations (one within Stability Matrix, another is portable), got an identical error in both cases (when sampling should normally start):

Maybe I should use a different sampler node?

(Update: nope, the same is with a regular KSampler)

(Update2: same error with a stock 'chroma-unlocked-v26.safetensors', apparently the above PR does not work when using standard comfy 'Load Diffusion Model' on my machine)

(Update3: I guess the error might be somewhere in 'comfy/model_base.py' around line 1150)

ComfyUI Error Report

Error Details

  • Node ID: 97
  • Node Type: SamplerCustomAdvanced
  • Exception Type: KeyError
  • Exception Message: 'attention_mask_img_shape'

Stack Trace

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\execution.py", line 347, 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 "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\execution.py", line 222, 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 "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\execution.py", line 194, in _map_node_over_list
    process_inputs(input_dict, i)

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\execution.py", line 183, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 657, in sample
    samples = guider.sample(noise.generate_noise(latent), latent_image, sampler, sigmas, denoise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise.seed)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\samplers.py", line 1008, in sample
    output = executor.execute(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\patcher_extension.py", line 111, in execute
    return self.original(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\samplers.py", line 976, in outer_sample
    output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\samplers.py", line 948, in inner_sample
    self.conds = process_conds(self.inner_model, noise, self.conds, device, latent_image, denoise_mask, seed)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\samplers.py", line 781, in process_conds
    conds[k] = encode_model_conds(model.extra_conds, conds[k], noise, device, k, latent_image=latent_image, denoise_mask=denoise_mask, seed=seed)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\samplers.py", line 691, in encode_model_conds
    out = model_function(**params)
          ^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\TOOLS\IMAGE_GEN_ETC\ComfyUI_Portable\ComfyUI\comfy\model_base.py", line 1164, in extra_conds
    mask_ref_size = kwargs["attention_mask_img_shape"]
                    ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^

System Information

  • ComfyUI Version: 0.3.30
  • Arguments: ComfyUI\main.py --disable-auto-launch --use-sage-attention --fast --port 8199
  • OS: nt
  • Python Version: 3.12.9 (tags/v3.12.9:fdb8142, Feb 4 2025, 15:27:58) [MSC v.1942 64 bit (AMD64)]
  • Embedded Python: true
  • PyTorch Version: 2.6.0+cu126

Devices

  • Name: cuda:0 NVIDIA GeForce RTX 4070 : cudaMallocAsync
    • Type: cuda
    • VRAM Total: 12878086144
    • VRAM Free: 2462574516
    • Torch VRAM Total: 8959033344
    • Torch VRAM Free: 50444212

Extra relevant section from logs:

2025-04-30T16:03:34.285545 - Requested to load MochiTEModel_
2025-04-30T16:03:35.685135 - loaded completely 9674.8 9083.38671875 True
2025-04-30T16:03:36.736767 - Requested to load Chroma
2025-04-30T16:03:39.861357 - loaded completely 9456.835 8487.729503631592 True

@Clybius , Tried pulling it into two separate ComfyUI installations (one within Stability Matrix, another is portable), got an identical error in both cases (when sampling should normally start):

Ah, use Chroma as the TE model type, should fix that. You also shouldn't need (or be able) to use the padding removal node when that is selected, as it should just work automatically when using the native implementation.

@Clybius , thanks, wrong Text Encoder type got me :)

So the solution is:

  • select proper Chroma text encoder type
  • remove --fast from ComfyUI launch args (this one caused latent noise in output)

Sign up or log in to comment