update sampler logic

This commit is contained in:
Vladimir Mandic
2023-09-08 17:53:46 -04:00
parent 34ee67477e
commit c98a4ddb6a
2 changed files with 0 additions and 14 deletions
-2
View File
@@ -7,8 +7,6 @@ Mostly a service release
- new option **inference mode**
- default is standard `torch.no_grad`
new option is `torch.inference_only` which is slightly faster and uses less vram, but only works on some gpus
- cache samplers between run
reduces overhead between generate calls slightly
- updated gradio
- clean-up logging
- capture system info in startup log
-12
View File
@@ -34,18 +34,10 @@ def find_sampler_config(name):
return config
last_sampler = None
def create_sampler(name, model):
global last_sampler # pylint: disable=global-statement
if last_sampler is not None and last_sampler.name == name:
return last_sampler
if name == 'Default' and hasattr(model, 'scheduler'):
config = {k: v for k, v in model.scheduler.config.items() if not k.startswith('_')}
shared.log.debug(f'Sampler default {type(model.scheduler).__name__}: {config}')
last_sampler = model.scheduler
last_sampler.name = type(model.scheduler).__name__
return model.scheduler
config = find_sampler_config(name)
if config is None:
@@ -56,8 +48,6 @@ def create_sampler(name, model):
sampler.config = config
sampler.name = name
shared.log.debug(f'Sampler: sampler={sampler.name} config={sampler.config.options}')
last_sampler = sampler
last_sampler.name = sampler.name
return sampler
elif shared.backend == shared.Backend.DIFFUSERS:
sampler = config.constructor(model)
@@ -65,8 +55,6 @@ def create_sampler(name, model):
model.scheduler_config = sampler.sampler.config.copy()
model.scheduler = sampler.sampler
shared.log.debug(f'Sampler: sampler={sampler.name} config={sampler.config}')
last_sampler = sampler.sampler
last_sampler.name = sampler.name
return sampler.sampler
else:
return None