Skip to content

Commit 4330a74

Browse files
DN6sayakpaul
andauthored
[Tests] Fix ControlNet Single File tests (huggingface#7315)
* update * update --------- Co-authored-by: Sayak Paul <[email protected]>
1 parent 76de6a0 commit 4330a74

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/pipelines/controlnet/test_controlnet.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,13 @@ def test_single_file_component_configs(self):
10921092
for param_name, param_value in single_file_pipe.controlnet.config.items():
10931093
if param_name in PARAMS_TO_IGNORE:
10941094
continue
1095+
1096+
# This parameter doesn't appear to be loaded from the config.
1097+
# So when it is registered to config, it remains a tuple as this is the default in the class definition
1098+
# from_pretrained, does load from config and converts to a list when registering to config
1099+
if param_name == "conditioning_embedding_out_channels" and isinstance(param_value, tuple):
1100+
param_value = list(param_value)
1101+
10951102
assert (
10961103
pipe.controlnet.config[param_name] == param_value
10971104
), f"{param_name} differs between single file loading and pretrained loading"

tests/pipelines/controlnet/test_controlnet_sdxl.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,11 @@ def test_single_file_component_configs(self):
10021002
for param_name, param_value in single_file_pipe.unet.config.items():
10031003
if param_name in PARAMS_TO_IGNORE:
10041004
continue
1005+
1006+
# Upcast attention might be set to None in a config file, which is incorrect. It should default to False in the model
1007+
if param_name == "upcast_attention" and pipe.unet.config[param_name] is None:
1008+
pipe.unet.config[param_name] = False
1009+
10051010
assert (
10061011
pipe.unet.config[param_name] == param_value
10071012
), f"{param_name} differs between single file loading and pretrained loading"

0 commit comments

Comments
 (0)