* Counteract recent bit-rot and churn negatively affecting my PR, as per feedback.

This commit is contained in:
Peter Baylies 2022-09-28 19:47:36 -04:00
parent 6b838c6105
commit d3a4311c3d
7 changed files with 26 additions and 2 deletions

View File

@ -699,6 +699,8 @@ class InvokeAIWebServer:
'variations',
'steps',
'cfg_scale',
'threshold',
'perlin',
'step_number',
'width',
'height',

View File

@ -486,6 +486,8 @@ def parameters_to_generated_image_metadata(parameters):
"variations",
"steps",
"cfg_scale",
"threshold",
"perlin",
"step_number",
"width",
"height",

View File

@ -529,6 +529,18 @@ class Args(object):
type=float,
help='Classifier free guidance (CFG) scale - higher numbers cause generator to "try" harder.',
)
render_group.add_argument(
'--threshold',
default=0.0,
type=float,
help='Latent threshold for classifier free guidance (CFG) - prevent generator from "trying" too hard. Use positive values, 0 disables.',
)
render_group.add_argument(
'--perlin',
default=0.0,
type=float,
help='Perlin noise scale (0.0 - 1.0) - add perlin noise to the initialization instead of the usual gaussian noise.',
)
render_group.add_argument(
'--grid',
'-g',
@ -725,7 +737,7 @@ def metadata_dumps(opt,
# remove any image keys not mentioned in RFC #266
rfc266_img_fields = ['type','postprocessing','sampler','prompt','seed','variations','steps',
'cfg_scale','step_number','width','height','extra','strength']
'cfg_scale','threshold','perlin','step_number','width','height','extra','strength']
rfc_dict ={}

View File

@ -32,6 +32,8 @@ COMMANDS = (
'--iterations','-n',
'--width','-W','--height','-H',
'--cfg_scale','-C',
'--threshold',
'--perlin',
'--grid','-g',
'--individual','-i',
'--init_img','-I',

View File

@ -361,7 +361,7 @@ class Generate:
), '-v --variation_amount must be in [0.0, 1.0]'
assert (
0.0 <= perlin <= 1.0
), '-v --perlin must be in [0.0, 1.0]'
), '--perlin must be in [0.0, 1.0]'
assert (
(embiggen == None and embiggen_tiles == None) or (
(embiggen != None or embiggen_tiles != None) and init_img != None)

View File

@ -31,6 +31,8 @@ class DreamBase():
width: int = 512
height: int = 512
cfg_scale: float = 7.5
threshold: float = 0.0
perlin: float = 0.0
sampler_name: string = 'klms'
seamless: bool = False
model: str = None # The model to use (currently unused)
@ -83,6 +85,8 @@ class DreamBase():
self.width = int(j.get('width'))
self.height = int(j.get('height'))
self.cfg_scale = float(j.get('cfgscale') or j.get('cfg_scale'))
self.threshold = float(j.get('threshold'))
self.perlin = float(j.get('perlin'))
self.sampler_name = j.get('sampler') or j.get('sampler_name')
# model: str = None # The model to use (currently unused)
# embeddings = None # The embeddings to use (currently unused)

View File

@ -363,6 +363,8 @@ class GeneratorService:
fit = None if init_img is None else jobRequest.fit,
iterations = jobRequest.iterations,
cfg_scale = jobRequest.cfg_scale,
threshold = jobRequest.threshold,
perlin = jobRequest.perlin,
width = jobRequest.width,
height = jobRequest.height,
seed = jobRequest.seed,