ComfyUI Node: Loop Safe Accumulator

Class Name

LoopSafeAccumulator

Category
Shrug Nodes/Core
Author
fblissjr (Account age: 4014days)
Extension
Shrug-Prompter: Unified VLM Integration for ComfyUI
Latest Updated
2025-09-30
Github Stars
0.02K

How to Install Shrug-Prompter: Unified VLM Integration for ComfyUI

Install this extension via the ComfyUI Manager by searching for Shrug-Prompter: Unified VLM Integration for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Shrug-Prompter: Unified VLM Integration for ComfyUI in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Loop Safe Accumulator Description

Facilitates safe data accumulation in loops, avoiding circular dependencies in AI workflows.

Loop Safe Accumulator:

The LoopSafeAccumulator is a specialized node designed to facilitate the accumulation of data within ForLoop structures in a safe and efficient manner. Its primary purpose is to maintain state across multiple iterations of a loop without creating circular dependencies, which can often lead to errors or inefficient processing. This node is particularly beneficial in scenarios where you need to gather and manage data iteratively, ensuring that each piece of data is stored and accessible throughout the loop's execution. By using this node, you can effectively manage and accumulate items, making it an essential tool for tasks that require iterative data processing within AI art generation workflows.

Loop Safe Accumulator Input Parameters:

item

The item parameter is a required input that specifies the data to be accumulated during each iteration of the loop. It accepts a string value, which represents the item you wish to add to the accumulator. This parameter is crucial as it determines what data is being collected and stored across the loop's iterations.

loop_id

The loop_id parameter is a required input that identifies the specific loop instance for which the accumulation is being performed. It accepts a string value and defaults to "default". This parameter allows you to manage multiple accumulators simultaneously by assigning a unique identifier to each loop, ensuring that data is correctly associated with its respective loop.

reset

The reset parameter is a required boolean input that determines whether the accumulator should be reset at the start of the loop. It defaults to False. When set to True, it clears the existing data in the accumulator for the specified loop_id, allowing you to start fresh with each new loop execution. This is useful for ensuring that previous data does not interfere with new iterations.

seed

The seed parameter is an optional integer input that provides an additional layer of uniqueness to the accumulator's key. It defaults to 0. By using a seed, you can further differentiate accumulators, especially when running multiple loops with the same loop_id. This parameter is helpful in scenarios where you need to ensure that accumulators remain distinct across different loop executions.

Loop Safe Accumulator Output Parameters:

accumulator

The accumulator output parameter provides the accumulated data collected during the loop's execution. It returns a dictionary containing two keys: items, which is a list of all accumulated items, and metadata, which holds additional information about the accumulation process. This output is essential for accessing the collected data after the loop has completed, allowing you to utilize it in subsequent processing steps or analyses.

Loop Safe Accumulator Usage Tips:

  • To ensure that your accumulator starts with a clean state, set the reset parameter to True at the beginning of your loop. This will clear any previous data and prevent unintended carryover between loop executions.
  • Use unique loop_id values when running multiple loops simultaneously to avoid data conflicts and ensure that each loop's data is stored separately.
  • Consider using the seed parameter to further differentiate accumulators when running similar loops with the same loop_id, especially in complex workflows where multiple accumulators are needed.

Loop Safe Accumulator Common Errors and Solutions:

Accumulator not found for loop_id

  • Explanation: This error occurs when the specified loop_id does not match any existing accumulator, possibly due to a typo or incorrect loop_id.
  • Solution: Double-check the loop_id value to ensure it matches the intended accumulator. If necessary, reset the accumulator to create a new one with the correct loop_id.

Accumulated data is incorrect or incomplete

  • Explanation: This issue may arise if the reset parameter is not set correctly, leading to data from previous iterations being included in the current accumulation.
  • Solution: Ensure that the reset parameter is set to True at the start of each loop execution to clear any old data and start fresh with each iteration.

Loop Safe Accumulator Related Nodes

Go back to the extension to check out more related nodes.
Shrug-Prompter: Unified VLM Integration for ComfyUI
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Loop Safe Accumulator