Giter Site home page Giter Site logo

comfyui-cads's Introduction

Experimental CADS implementation for ComfyUI

Attempts to implement CADS for ComfyUI.

Credit also to the A1111 implementation that I used as a reference.

There isn't any real way to tell what effect CADS will have on your generations, but you can load this example workflow into ComfyUI to compare between CADS and non-CADS generations.

Usage

Apply the node to a model and set noise_scale to a nonzero value. The scale can also be negative, but values too far from 0 will result in garbage unless rescale is also used.

The rescale parameter applies normalization to the noised conditioning and combines them with a weighted sum. It's disabled at 0 and at 1, only the normalized value is used.

The node sets a unet wrapper function, but attempts to preserve any existing wrappers, so apply it after other nodes that set a unet wrapper function, and it might still work.

t1 and t2 affect the scaling of the added noise; after t2, the noise scales down until t1, after which no noise is added anymore and the unnoised prompt is used. The diffusion process runs backwards from 1 to 0, so t2 is greater than t1.

start_step and total_steps are optional values that affect how the noise scaling schedule is calculated. If start_step is greater or equal to total_steps, the algorithm uses the sampler's timestep value instead which is not necessarily linear as it's affected by the sampler scheduler.

apply_to allows you to apply the noise selectively, defaulting to uncond. key selects where to add the noise.

noise_type determines the probability distribution of the generated noise.

Bugs

Noise was previously applied to cross attention. It's now applied by default to the regular conditioning y, which seems to make more sense. Use the key parameter to restore the old behaviour.

The implementation might not be correct at all; I'm not 100% clear on the math as to where the noise is actually supposed to be added. and I couldn't make it produce quite the same results as the A1111 node. The algorithm still seems to help with variety though.

comfyui-cads's People

Contributors

asagi4 avatar blepping avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.