From 4cb22867c2a8f48472fe409a391ba1dc4541617e Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 7 May 2024 07:54:35 -0400 Subject: [PATCH] Fix ControlNetUnit legacy field alias (#2860) --- internal_controlnet/args.py | 2 +- unit_tests/args_test.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal_controlnet/args.py b/internal_controlnet/args.py index 50e32802e..a32ec5218 100644 --- a/internal_controlnet/args.py +++ b/internal_controlnet/args.py @@ -292,7 +292,7 @@ def legacy_field_alias(cls, values: dict) -> dict: for alias, key in ext_compat_keys.items(): if alias in values: assert key not in values, f"Conflict of field '{alias}' and '{key}'" - values[key] = alias + values[key] = values[alias] cls.cls_logger.warn( f"Deprecated alias '{alias}' detected. This field will be removed on 2024-06-01" f"Please use '{key}' instead." diff --git a/unit_tests/args_test.py b/unit_tests/args_test.py index de9158220..af2529788 100644 --- a/unit_tests/args_test.py +++ b/unit_tests/args_test.py @@ -239,3 +239,7 @@ def test_infotext_parsing(): pixel_perfect=True, control_mode="Balanced", ) == ControlNetUnit.parse(infotext) + + +def test_alias(): + ControlNetUnit.from_dict({"lowvram": True})