fix(scripts): copy only non-callable extra params

This commit is contained in:
Dowon
2024-04-14 00:45:23 +09:00
parent a2a49b3137
commit a40c4c77db
2 changed files with 12 additions and 3 deletions

View File

@@ -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)}

View File

@@ -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,