{"id":13769010,"url":"https://github.com/mcmonkeyprojects/sd-dynamic-thresholding","last_synced_at":"2025-05-14T18:04:53.427Z","repository":{"id":74695804,"uuid":"593866517","full_name":"mcmonkeyprojects/sd-dynamic-thresholding","owner":"mcmonkeyprojects","description":"Dynamic Thresholding (CFG Scale Fix) for Stable Diffusion (SwarmUI, ComfyUI, and Auto WebUI)","archived":false,"fork":false,"pushed_at":"2025-03-14T09:33:32.000Z","size":1034,"stargazers_count":1192,"open_issues_count":9,"forks_count":110,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-08T08:11:12.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcmonkeyprojects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mcmonkey4eva"}},"created_at":"2023-01-27T02:23:12.000Z","updated_at":"2025-04-05T06:41:10.000Z","dependencies_parsed_at":"2023-09-22T04:39:42.877Z","dependency_job_id":"efa42091-5c1e-4373-830c-38a7625bbcc8","html_url":"https://github.com/mcmonkeyprojects/sd-dynamic-thresholding","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmonkeyprojects%2Fsd-dynamic-thresholding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmonkeyprojects%2Fsd-dynamic-thresholding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmonkeyprojects%2Fsd-dynamic-thresholding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmonkeyprojects%2Fsd-dynamic-thresholding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcmonkeyprojects","download_url":"https://codeload.github.com/mcmonkeyprojects/sd-dynamic-thresholding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:00:15.062Z","updated_at":"2025-05-14T18:04:48.417Z","avatar_url":"https://github.com/mcmonkeyprojects.png","language":"Python","funding_links":["https://github.com/sponsors/mcmonkey4eva"],"categories":["GitHub projects","All Workflows Sorted by GitHub Stars","Workflows (3395) sorted by GitHub Stars"],"sub_categories":[],"readme":"# Stable Diffusion Dynamic Thresholding (CFG Scale Fix)\n\n### Concept\n\nExtension for [SwarmUI](https://github.com/mcmonkeyprojects/SwarmUI), [ComfyUI](https://github.com/comfyanonymous/ComfyUI), and [AUTOMATIC1111 Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) that enables a way to use higher CFG Scales without color issues.\n\nThis works by clamping latents between steps. You can read more [here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/3962) or [here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/3268) or [this tweet](https://twitter.com/Birchlabs/status/1582165379832348672).\n\n--------------\n\n### Credit\n\nThe core functionality of this PR was originally developed by [Birch-san](https://github.com/Birch-san) and ported to the WebUI by [dtan3847](https://github.com/dtan3847), then converted to an Auto WebUI extension and given a UI by [mcmonkey4eva](https://github.com/mcmonkey4eva), further development and research done by [mcmonkey4eva](https://github.com/mcmonkey4eva) and JDMLeverton. Ported by ComfyUI by [TwoDukes](https://github.com/TwoDukes) and [mcmonkey4eva](https://github.com/mcmonkey4eva). Ported to SwarmUI by [mcmonkey4eva](https://github.com/mcmonkey4eva).\n\n--------------\n\n### Examples\n\n![img](github/cat_demo_1.jpg)\n\n![img](github/ui.png)\n\n\n--------------\n\n### Demo Grid\n\nView at \u003chttps://sd.mcmonkey.org/dynthresh/\u003e.\n\n![img](github/grid_preview.png)\n\n(Was generated via [this YAML config](https://gist.github.com/mcmonkey4eva/fccd29172f44424dfc0217a482c824f6) for the [Infinite Grid Generator](https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script))\n\n--------------\n\n### Installation and Usage\n\n#### SwarmUI\n\n- Supported out-of-the-box on default installations.\n    - If using a custom installation, just make sure the backend you use has this repo installed per the instructions specific to the backend as written below.\n- It's under the \"Display Advanced Options\" parameter checkbox.\n\n#### Auto WebUI\n\n- You must have the [AUTOMATIC1111 Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) already installed and working. Refer to that project's readme for help with that.\n- Open the WebUI, go to the `Extensions` tab\n- -EITHER- Option **A**:\n    - go to the `Available` tab with\n    - click `Load from` (with the default list)\n    - Scroll down to find `Dynamic Thresholding (CFG Scale Fix)`, or use `CTRL+F` to find it\n- -OR- Option **B**:\n    - Click on `Install from URL`\n    - Copy/paste this project's URL into the `URL for extension's git repository` textbox: `https://github.com/mcmonkeyprojects/sd-dynamic-thresholding`\n- Click `Install`\n- Restart or reload the WebUI\n- Go to txt2img or img2img\n- Check the `Enable Dynamic Thresholding (CFG Scale Fix)` box\n- Read the info on-page and set the sliders where you want em.\n- Click generate.\n\n\n#### ComfyUI\n\n- Must have [ComfyUI](https://github.com/comfyanonymous/ComfyUI) already installed and working. Refer to that project's readme for help with that.\n- -EITHER- Option **A**: (TODO: Manager install)\n- -OR- Option **B**:\n    - `cd ComfyUI/custom_nodes`\n    - `git clone https://github.com/mcmonkeyprojects/sd-dynamic-thresholding`\n    - restart ComfyUI\n    - Add node `advanced/mcmonkey/DynamicThresholdingSimple` (or `Full`)\n    - Link your model to the input, and then link the output model to your KSampler's input\n\n![img](github/comfy_node.png)\n\n--------------\n\n### Supported Auto WebUI Extensions\n\n- This can be configured within the [Infinity Grid Generator](https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script#supported-extensions) extension, see the readme of that project for details.\n\n### ComfyUI Compatibility\n\n- This would work with any variant of the `KSampler` node, including custom ones, so long as they do not totally override the internal sampling function (most don't).\n\n----------------------\n\n### Licensing pre-note:\n\nThis is an open source project, provided entirely freely, for everyone to use and contribute to.\n\nIf you make any changes that could benefit the community as a whole, please contribute upstream.\n\n### The short of the license is:\n\nYou can do basically whatever you want, except you may not hold any developer liable for what you do with the software.\n\n### The long version of the license follows:\n\nThe MIT License (MIT)\n\nCopyright (c) 2023 Alex \"mcmonkey\" Goodwin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmonkeyprojects%2Fsd-dynamic-thresholding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcmonkeyprojects%2Fsd-dynamic-thresholding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmonkeyprojects%2Fsd-dynamic-thresholding/lists"}