From bb7f84b99baed86880f0fb8fdbb808252342aea3 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 28 Aug 2024 10:58:54 -0400 Subject: [PATCH] better api defaults --- modules/api/models.py | 6 +++--- modules/processing_helpers.py | 5 ++++- scripts/face_details.py | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/api/models.py b/modules/api/models.py index 5813fdcc6..4aba4fb01 100644 --- a/modules/api/models.py +++ b/modules/api/models.py @@ -201,7 +201,7 @@ ReqTxt2Img = PydanticModelGenerator( "StableDiffusionProcessingTxt2Img", StableDiffusionProcessingTxt2Img, [ - {"key": "sampler_index", "type": str, "default": "Euler"}, + {"key": "sampler_index", "type": str, "default": "UniPC"}, {"key": "script_name", "type": str, "default": None}, {"key": "script_args", "type": list, "default": []}, {"key": "send_images", "type": bool, "default": True}, @@ -222,9 +222,9 @@ ReqImg2Img = PydanticModelGenerator( "StableDiffusionProcessingImg2Img", StableDiffusionProcessingImg2Img, [ - {"key": "sampler_index", "type": str, "default": "Euler"}, + {"key": "sampler_index", "type": str, "default": "UniPC"}, {"key": "init_images", "type": list, "default": None}, - {"key": "denoising_strength", "type": float, "default": 0.75}, + {"key": "denoising_strength", "type": float, "default": 0.5}, {"key": "mask", "type": str, "default": None}, {"key": "include_init_images", "type": bool, "default": False, "exclude": True}, {"key": "script_name", "type": str, "default": None}, diff --git a/modules/processing_helpers.py b/modules/processing_helpers.py index ef5b9ee55..47839ed43 100644 --- a/modules/processing_helpers.py +++ b/modules/processing_helpers.py @@ -538,7 +538,10 @@ def save_intermediate(p, latents, suffix): def update_sampler(p, sd_model, second_pass=False): sampler_selection = p.hr_sampler_name if second_pass else p.sampler_name if hasattr(sd_model, 'scheduler'): - sampler = sd_samplers.all_samplers_map.get(sampler_selection, None) + if sampler_selection is None or sampler_selection == 'None': + sampler = sd_samplers.all_samplers_map.get("UniPC") + else: + sampler = sd_samplers.all_samplers_map.get(sampler_selection, None) if sampler is None: shared.log.warning(f'Sampler: sampler="{sampler_selection}" not found') sampler = sd_samplers.all_samplers_map.get("UniPC") diff --git a/scripts/face_details.py b/scripts/face_details.py index b68d197db..1a1fce944 100644 --- a/scripts/face_details.py +++ b/scripts/face_details.py @@ -140,6 +140,7 @@ class FaceRestorerYolo(FaceRestoration): } if args['denoising_strength'] == 0: shared.log.debug('Face HiRes skip: strength=0') + return np_image control_pipeline = None orig_class = shared.sd_model.__class__ if getattr(p, 'is_control', False):