mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
fix logger, add hr_steps
This commit is contained in:
parent
d42526f448
commit
af7d7ce951
@ -41,11 +41,12 @@ class DeepCacheSession:
|
||||
if total == 0:
|
||||
return
|
||||
logger = getLogger()
|
||||
logger.log("DeepCache Information :")
|
||||
level = logger.getEffectiveLevel()
|
||||
logger.log(level, "DeepCache Information :")
|
||||
for fail_reasons, count in self.fail_reasons.items():
|
||||
logger.log(f" {fail_reasons}: {count}")
|
||||
logger.log(level, f" {fail_reasons}: {count}")
|
||||
for success_reasons, count in self.success_reasons.items():
|
||||
logger.log(f" {success_reasons}: {count}")
|
||||
logger.log(level, f" {success_reasons}: {count}")
|
||||
|
||||
def deepcache_hook_model(self, unet, params:DeepCacheParams):
|
||||
"""
|
||||
|
@ -13,10 +13,10 @@ class ScriptDeepCache(scripts.Script):
|
||||
def show(self, is_img2img):
|
||||
return scripts.AlwaysVisible
|
||||
|
||||
def get_deepcache_params(self, steps: int) -> DeepCacheParams:
|
||||
def get_deepcache_params(self, steps: int, enable_step_at:int = None) -> DeepCacheParams:
|
||||
return DeepCacheParams(
|
||||
cache_in_level=shared.opts.deepcache_cache_resnet_level,
|
||||
cache_enable_step=int(shared.opts.deepcache_cache_enable_step_percentage * steps),
|
||||
cache_enable_step=int(shared.opts.deepcache_cache_enable_step_percentage * steps) if enable_step_at is None else enable_step_at,
|
||||
full_run_step_rate=shared.opts.deepcache_full_run_step_rate,
|
||||
)
|
||||
|
||||
@ -33,7 +33,9 @@ class ScriptDeepCache(scripts.Script):
|
||||
if not shared.opts.deepcache_hr_reuse:
|
||||
self.detach_deepcache()
|
||||
if shared.opts.deepcache_enable:
|
||||
self.configure_deepcache(self.get_deepcache_params(getattr(p, 'hr_second_pass_steps', 0) or p.steps)) # use second pass steps if available
|
||||
hr_steps = getattr(p, 'hr_second_pass_steps', 0) or p.steps
|
||||
enable_step = int(shared.opts.deepcache_cache_enable_step_percentage_hr * hr_steps)
|
||||
self.configure_deepcache(self.get_deepcache_params(getattr(p, 'hr_second_pass_steps', 0) or p.steps), enable_step_at = enable_step) # use second pass steps if available
|
||||
|
||||
def postprocess_batch(self, p:processing.StableDiffusionProcessing, *args, **kwargs):
|
||||
print("DeepCache postprocess")
|
||||
@ -66,6 +68,7 @@ def on_ui_settings():
|
||||
"deepcache_cache_enable_step_percentage": shared.OptionInfo(0.4, "Deepcaches is enabled after the step percentage", gr.Slider, {"minimum": 0, "maximum": 1}).info("Percentage of initial steps to disable deepcache"),
|
||||
"deepcache_full_run_step_rate": shared.OptionInfo(5, "Refreshes caches when step is divisible by number", gr.Slider, {"minimum": 0, "maximum": 1000, "step": 1}).info("5 = refresh caches every 5 steps"),
|
||||
"deepcache_hr_reuse" : shared.OptionInfo(False, "Reuse for HR").info("Reuses cache information for HR generation"),
|
||||
"deepcache_cache_enable_step_percentage_hr" : shared.OptionInfo(0.0, "Deepcaches is enabled after the step percentage for HR", gr.Slider, {"minimum": 0, "maximum": 1}).info("Percentage of initial steps to disable deepcache for HR generation"),
|
||||
}
|
||||
for name, opt in options.items():
|
||||
opt.section = ('deepcache', "DeepCache")
|
||||
|
Loading…
Reference in New Issue
Block a user