From bf6fc93776f393876d64e1813a8ffb5bdbc3d054 Mon Sep 17 00:00:00 2001 From: Dowon Date: Tue, 9 Jan 2024 21:43:02 +0900 Subject: [PATCH 1/6] Revert "fix: prevent chaning values during generation" This reverts commit 2bd4db94d5f36da78b71de0c1bfc7804d990adf2. --- adetailer/ui.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adetailer/ui.py b/adetailer/ui.py index fa28262..539ce82 100644 --- a/adetailer/ui.py +++ b/adetailer/ui.py @@ -202,6 +202,11 @@ def one_ui_group(n: int, is_img2img: bool, webui_info: WebuiInfo): with gr.Group(): controlnet(w, n, is_img2img) + for attr in ALL_ARGS.attrs: + widget = getattr(w, attr) + on_change = partial(on_widget_change, attr=attr) + widget.change(fn=on_change, inputs=[state, widget], outputs=state, queue=False) + all_inputs = [state, *w.tolist()] target_button = webui_info.i2i_button if is_img2img else webui_info.t2i_button target_button.click( From f24921529e7180b53e759a2c26b0657ec17464ff Mon Sep 17 00:00:00 2001 From: Dowon Date: Wed, 10 Jan 2024 22:42:56 +0900 Subject: [PATCH 2/6] chore: update deps --- .pre-commit-config.yaml | 2 +- install.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dbea90d..56f7366 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: mixed-line-ending - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 + rev: v0.1.11 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/install.py b/install.py index 2c9e068..cc7325d 100644 --- a/install.py +++ b/install.py @@ -44,7 +44,7 @@ def run_pip(*args): def install(): deps = [ # requirements - ("ultralytics", "8.0.229", None), + ("ultralytics", "8.1.0", None), ("mediapipe", "0.10.9", None), ("rich", "13.0.0", None), # mediapipe From 4e28d803105b56f8c979f0eb28f49cc1fcf8c30d Mon Sep 17 00:00:00 2001 From: Dowon Date: Wed, 10 Jan 2024 22:43:25 +0900 Subject: [PATCH 3/6] fix: `inpaint_depth` controlnet model exception --- adetailer/ui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adetailer/ui.py b/adetailer/ui.py index 539ce82..57f789f 100644 --- a/adetailer/ui.py +++ b/adetailer/ui.py @@ -71,6 +71,7 @@ def on_generate_click(state: dict, *values: Any): def on_cn_model_update(cn_model_name: str): + cn_model_name = cn_model_name.replace("inpaint_depth", "depth") for t in cn_module_choices: if t in cn_model_name: choices = cn_module_choices[t] From a45740f3ae3064d719f932690b7085a1aed9ef21 Mon Sep 17 00:00:00 2001 From: Dowon Date: Wed, 10 Jan 2024 22:43:56 +0900 Subject: [PATCH 4/6] feat: args dict initializer --- adetailer/ui.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adetailer/ui.py b/adetailer/ui.py index 57f789f..ea78fc7 100644 --- a/adetailer/ui.py +++ b/adetailer/ui.py @@ -85,6 +85,10 @@ def elem_id(item_id: str, n: int, is_img2img: bool) -> str: return f"script_{tap}_adetailer_{item_id}{suf}" +def state_init(w: Widgets) -> dict[str, Any]: + return {attr: getattr(w, attr).value for attr in ALL_ARGS.attrs} + + def adui( num_models: int, is_img2img: bool, @@ -140,7 +144,6 @@ def adui( def one_ui_group(n: int, is_img2img: bool, webui_info: WebuiInfo): w = Widgets() - state = gr.State({}) eid = partial(elem_id, n=n, is_img2img=is_img2img) with gr.Row(): @@ -203,6 +206,8 @@ def one_ui_group(n: int, is_img2img: bool, webui_info: WebuiInfo): with gr.Group(): controlnet(w, n, is_img2img) + state = gr.State(lambda: state_init(w)) + for attr in ALL_ARGS.attrs: widget = getattr(w, attr) on_change = partial(on_widget_change, attr=attr) From 8f6302881a8b295acfb23795ed6146d02469d674 Mon Sep 17 00:00:00 2001 From: Dowon Date: Wed, 10 Jan 2024 22:56:17 +0900 Subject: [PATCH 5/6] fix: copy state dict on change --- adetailer/ui.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adetailer/ui.py b/adetailer/ui.py index ea78fc7..9733aed 100644 --- a/adetailer/ui.py +++ b/adetailer/ui.py @@ -59,6 +59,9 @@ def suffix(n: int, c: str = " ") -> str: def on_widget_change(state: dict, value: Any, *, attr: str): + if "is_api" in state: + state = state.copy() + state.pop("is_api") state[attr] = value return state From 8298a32a34c4553478bc58a232e7c808022e6f74 Mon Sep 17 00:00:00 2001 From: Dowon Date: Wed, 10 Jan 2024 22:59:23 +0900 Subject: [PATCH 6/6] chore: v24.1.1 --- CHANGELOG.md | 8 ++++++++ adetailer/__version__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e872f6d..1513491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2024-01-10 + +- v24.1.1 +- SDNext 호환 업데이트 (issue #466) + - 설정 값 state에 초기값 추가 + - 위젯 값을 변경할 때마다 state도 변경되게 함 (기존에는 생성 버튼을 누를 때 적용되었음) +- `inpaint_depth_hand` 컨트롤넷 모델이 depth 모델로 인식되게 함 (issue #463) + ## 2024-01-04 - v24.1.0 diff --git a/adetailer/__version__.py b/adetailer/__version__.py index 22026e5..9696595 100644 --- a/adetailer/__version__.py +++ b/adetailer/__version__.py @@ -1 +1 @@ -__version__ = "24.1.0" +__version__ = "24.1.1"