ComfyUI_UltimateSDUpscale icon indicating copy to clipboard operation
ComfyUI_UltimateSDUpscale copied to clipboard

Upscaler does not work with Nano Banana which outputs a tensor file. (recommended change)

Open fredlef opened this issue 3 months ago • 3 comments

Hi - I ran into an integration issue when feeding images from Gemini/Nano Banana nodes into Ultimate SD Upscale in ComfyUI.

Those nodes output BHWC tensors instead of ComfyUI’s normal IMAGE list, which caused shape errors in the existing UltimateSDUpscaleCustomSample.

To solve this without breaking backwards compatibility, I added a new node class: (with help from ChatGPT)

UltimateSDUpscaleCustomSampleTensor (displayed as Ultimate SD Upscale (Tensor))

identical to the existing “Custom Sample” node but its image input is declared as "TENSOR" instead of "IMAGE".

That way, workflows using IMAGE stay the same, but advanced users can directly wire in BHWC tensor outputs.

Would you be open to including this as a standard node in the repo? The patch is minimal and keeps all existing behavior intact.

Please see the change to the nodes.py file. Thanks!

nodes.py

fredlef avatar Sep 28 '25 23:09 fredlef

Sorry, I don't understand the problem. An error log would be helpful to clarify. This node currently takes a tensor in BHWC format as input, so if the Gemini/Nano Banana nodes output a BHWC tensor, it should be compatible.

ssitu avatar Sep 29 '25 03:09 ssitu

Here you go - thanks.

got prompt Executing prompt: 19a7661b-4e55-48fe-b7cc-52142041519a !!! Exception during processing !!! 'list' object has no attribute 'ndim' Traceback (most recent call last): File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\execution.py", line 496, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\execution.py", line 315, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\execution.py", line 289, in _async_map_node_over_list await process_inputs(input_dict, i) File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\execution.py", line 277, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\custom_nodes\comfyui_ultimatesdupscale\nodes.py", line 215, in upscale return super().upscale(image, model, positive, negative, vae, upscale_by, seed, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\custom_nodes\comfyui_ultimatesdupscale\nodes.py", line 133, in upscale shared.batch = [tensor_to_pil(image, i) for i in range(len(image))] ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fredlef\Documents\comfyui312\ComfyUI\custom_nodes\comfyui_ultimatesdupscale\utils.py", line 17, in tensor_to_pil if t.ndim == 4: ^^^^^^ AttributeError: 'list' object has no attribute 'ndim'

Prompt executed in 0.05 seconds +---------+-------------------------------+----------+-----------+ | Node ID | Type | Time (s) | VRAM (GB) | +---------+-------------------------------+----------+-----------+ | #207 | UltimateSDUpscaleCustomSample | 0.02 | 0.00 | | TOTAL | - | 0.59 | - | +---------+-------------------------------+----------+-----------+ No pending upload


fredlef avatar Sep 29 '25 21:09 fredlef

Is that the full error log? It seems to have inconsistencies. Are you using reference latents for conditioning?

ssitu avatar Sep 30 '25 03:09 ssitu