A ComfyUI custom node designed to apply minimal (or significant!) mathematical alterations to conditioning tensors. This node works directly with the conditioning format, allowing for creative and sometimes unpredictable modifications to your image generation process by subtly (or not-so-subtly) shifting, scaling, and adding noise to the conditioning embeddings.
- Direct Conditioning Modification: Operates on the raw conditioning tensors.
- Scaling: Multiplies conditioning tensor values by a
scale_factor. - Shifting: Adds a
shift_valueto conditioning tensor values. - Noise Injection: Adds Gaussian noise to conditioning tensor values, controlled by
noise_amount. - Targeted Dimensionality: Control the
affected_dimension_ratioto specify what percentage of the embedding dimensions are modified. This allows for fine-grained control over the "chaos." - Reproducibility: Uses a
seedfor consistent random operations (noise and dimension selection). - Safety Check: Includes a NaN/Inf check; if invalid values are produced, the original tensor for that conditioning block is passed through, and a warning is printed to the console.
-
Clone or Download:
- Option 1 (Git): Navigate to your ComfyUI
custom_nodesdirectory (ComfyUI/custom_nodes/) and run:git clone https://github.com/Tenos-ai/Tenos-Chaotic-Conditioning-Discombobulator
- Option 2 (Manual): Download the
Tenos-Conditioning-Discombobulator.pyfile. Place it directly into yourComfyUI/custom_nodes/directory.
- Option 1 (Git): Navigate to your ComfyUI
-
Restart ComfyUI: Ensure ComfyUI is restarted to recognize the new custom node.
Once installed, you can find the "Tenos Chaotic Conditioning Discombobulator" node by:
- Right-clicking on the ComfyUI canvas.
- Navigating to
Add Node->conditioning->modifiers. - Selecting
Tenos Chaotic Conditioning Discombobulator.
Connect a CONDITIONING output from another node (e.g., a CLIPTextEncode node) to the conditioning input of this node. The output CONDITIONING can then be piped into a KSampler or other nodes expecting conditioning data.
conditioning:- Type:
CONDITIONING - Description: The input conditioning data to be modified.
- Type:
scale_factor:- Type:
FLOAT - Description: Multiplies the values of the selected dimensions in the conditioning tensor. Values greater than 1.0 amplify, less than 1.0 attenuate.
- Default:
1.0 - Min:
0.8 - Max:
5.0 - Step:
0.01
- Type:
shift_value:- Type:
FLOAT - Description: Adds this value to the selected dimensions in the conditioning tensor.
- Default:
0.0 - Min:
-5.0 - Max:
5.0 - Step:
0.01
- Type:
noise_amount:- Type:
FLOAT - Description: The standard deviation of Gaussian noise to add to the selected dimensions. Higher values mean more noise.
- Default:
0.0 - Min:
0.0 - Max:
5.0 - Step:
0.005
- Type:
affected_dimension_ratio:- Type:
FLOAT - Description: The ratio of embedding dimensions (within each token's embedding) that will be affected by the scaling, shifting, and noise.
1.0means all dimensions are affected.0.5means a random 50% of dimensions are affected.0.0means no dimensions are affected (operations will effectively be skipped).
- Default:
1.0 - Min:
0.0 - Max:
1.0 - Step:
0.05
- Type:
seed:- Type:
INT - Description: Seed for the random number generator used for noise generation and selecting affected dimensions. A seed of
0typically means no specific seed is set (allowing for varied results on each run), but in this node,0is treated as a specific seed. For truly unseeded behavior (different each run), you would typically need a mechanism to randomize this input (e.g., via ComfyUI's "Seed (INT)" node withcontrol_after_generateset torandomize). This input is forced, requiring user interaction. - Default:
0 - Min:
0 - Max:
2**32 - 1 forceInput:True
- Type:
CONDITIONING:- Type:
CONDITIONING - Description: The modified conditioning data.
- Type:
The node iterates through each conditioning block (which usually consists of a tensor and a dictionary of pooling information) provided in the input conditioning list. For each tensor:
- A clone of the original tensor is made to avoid modifying the input directly.
- Based on
affected_dimension_ratioand theseed, a subset of the embedding dimensions is selected. If the ratio is1.0, all dimensions are selected. - The selected dimensions are then:
- Multiplied by
scale_factor(ifscale_factoris not1.0). - Increased by
shift_value(ifshift_valueis not0.0). - Added with Gaussian noise scaled by
noise_amount(ifnoise_amountis greater than0.0).
- Multiplied by
- A check is performed to ensure no NaN (Not a Number) or Inf (Infinity) values were introduced. If they were, a warning is printed to the console, and the original, unmodified tensor for that block is passed through instead of the corrupted one.
- The (potentially) modified tensor, along with its original associated dictionary, is added to a new list, which becomes the output conditioning.
- Subtle Variations: Use very small
scale_factordeviations (e.g., 0.99 or 1.01), smallshift_value(e.g., +/- 0.01 to 0.05), and tinynoise_amount(e.g., 0.005 to 0.02) to introduce slight, often interesting, variations to your generations without drastically changing the core concept. - Creative Exploration: Larger values can lead to more abstract or "glitchy" results. Experiment!
- Breaking Prompt Inertia: If your prompts seem to be generating very similar images, a small amount of discombobulation might help explore different facets of the latent space.
- Fine-Tuning Effects: Use
affected_dimension_ratioto control the scope of the changes. Affecting only a small percentage of dimensions can lead to more nuanced alterations. - Reproducibility: Always use the
seedinput if you want to get the same "chaotic" effect again. Change the seed for different random alterations. - Console Warnings: Keep an eye on your console for any "NaN or Inf values detected" warnings. This means the modifications were too extreme for that particular tensor, and it was passed through unchanged to prevent errors downstream.