Skip to content

Commit

Permalink
Merge pull request #176 from ototadana/fix/hires-fix-checkpoint
Browse files Browse the repository at this point in the history
fix Hires Fix with a custom checkpoint
  • Loading branch information
ototadana authored Nov 24, 2023
2 parents 7ef2935 + f14d59f commit 785768c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/inferencers/img2img_face_processor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Union

from modules.processing import StableDiffusionProcessingImg2Img, process_images
from PIL import Image

from modules.processing import StableDiffusionProcessingImg2Img, process_images
from scripts.entities.face import Face
from scripts.use_cases.face_processor import FaceProcessor

Expand Down Expand Up @@ -36,10 +36,17 @@ def process(
refiner_switch_at = p.refiner_switch_at
p.refiner_switch_at = 0

has_hr_checkpoint_name = p.enable_hr and hasattr(p, "hr_checkpoint_name") and p.hr_checkpoint_name is not None and hasattr(p, "override_settings")
if has_hr_checkpoint_name:
backup_sd_model_checkpoint = p.override_settings.get("sd_model_checkpoint", None)
p.override_settings["sd_model_checkpoint"] = p.hr_checkpoint_name

print(f"prompt for the {face.face_area.tag}: {p.prompt}")

proc = process_images(p)
if use_refiner_model_only:
p.refiner_switch_at = refiner_switch_at
if has_hr_checkpoint_name:
p.override_settings["sd_model_checkpoint"] = backup_sd_model_checkpoint

return proc.images[0]

0 comments on commit 785768c

Please sign in to comment.