fix refiner batch size

This commit is contained in:
Vladimir Mandic
2023-07-25 07:53:44 -04:00
parent 43b9c52bd4
commit aa62f6d8d4
5 changed files with 13 additions and 10 deletions
+2 -1
View File
@@ -118,7 +118,8 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#txtimg_hr_finalres { max-width: 200px; }
#pnginfo_html2_info { margin-top: -18px; background-color: var(--input-background-fill); padding: var(--input-padding) }
#txt2img_tools > div > button, #img2img_tools > div > button { filter: hue-rotate(180deg) saturate(0.5); }
#txt2img_tools, #img2img_tools { margin-top: -5px; margin-bottom: -5px; }
#txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
#txt2img_styles_row { margin-top: -6px; }
/* custom elements overrides */
#steps-animation, #controlnet { border-width: 0; }
+3 -3
View File
@@ -103,9 +103,9 @@ button.custom-button{
#txt2img_gallery img, #img2img_gallery img, #extras_gallery img { object-fit: scale-down; width: -webkit-fill-available !important; }
#txt2img_footer, #img2img_footer, #extras_footer { height: fit-content; }
#txt2img_footer, #img2img_footer { height: fit-content; display: none; }
#txt2img_generate_box, #img2img_generate_box { gap: 0.5em; flex-wrap: wrap-reverse; }
#txt2img_actions_column, #img2img_actions_column { gap: 0.5em; }
#txt2img_generate_box > button, #img2img_generate_box > button { min-height: 36px; max-height: 42px; }
#txt2img_generate_box, #img2img_generate_box { gap: 0.5em; flex-wrap: wrap-reverse; height: fit-content; }
#txt2img_actions_column, #img2img_actions_column { gap: 0.5em; height: fit-content; }
#txt2img_generate_box > button, #img2img_generate_box > button { min-height: 42px; max-height: 42px; }
#txt2img_generate_line2, #img2img_generate_line2 { display: flex; }
#txt2img_generate_line2 > button, #img2img_generate_line2 > button, #extras_generate_box > button { height: 2.2em; line-height: 0; min-width: unset; display: block !important; }
#txt2img_tools > div, #img2img_tools > div { justify-content: space-around; margin-top: 0.5em; margin-bottom: 0em; }
+2
View File
@@ -150,6 +150,7 @@ class StableDiffusionProcessing:
self.is_hr_pass = False
self.enable_hr = None
self.refiner_denoise_start = 0
self.ops = []
shared.opts.data['clip_skip'] = clip_skip
@property
@@ -480,6 +481,7 @@ def create_infotext(p: StableDiffusionProcessing, all_prompts, all_seeds, all_su
"Denoise end": p.refiner_denoise_end if p.enable_hr else None,
# restore_faces
"Face restoration": shared.opts.face_restoration_model if p.restore_faces else None,
"Operations": ', '.join(p.ops),
}
token_merging_ratio = p.get_token_merging_ratio()
token_merging_ratio_hr = p.get_token_merging_ratio(for_hr=True) if p.enable_hr else None
+5 -5
View File
@@ -171,8 +171,8 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
for i in range(len(output.images)):
pipe_args = set_pipeline_args(
model=shared.sd_refiner,
prompt=[p.refiner_prompt] if len(p.refiner_prompt) > 0 else prompts,
negative_prompt=[p.refiner_negative] if len(p.refiner_negative) > 0 else negative_prompts,
prompt=[p.refiner_prompt] if len(p.refiner_prompt) > 0 else prompts[i],
negative_prompt=[p.refiner_negative] if len(p.refiner_negative) > 0 else negative_prompts[i],
num_inference_steps=p.hr_second_pass_steps,
eta=shared.opts.eta_ddim,
strength=p.denoising_strength,
@@ -184,10 +184,10 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
image=output.images[i],
output_type='latent' if hasattr(shared.sd_refiner, 'vae') else 'np',
)
output = shared.sd_refiner(**pipe_args) # pylint: disable=not-callable
refiner_output = shared.sd_refiner(**pipe_args) # pylint: disable=not-callable
if not shared.state.interrupted and not shared.state.skipped:
output.images = vae_decode(output.images, shared.sd_refiner)
results.append(output.images[i])
refiner_images = vae_decode(refiner_output.images, shared.sd_refiner)
results.append(refiner_images[0])
if shared.opts.diffusers_move_refiner:
shared.log.debug('Diffusers: Moving refiner model to CPU')