Update README.md to version 2.0

This commit is contained in:
ChangeTheConstants
2025-12-06 14:59:27 -05:00
committed by GitHub
parent 94a378a944
commit 5b2e89f1d5
+37 -10
View File
@@ -1,31 +1,58 @@
# SeedVarianceEnhancer
SeedVarianceEnhancer is a ComfyUI custom node intended to be used to add diversity to the outputs generated by Z-Image Turbo. It was created as an experiment to compensate for low seed variance, which is when image outputs using the same prompt look very similar despite being generated with different seeds. It works by adding random noise to the text prompt embedding.
# SeedVarianceEnhancer v2.0
SeedVarianceEnhancer is a ComfyUI custom node intended to be used to add diversity to the outputs generated by Z-Image Turbo. It compensates for low seed variance, which is when generated images look very similar despite being generated with different seeds. It works by adding random noise to the embedding for the early generation steps.
## Installation:
Extract the contents of the zip file and place the SeedVarianceEnhancer directory in your ComfyUI/custom_nodes directory. Launch or restart ComfyUI. You will find the SeedVarianceEnhancer inside the conditioning node group.
Extract the contents of the zip file and place the SeedVarianceEnhancer directory in your ComfyUI/custom_nodes directory. Launch or restart ComfyUI. You will find the SeedVarianceEnhancer inside the advanced/conditioning node group.
## Usage:
The SeedVarianceEnhancer node should be placed next in line after the positive prompt "CLIP Text Encode (Prompt)" node. The conditioning output from the SeedVarianceEnhancer should then connect to the sampler's positive prompt input. The default settings should work well with Z-Image turbo.
The node should be placed next in line after the positive prompt "CLIP Text Encode (Prompt)" node. The conditioning output should then connect to the sampler's positive prompt input. The default settings should work well with Z-Image turbo.
The randomize_percent setting determines what percentage of the embedding values will be randomly selected for modification with noise. The strength setting adjusts the scale of the noise being added to the selected values. Setting either randomize_percent or strength to 0 should effectively disable the node. The seed value is independent of the sampler seed, and is used for selecting which values to modify and with what noise. By default, the noise_insert setting is set to "noise on beginning steps," which schedules the noisy embedding to be used only for the beginning steps of image generation. After a percentage of the total number of steps are processed, controlled by the steps_switchover_percent setting, the sampler will switch back to using the original unmodified embedding. The noise_insert setting has two alternate modes: "noise on all steps" and "noise on ending steps." "Noise on all steps" is more aggressive and is known to significantly reduce prompt adherence and text rendering. "Noise on ending steps" is offered as an option for experimentation.
The randomize_percent setting determines what percentage of the embedding values will be randomly selected for modification with noise. The strength setting adjusts the scale of the noise. The seed value determines which values to modify and with what noise. By default, the noise_insert setting is set to "noise on beginning steps." By removing the noise before the end of the generation, the model will have time to pivot back towards prompt adherence. Steps_switchover_percent specifies what percentage of steps are process before switching embeddings. "Noise on all steps" will reduce prompt adherence and text rendering significantly more so. For adjusting to a different step schedule, use this formula to calculate which percentage setting to use: (100/TOTALSTEPS) * STEPS - 1.
Roughly speaking, the randomize_percent setting determines how many parts of the prompt to changed, and the strength setting determines how much to change them by.
Strength values in the range of 15 to 30 and a randomize_percent of 50 are reasonable starting points for use with Z-Image Turbo. The steps_switchover_percent defaults to 20%. Some prompts will benefit from higher or lower settings. Longer more detailed prompts provide more tokens for SeedVarianceEnhancer to manipulate. Somewhat counterintuitively, use with more detailed prompts may result in more diverse outputs.
Strength values in the range of 15 to 30 and a randomize_percent of 50 seem to be reasonable starting points for use with Z-Image Turbo. The effect of the SeedVarianceEnhancer may vary dependent upon the text prompt used. Some prompts will benefit more from higher settings. Longer more detailed prompts provide more tokens for SeedVarianceEnhancer to manipulate. Somewhat counterintuitively, use with more detailed prompts may result in more diverse outputs.
SeedVarianceEnhancer should work with other models, but the strength value may need to be adjusted by orders of magnitude to work as intended. For example, a quick test with Chroma HD revealed that a strength settings in the range of 0-1 may be optimal.
## Advanced usage:
SeedVarianceEnhancer includes an embedding masking feature, which excludes portions of the embedding from exposure to noise. Masking can protect portions of the prompt. The mask_starts_at setting controls wether the masks extends from the beginning or end. Mask_percent controls how far the mask extends. Setting mask_starts_at to beginning and mask_percent to 50 will mask the first half of the prompt. If the prompt is structured so that critical details are in the first half and less important details are in the second, the image generations should more consistently adhere to the critical details.
SeedVarianceEnhancer nodes can be chained together. The noise from each node will add up. The node only uses the first embedding of a conditioning, so chaining to a node set to "noise at end steps" will not work.
Strength values can be set to negative numbers. Doing so inverts the noise added to the embedding.
## Use with other models:
SeedVarianceEnhancer should work with other models, but the strength value may need to be adjusted. The text encoder being used is a major factor. To assist with finding the optimal strength value, the node includes a feature that outputs statistics about the embedding. The standard deviation is usually within an order of magnitude of the optimal strength setting. When log_to_console is set to true, the node will print statistics about the embedding to the console.
## Results:
When using moderate settings, the output images will vary in any number of ways. Anything from viewing angle, lighting, colors, subject, environment, or artistic style could change slightly or completely. As a consequence of the SeedVarianceEnhancer's function, prompt adherence will be reduced relative to the strength of the "randomize_percent" and "strength" settings. This reduced prompt adherence may be desirable to users interested in generating strange or unexpected images. When using high strength and randomize_percent settings, the image may no longer resemble the prompt in any recognizable way. Some of the features in the generated images may turn out to be things that would be difficult to describe with words. It offers the potential to discover unknown capabilities and knowledge within the model.
When used with Z-Image Turbo, the default settings will add a moderate amount of diversity at the cost of a some prompt adherence. Higher "randomize_percent" and "strength," as well as the use of "noise on all steps," will all worsen prompt adherence. The reduced prompt adherence may be desirable to users interested in generating highly diverse, strange, or unexpected images. Using very high settings offers the potential to discover unknown capabilities and knowledge within the model.
## Limitations:
SeedVarianceEnhancer does not correct the underlying limitations of the model. It should be viewed as a clever hack to compensate for those limitations. Reduced prompt adherence, text rendering, and overall image quality are potential side effects of use. SeedVarianceEnhancer does not properly handle all conditioning inputs, such as those containing multiple embeddings, so using it alongside other conditioning nodes will likely result in unexpected behavior.
SeedVarianceEnhancer does not properly handle all conditioning inputs, such as those containing multiple embeddings, so using it alongside other conditioning nodes may result in unexpected behavior.
## Change log:
v1.0 -> v2.0
* cleaned up code structure
* added input validity checks
* widened strength value limits, and increased precision
* revised tooltips text
* added logging to console toggle control
* added statistical analysis of embedding tensor feature
* added "disabled" setting to noise_insert control.
* changed category from conditioning to advanced/conditioning
* implemented the masking feature
## License