remove excess condition

This commit is contained in:
papuSpartan 2023-04-01 23:47:10 -05:00
parent a609bd56b4
commit c707b7df95

View File

@ -501,9 +501,8 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
if k == 'sd_vae':
sd_vae.reload_vae_weights()
if opts.token_merging:
if p.hr_second_pass_steps < 1 and not opts.token_merging_hr_only:
if opts.token_merging and not opts.token_merging_hr_only:
print("applying token merging to all passes")
tomesd.apply_patch(
p.sd_model,
ratio=opts.token_merging_ratio,
@ -521,6 +520,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
finally:
# undo model optimizations made by tomesd
if opts.token_merging:
print('removing token merging model optimizations')
tomesd.remove_patch(p.sd_model)
# restore opts to original state
@ -961,6 +961,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
# apply token merging optimizations from tomesd for high-res pass
# check if hr_only so we don't redundantly apply patch
if opts.token_merging and opts.token_merging_hr_only:
print("applying token merging for high-res pass")
tomesd.apply_patch(
self.sd_model,
ratio=opts.token_merging_ratio,