ComfyUI  >  Nodes  >  ControlFlowUtils >  🔄 Cycle

ComfyUI Node: 🔄 Cycle

Class Name

Cycle

Category
🐺 VykosX-ControlFlowUtils
Author
VykosX (Account age: 2024 days)
Extension
ControlFlowUtils
Latest Updated
10/1/2024
Github Stars
0.1K

How to Install ControlFlowUtils

Install this extension via the ComfyUI Manager by searching for  ControlFlowUtils
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ControlFlowUtils 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

🔄 Cycle Description

Facilitates iterative processing in AI art workflows, enabling loops to pass information between prompts.

🔄 Cycle:

The Cycle node is designed to facilitate iterative processing within your AI art workflows. It allows you to create loops that execute each time a prompt is run, enabling you to pass information forward into subsequent prompts. This iterative approach is particularly useful for workflows that require repeated processing steps, such as refining an image or applying multiple filters. The Cycle node initiates with a 'DRY RUN' where all inputs are set to None, allowing you to reset variables or states at the beginning of each cycle. You can configure the loop to start, end, and step through values as needed, and choose whether the loop should automatically reset to the start value or continue indefinitely.

🔄 Cycle Input Parameters:

start

The initial value for the loop counter. This parameter sets the starting point of the cycle and determines the initial index value. It is an integer value that you can set based on where you want your loop to begin. For example, if you want your loop to start at 0, you would set this parameter to 0.

step

A positive or negative offset to apply to the loop counter on each iteration. This parameter controls how much the loop counter increments or decrements with each cycle. It is an integer value that can be adjusted to control the pace of the loop. For instance, setting it to 1 will increment the counter by 1 each time, while setting it to -1 will decrement the counter by 1.

end

The value at which the cycle will be considered complete, and the Finish flag will be set. This parameter defines the endpoint of the loop. Once the loop counter reaches or surpasses this value, the cycle is marked as finished. It is an integer value that you can set based on your desired endpoint for the loop.

manual_reset

A boolean parameter that, when toggled, causes the next cycle to be a 'DRY RUN' and re-initializes all parameters. This means that the Index, Data, and Aux_Data will be set to None for the initial execution. This is useful for resetting the state of your workflow whenever a fresh cycle starts.

auto_reset

A boolean parameter that specifies whether the Cycle should reset to the original start value once the cycle is complete or keep cycling indefinitely. If set to True, the loop will automatically reset to the start value after reaching the end value. If set to False, the loop will continue to apply the step value to the index on each iteration without resetting.

🔄 Cycle Output Parameters:

index

The current value of the loop counter before Step is applied. This output allows you to track the progress of the loop and use the current index value in your workflow. It is an integer value that updates with each iteration of the loop.

finished

A boolean output that returns True if the loop counter has reached or surpassed the value specified by the end parameter. This output indicates whether the cycle has completed its iterations. It can be used to trigger other actions or nodes in your workflow once the loop is finished.

🔄 Cycle Usage Tips:

  • Use the manual_reset parameter to ensure that your workflow resets variables or states at the beginning of each new cycle.
  • Adjust the step parameter to control the pace of your loop, whether you need it to increment or decrement by specific values.
  • Utilize the finished output to trigger subsequent actions or nodes once the cycle has completed its iterations.
  • Enable auto_reset if you need the loop to restart automatically after reaching the end value, which is useful for continuous processing tasks.

🔄 Cycle Common Errors and Solutions:

CYCLE [unique_id] NOT PROPERLY CLOSED. PLEASE CONNECT THE CYCLE NODES CORRECTLY!

  • Explanation: This error occurs when the Cycle nodes are not connected correctly, causing the loop to be improperly closed.
  • Solution: Ensure that the CYCLE output of the Cycle node is connected to the CYCLE input of a Cycle Continue node to properly establish the loop.

Index is None

  • Explanation: This error indicates that the index value is None, which typically happens during the 'DRY RUN' phase or if the index was not initialized correctly.
  • Solution: Verify that the start parameter is set correctly and that the loop is initialized properly. If using manual_reset, ensure it is toggled appropriately to reset the cycle.

Unexpected behavior in loop iteration

  • Explanation: This can occur if the step, start, or end parameters are not set correctly, leading to unexpected loop behavior.
  • Solution: Double-check the values of the start, step, and end parameters to ensure they are set as intended. Adjust them to match the desired loop behavior.

Auto-reset not functioning

  • Explanation: This error occurs if the auto_reset parameter is not enabling the loop to reset automatically after completion.
  • Solution: Ensure that the auto_reset parameter is set to True if you want the loop to reset automatically. Verify that the end parameter is correctly defined to trigger the reset.

🔄 Cycle Related Nodes

Go back to the extension to check out more related nodes.
ControlFlowUtils
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.