Skip to content

VAE Decode Audio (Tiled) ignores user inputted tile_size #12735

Description

@xeinherjer-dev

Custom Node Testing

Expected Behavior

When setting a specific tile_size (e.g., 2048 or 4096) in the VAE Decode Audio (Tiled) node, the backend should correctly apply this value to tile_x for 1D audio processing, allowing for faster and optimized audio decoding.

Actual Behavior

The node completely ignores the UI setting for tile_size and forces the internal tile_x to 256.
As a result:

  • Decoding long audio (e.g., 3+ minutes) is significantly slower than expected because decoding is bottlenecked by the tiny hardcoded 256 chunk size.
  • If a user sets overlap=256 or higher, the app crashes with ValueError: range() arg 3 must not be zero because the internal step size becomes 256 (forced tile_x) - 256 (overlap) = 0.
Image

Steps to Reproduce

1.Load any audio generation workflow (e.g., using ACE Step models).
2.Add a VAE Decode Audio (Tiled) node.
3.Set tile_size: 4096, overlap: 256.
4.Run the prompt.
5.The process crashes with ValueError: range() arg 3 must not be zero.

Debug Logs

!!! Exception during processing !!! range() arg 3 must not be zero
Traceback (most recent call last):
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\execution.py", line 524, 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, v3_data=v3_data)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\execution.py", line 333, 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, v3_data=v3_data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\execution.py", line 307, in _async_map_node_over_list
    await process_inputs(input_dict, i)
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\execution.py", line 295, in process_inputs
    result = f(**inputs)
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy_api\internal\__init__.py", line 149, in wrapped_func
    return method(locked_class, **inputs)
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy_api\latest\_io.py", line 1751, in EXECUTE_NORMALIZED
    to_return = cls.execute(*args, **kwargs)
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_audio.py", line 151, in execute
    return IO.NodeOutput(vae_decode_audio(vae, samples, tile_size, overlap))
                         ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_audio.py", line 99, in vae_decode_audio
    audio = vae.decode_tiled(samples["samples"], tile_y=tile, overlap=overlap).movedim(-1, 1)
            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 992, in decode_tiled
    output = self.decode_tiled_1d(samples, **args)
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 894, in decode_tiled_1d
    return self.process_output(comfy.utils.tiled_scale_multidim(samples, decode_fn, tile=(tile_x,), overlap=overlap, upscale_amount=self.upscale_ratio, out_channels=self.output_channels, output_device=self.output_device))
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\_contextlib.py", line 120, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\xeinh\Documents\Stable-Diffusion\ComfyUI_windows_portable\ComfyUI\comfy\utils.py", line 1114, in tiled_scale_multidim
    positions = [range(0, s.shape[d+2] - overlap[d], tile[d] - overlap[d]) if s.shape[d+2] > tile[d] else [0] for d in range(dims)]
                 ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: range() arg 3 must not be zero

Other

I will submit a PR to fix this issue shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Potential BugUser is reporting a bug. This should be tested.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions