[GH-ISSUE #711] Error occurred when executing KSampler using Preview mode "auto" or RGB #321

Closed
opened 2026-10-27 21:16:09 +00:00 by bsakaguchi · 8 comments
Owner

Originally created by @traugdor on GitHub (May 25, 2024).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/711

!!! Exception during processing!!! Cannot handle this data type: (1, 1, 3), <f4
Traceback (most recent call last):
File "D:\Stable Diffusion\ComfyUI\venv\lib\site-packages\PIL\Image.py", line 3089, in fromarray
mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 3), '<f4')

Traceback (most recent call last):
File "D:\Stable Diffusion\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\Stable Diffusion\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:\Stable Diffusion\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\Stable Diffusion\ComfyUI\nodes.py", line 1344, in sample
return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
File "D:\Stable Diffusion\ComfyUI\nodes.py", line 1314, in common_ksampler
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
File "D:\Stable Diffusion\ComfyUI\comfy\sample.py", line 37, 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:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 761, 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:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 663, in sample
return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 650, in sample
output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 629, in inner_sample
samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 534, 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:\Stable Diffusion\ComfyUI\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\Stable Diffusion\ComfyUI\comfy\k_diffusion\sampling.py", line 140, in sample_euler
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigma_hat, 'denoised': denoised})
File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 532, in
k_callback = lambda x: callback(x["i"], x["denoised"], x["x"], total_steps)
File "D:\Stable Diffusion\ComfyUI\latent_preview.py", line 94, in callback
preview_bytes = previewer.decode_latent_to_preview_image(preview_format, x0)
File "D:\Stable Diffusion\ComfyUI\latent_preview.py", line 19, in decode_latent_to_preview_image
preview_image = self.decode_latent_to_preview(x0)
File "D:\Stable Diffusion\ComfyUI\latent_preview.py", line 48, in decode_latent_to_preview
return Image.fromarray(latents_ubyte.numpy())
File "D:\Stable Diffusion\ComfyUI\venv\lib\site-packages\PIL\Image.py", line 3092, in fromarray
raise TypeError(msg) from e
TypeError: Cannot handle this data type: (1, 1, 3), <f4

Originally created by @traugdor on GitHub (May 25, 2024). Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/711 !!! Exception during processing!!! Cannot handle this data type: (1, 1, 3), <f4 Traceback (most recent call last): File "D:\Stable Diffusion\ComfyUI\venv\lib\site-packages\PIL\Image.py", line 3089, in fromarray mode, rawmode = _fromarray_typemap[typekey] KeyError: ((1, 1, 3), '<f4') Traceback (most recent call last): File "D:\Stable Diffusion\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\Stable Diffusion\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:\Stable Diffusion\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "D:\Stable Diffusion\ComfyUI\nodes.py", line 1344, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "D:\Stable Diffusion\ComfyUI\nodes.py", line 1314, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "D:\Stable Diffusion\ComfyUI\comfy\sample.py", line 37, 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:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 761, 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:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 663, in sample return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 650, in sample output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 629, in inner_sample samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 534, 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:\Stable Diffusion\ComfyUI\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "D:\Stable Diffusion\ComfyUI\comfy\k_diffusion\sampling.py", line 140, in sample_euler callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigma_hat, 'denoised': denoised}) File "D:\Stable Diffusion\ComfyUI\comfy\samplers.py", line 532, in <lambda> k_callback = lambda x: callback(x["i"], x["denoised"], x["x"], total_steps) File "D:\Stable Diffusion\ComfyUI\latent_preview.py", line 94, in callback preview_bytes = previewer.decode_latent_to_preview_image(preview_format, x0) File "D:\Stable Diffusion\ComfyUI\latent_preview.py", line 19, in decode_latent_to_preview_image preview_image = self.decode_latent_to_preview(x0) File "D:\Stable Diffusion\ComfyUI\latent_preview.py", line 48, in decode_latent_to_preview return Image.fromarray(latents_ubyte.numpy()) File "D:\Stable Diffusion\ComfyUI\venv\lib\site-packages\PIL\Image.py", line 3092, in fromarray raise TypeError(msg) from e TypeError: Cannot handle this data type: (1, 1, 3), <f4
Author
Owner

@traugdor commented on GitHub (May 25, 2024):

This error occurs when only the ComfyUI-Manager is installed

<!-- gh-comment-id:2130690500 --> @traugdor commented on GitHub (May 25, 2024): This error occurs when only the ComfyUI-Manager is installed
Author
Owner

@ltdrdata commented on GitHub (May 25, 2024):

Make sure up to date. ComfyUI.
I have confirmed that the issue does not occur in my current updated environment.

<!-- gh-comment-id:2130817552 --> @ltdrdata commented on GitHub (May 25, 2024): Make sure up to date. ComfyUI. I have confirmed that the issue does not occur in my current updated environment.
Author
Owner

@traugdor commented on GitHub (May 25, 2024):

I am using the latest version:

ComfyUI master* $ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        AddPromptToImage.ps1
        comfyui.log
        comfyui.prev.log
        comfyui.prev2.log
        config.json
        pysssss-workflows/
        qmSmartNodesConfig.json
        run.bat
        run.ps1

nothing added to commit but untracked files present (use "git add" to track)

I also updated the ComfyUI-Manager as well and got the same issue.

TypeError: Cannot handle this data type: (1, 1, 3), <f4

Prompt executed in 11.89 seconds

Stopped server
(venv) ComfyUI master* $ cd .\custom_nodes\
(venv) custom_nodes master* $ cd .\ComfyUI-Manager\
(venv) ComfyUI-Manager main $ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
(venv) ComfyUI-Manager main $

I am using a Radeon 6600XT, I don't know if that makes any difference...

<!-- gh-comment-id:2131317653 --> @traugdor commented on GitHub (May 25, 2024): I am using the latest version: ``` ComfyUI master* $ git status On branch master Your branch is up to date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) AddPromptToImage.ps1 comfyui.log comfyui.prev.log comfyui.prev2.log config.json pysssss-workflows/ qmSmartNodesConfig.json run.bat run.ps1 nothing added to commit but untracked files present (use "git add" to track) ``` I also updated the ComfyUI-Manager as well and got the same issue. ``` TypeError: Cannot handle this data type: (1, 1, 3), <f4 Prompt executed in 11.89 seconds Stopped server (venv) ComfyUI master* $ cd .\custom_nodes\ (venv) custom_nodes master* $ cd .\ComfyUI-Manager\ (venv) ComfyUI-Manager main $ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean (venv) ComfyUI-Manager main $ ``` I am using a Radeon 6600XT, I don't know if that makes any difference...
Author
Owner

@ltdrdata commented on GitHub (May 26, 2024):

Execute pip freeze.
What is displayed?

<!-- gh-comment-id:2132050408 --> @ltdrdata commented on GitHub (May 26, 2024): Execute `pip freeze`. What is displayed?
Author
Owner

@ltdrdata commented on GitHub (May 26, 2024):

You should check this issue thread.
https://github.com/comfyanonymous/ComfyUI/issues/3539

<!-- gh-comment-id:2132050928 --> @ltdrdata commented on GitHub (May 26, 2024): You should check this issue thread. https://github.com/comfyanonymous/ComfyUI/issues/3539
Author
Owner

@traugdor commented on GitHub (May 26, 2024):

Execute pip freeze. What is displayed?

Since you asked, but looking at that other thread I see it's no longer relevant, but do you still need this information?

<!-- gh-comment-id:2132224483 --> @traugdor commented on GitHub (May 26, 2024): > Execute `pip freeze`. What is displayed? Since you asked, but looking at that other thread I see it's no longer relevant, but do you still need this information?
Author
Owner

@ltdrdata commented on GitHub (May 26, 2024):

Execute pip freeze. What is displayed?

Since you asked, but looking at that other thread I see it's no longer relevant, but do you still need this information?

No, that's not necessary. You can just keep checking until a solution is posted in that thread.

<!-- gh-comment-id:2132240872 --> @ltdrdata commented on GitHub (May 26, 2024): > > Execute `pip freeze`. What is displayed? > > Since you asked, but looking at that other thread I see it's no longer relevant, but do you still need this information? No, that's not necessary. You can just keep checking until a solution is posted in that thread.
Author
Owner

@traugdor commented on GitHub (May 26, 2024):

A solution was posted, and I have a pending PR on the main ComfyUI repo for it.

<!-- gh-comment-id:2132378934 --> @traugdor commented on GitHub (May 26, 2024): A solution was posted, and I have a pending PR on the main ComfyUI repo for it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#321
No description provided.