diff --git a/aaaaaa/helper.py b/aaaaaa/helper.py index aa9f7f6..2bcda32 100644 --- a/aaaaaa/helper.py +++ b/aaaaaa/helper.py @@ -2,7 +2,7 @@ from __future__ import annotations from contextlib import contextmanager from copy import copy -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any import torch @@ -53,3 +53,7 @@ def preseve_prompts(p: PT): finally: p.all_prompts = all_pt p.all_negative_prompts = all_ng + + +def copy_extra_params(extra_params: dict[str, Any]) -> dict[str, Any]: + return {k: v for k, v in extra_params.items() if not callable(v)} diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index 2c6cc90..7c4810c 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -16,7 +16,12 @@ from PIL import Image, ImageChops from rich import print import modules -from aaaaaa.helper import change_torch_load, pause_total_tqdm, preseve_prompts +from aaaaaa.helper import ( + change_torch_load, + copy_extra_params, + pause_total_tqdm, + preseve_prompts, +) from aaaaaa.p_method import ( get_i, is_img2img_inpaint, @@ -496,7 +501,7 @@ class AfterDetailerScript(scripts.Script): height=height, restore_faces=args.ad_restore_face, tiling=p.tiling, - extra_generation_params=p.extra_generation_params.copy(), + extra_generation_params=copy_extra_params(p.extra_generation_params), do_not_save_samples=True, do_not_save_grid=True, override_settings=override_settings,