mirror of
https://github.com/vladmandic/automatic
synced 2026-09-17 08:19:11 +02:00
fix sampler defaults, facehires strength check
This commit is contained in:
+6
-4
@@ -4,7 +4,7 @@
|
||||
|
||||
- StableDiffusion 3
|
||||
|
||||
## Update for 2024-06-08
|
||||
## Update for 2024-06-11
|
||||
|
||||
*Note*: New features require `diffusers==0.29.0.dev`
|
||||
|
||||
@@ -72,12 +72,14 @@
|
||||
|
||||
## Fixes
|
||||
|
||||
- cumulative fixes since the last release
|
||||
- cumulative fixes since the last release
|
||||
- fix apply/unapply hidiffusion for sd15
|
||||
- fix controlnet reference enabled check
|
||||
- fix face-hires with control batch count
|
||||
- install pynvml on-demand
|
||||
- apply rollback-vae option to latest torch versions, thanks @Iaotle
|
||||
- install pynvml on-demand
|
||||
- apply rollback-vae option to latest torch versions, thanks @Iaotle
|
||||
- face hires skip if strength is 0
|
||||
- restore all sampler configuration on sampler change
|
||||
|
||||
## Update for 2024-06-02
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ def generate(args): # pylint: disable=redefined-outer-name
|
||||
options['sampler_name'] = args.sampler
|
||||
options['width'] = int(args.width)
|
||||
options['height'] = int(args.height)
|
||||
options['restore_faces'] = args.faces
|
||||
data = post('/sdapi/v1/txt2img', options)
|
||||
t1 = time.time()
|
||||
if 'images' in data:
|
||||
@@ -71,6 +72,7 @@ if __name__ == "__main__":
|
||||
parser.add_argument('--height', required=False, default=512, help='image height')
|
||||
parser.add_argument('--steps', required=False, default=20, help='number of steps')
|
||||
parser.add_argument('--seed', required=False, default=-1, help='initial seed')
|
||||
parser.add_argument('--faces', action='store_true', help='restore faces')
|
||||
parser.add_argument('--sampler', required=False, default='Euler a', help='sampler name')
|
||||
parser.add_argument('--output', required=False, default=None, help='output image file')
|
||||
parser.add_argument('--model', required=False, help='model name')
|
||||
|
||||
@@ -111,13 +111,22 @@ class DiffusionSampler:
|
||||
return
|
||||
for key, value in config.get('All', {}).items(): # apply global defaults
|
||||
self.config[key] = value
|
||||
debug(f'Sampler: all="{self.config}"')
|
||||
if hasattr(model.scheduler, 'scheduler_config'): # find model defaults
|
||||
orig_config = model.scheduler.scheduler_config
|
||||
else:
|
||||
orig_config = model.scheduler.config
|
||||
if not hasattr(model, 'orig_scheduler'): # store settings from initial scheduler
|
||||
model.orig_scheduler = orig_config.copy()
|
||||
else:
|
||||
for key, value in model.orig_scheduler.items(): # apply scheduler defaults
|
||||
if key in self.config:
|
||||
self.config[key] = value
|
||||
debug(f'Sampler: original="{model.orig_scheduler}"')
|
||||
for key, value in orig_config.items(): # apply model defaults
|
||||
if key in self.config:
|
||||
self.config[key] = value
|
||||
debug(f'Sampler: default="{self.config}"')
|
||||
for key, value in config.get(name, {}).items(): # apply diffusers per-scheduler defaults
|
||||
self.config[key] = value
|
||||
for key, value in kwargs.items(): # apply user args, if any
|
||||
@@ -168,11 +177,13 @@ class DiffusionSampler:
|
||||
# validate all config params
|
||||
signature = inspect.signature(constructor, follow_wrapped=True)
|
||||
possible = signature.parameters.keys()
|
||||
debug(f'Sampler: sampler="{name}" config={self.config} signature={possible}')
|
||||
for key in self.config.copy().keys():
|
||||
if key not in possible:
|
||||
shared.log.warning(f'Sampler: sampler="{name}" config={self.config} invalid={key}')
|
||||
del self.config[key]
|
||||
debug(f'Sampler: name="{name}"')
|
||||
debug(f'Sampler: config={self.config}')
|
||||
debug(f'Sampler: signature={possible}')
|
||||
# shared.log.debug(f'Sampler: sampler="{name}" config={self.config}')
|
||||
self.sampler = constructor(**self.config)
|
||||
# shared.log.debug(f'Sampler: class="{self.sampler.__class__.__name__}" config={self.sampler.config}')
|
||||
|
||||
@@ -137,6 +137,8 @@ class FaceRestorerYolo(FaceRestoration):
|
||||
'width': resolution,
|
||||
'height': resolution,
|
||||
}
|
||||
if args['denoising_strength'] == 0:
|
||||
shared.log.debug('Face HiRes skip: strength=0')
|
||||
control_pipeline = None
|
||||
if getattr(p, 'is_control', False):
|
||||
from modules.control import run
|
||||
|
||||
Reference in New Issue
Block a user