From b84e0ea78f469e30dd258cd2ff2433459be44292 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 14:05:17 +0000 Subject: [PATCH] Two stages: the latent upscaler list is read again when Settings open Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Tw9fjVWCMpMsh4XkZmnKnh --- modules/sampling/two_stage/__init__.py | 2 +- modules/sampling/two_stage/tests/test_two_stage.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/sampling/two_stage/__init__.py b/modules/sampling/two_stage/__init__.py index 464f2a41..da29e701 100644 --- a/modules/sampling/two_stage/__init__.py +++ b/modules/sampling/two_stage/__init__.py @@ -86,4 +86,4 @@ def install(patcher, values, key): return f"first {steps} step(s) at {size:.0%} of the size" + (f", enlarged by {resize}" if resize else "") -PROVIDES = {"modifier": install} +PROVIDES = {"modifier": install, "setting_options": lambda: {"upscaler": _options()}} diff --git a/modules/sampling/two_stage/tests/test_two_stage.py b/modules/sampling/two_stage/tests/test_two_stage.py index 22ba1373..1073b609 100644 --- a/modules/sampling/two_stage/tests/test_two_stage.py +++ b/modules/sampling/two_stage/tests/test_two_stage.py @@ -142,3 +142,14 @@ def test_the_upscaler_follows_the_latents_dtype(upscaler_file): video = torch.randn(1, 24, 2, 4, 4, device="cpu", dtype=torch.bfloat16) out = stages.enlarge(video, 8, 8, net) assert out.dtype == torch.bfloat16 and out.device == video.device + + +def test_the_upscaler_list_is_read_again_when_settings_open(upscaler_file, tmp_path): + from modules.sampling import two_stage + from safetensors.torch import save_file + assert [o["value"] for o in two_stage.PROVIDES["setting_options"]()["upscaler"]] == [upscaler_file] + save_file({"x": torch.zeros(1)}, str(tmp_path / "later.safetensors")) + import folder_paths + folder_paths.filename_list_cache.pop("latent_upscale_models", None) + now = [o["value"] for o in two_stage.PROVIDES["setting_options"]()["upscaler"]] + assert "later.safetensors" in now