These scripts allow for dynamic CFG control during generation steps. With the right settings, this could help get the details of high CFG without damaging the generated image even with low denoising in img2img.
Go to file
guzuligo 84892c8892
Update CFG Schedule.py
2023-03-09 13:43:02 +03:00
scripts Update CFG Schedule.py 2023-03-09 13:43:02 +03:00
Examples Update Examples 2022-11-17 07:54:51 +03:00
Experiments Rename Examples2 to Experiments 2022-12-14 20:50:42 +03:00
LICENSE Initial commit 2022-11-12 16:31:11 +03:00
README.md Update README.md 2023-01-20 15:47:31 +03:00

README.md

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