Coder Social home page Coder Social logo

comfyui-adaptive-guidance's Introduction

Adaptive Guidance for ComfyUI

An implementation of adaptive guidance for ComfyUI

See https://bcv-uniandes.github.io/adaptiveguidance-wp/

What

There's an AdaptiveGuidance node (under sampling/custom_sampling/guiders) that can be used with SamplerCustomAdvanced. Normally, you should keep the threshold quite high, between 0.99 and 1.0

The node calculates the cosine similarity between the u-net's conditional and unconditional output ("positive" and "negative" prompts) and once the similarity crosses the specified threshold, it sets CFG to 1.0, effectively skipping negative prompt calculations and speeding up inference.

I'm not sure if the cosine similarity calculation matches the original paper since I had to translate from maths to Python, but it appears to work.

Uncond zero

Set uncond_zero_scale to > 0 to enable "uncond zero" CFG after the normal CFG gets disabled. Stolen from https://github.com/Extraltodeus/Uncond-Zero-for-ComfyUI

It seems to work slightly better than just running without CFG, but YMMV

Note: this functionality is unstable and will probably change, so using it means your workflows likely won't be perfectly reproducible.

comfyui-adaptive-guidance's People

Contributors

asagi4 avatar comfy-pr-bot avatar

Stargazers

 avatar  avatar  avatar Krtolica Vujadin avatar Ray Wang avatar  avatar David Marx avatar Zekaryas avatar syddharth avatar  avatar  avatar  avatar toyxyz avatar Timur Barbashov avatar keil avatar  avatar Lau Van Kiet avatar VALADI K JAGANATHAN avatar

Watchers

 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.