Skip to content

A script for scheduling CFG scale and ETA to change during the denoising steps

License

Notifications You must be signed in to change notification settings

guzuligo/CFG-Schedule-for-Automatic1111-SD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to install

Drop the .py files in your automatic1111 scripts folder.

CFG-Schedule-for-Automatic1111-SD

Note: Works with Eular a. Might not work with the rest of the samplers.

CFG Auto.py

A simplified version. Contains tools to make the small denoising effective. Its main use is to fix img2img drastic change to images and makes it preserve original image features.

Following was set on denising: 0.1 Batch size is used to loop. Batch size:4

Input:index output 00150-2661151044-k-pop star  Red Necktie  Black suit and a white shirt under it

CFG Schedule.py

A script for scheduling CFG scale and ETA to change during the denoising steps

Modified code of https://github.com/tkalayci71/attenuate-cfg-scale
To use: Place the .py file in AUTOMATIC1111\scripts folder
Update: 11/14/2022
  -Now works with all samplers
  -new function x. Example use: x(t,60,70,2) which will map t to be 0 at 60 and 1 and 70, then multipy by 2
  -edit: Indecies can now have more than one index. Example: 0,5:=1 ; 1:10
Update: 11/13/2022

You can now use functions like: 
0:=math.sin(t) , 10:=math.cos(t)
or simply just:
=math.sin(t)

Available variables:
t: current step
T: total steps
e: (1-t/T) which is current ETA
d: denoising strength
pi:pi
cfg: initial CFG
math: The python math module

Available functions:
-From python: min, max, pow, abs
-x(value,min,max,multiply)
  This will take value and make it 0 when <=min, and make it 1 when >=max. Then, multiply result by last argumant.
  If multiply is less than 0, the range becomes 1 to 0 instead



I've tried the following function on 58 steps and it is giving good results:
CFG:
0:=math.fabs( (e*1.4-2)*15);30:5
ETA:
0:=0.01; 20:=e*1.5;10:=e

00031-336559885-car

About

A script for scheduling CFG scale and ETA to change during the denoising steps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages