mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-05-01 03:31:21 +00:00
fix(scripts): copy only non-callable extra params
This commit is contained in:
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
@@ -53,3 +53,7 @@ def preseve_prompts(p: PT):
|
|||||||
finally:
|
finally:
|
||||||
p.all_prompts = all_pt
|
p.all_prompts = all_pt
|
||||||
p.all_negative_prompts = all_ng
|
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)}
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ from PIL import Image, ImageChops
|
|||||||
from rich import print
|
from rich import print
|
||||||
|
|
||||||
import modules
|
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 (
|
from aaaaaa.p_method import (
|
||||||
get_i,
|
get_i,
|
||||||
is_img2img_inpaint,
|
is_img2img_inpaint,
|
||||||
@@ -496,7 +501,7 @@ class AfterDetailerScript(scripts.Script):
|
|||||||
height=height,
|
height=height,
|
||||||
restore_faces=args.ad_restore_face,
|
restore_faces=args.ad_restore_face,
|
||||||
tiling=p.tiling,
|
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_samples=True,
|
||||||
do_not_save_grid=True,
|
do_not_save_grid=True,
|
||||||
override_settings=override_settings,
|
override_settings=override_settings,
|
||||||
|
|||||||
Reference in New Issue
Block a user