@@ -864,6 +864,8 @@ def get_ids(self, names: Union[str, List[str]] = None, collection: Optional[str]
864864 Get component IDs by a list of names, optionally filtered by collection.
865865 """
866866 ids = set ()
867+ if not isinstance (names , list ):
868+ names = [names ]
867869 for name in names :
868870 ids .update (self ._lookup_ids (name = name , collection = collection ))
869871 return list (ids )
@@ -895,25 +897,15 @@ def get_components_by_names(self, names: List[str], collection: Optional[str] =
895897def summarize_dict_by_value_and_parts (d : Dict [str , Any ]) -> Dict [str , Any ]:
896898 """Summarizes a dictionary by finding common prefixes that share the same value.
897899
898- This function is particularly useful for IP-Adapter attention processor patterns, where multiple
899- attention layers may share the same scale value. It groups dot-separated keys by their values
900- and finds the shortest common prefix for each group.
901-
902- For example, given a dictionary with IP-Adapter attention processor patterns like:
903- {
900+ For a dictionary with dot-separated keys like: {
904901 'down_blocks.1.attentions.1.transformer_blocks.0.attn2.processor': [0.6],
905902 'down_blocks.1.attentions.1.transformer_blocks.1.attn2.processor': [0.6],
906903 'up_blocks.1.attentions.0.transformer_blocks.0.attn2.processor': [0.3],
907- 'up_blocks.1.attentions.0.transformer_blocks.1.attn2.processor': [0.3],
908904 }
909905
910- Returns a dictionary where keys are the shortest common prefixes and values are their shared values:
911- {
912- 'down_blocks.1.attentions.1.transformer_blocks': [0.6],
913- 'up_blocks.1.attentions.0.transformer_blocks': [0.3]
906+ Returns a dictionary where keys are the shortest common prefixes and values are their shared values: {
907+ 'down_blocks': [0.6], 'up_blocks': [0.3]
914908 }
915-
916- This helps identify which attention layers share the same IP-Adapter scale values.
917909 """
918910 # First group by values - convert lists to tuples to make them hashable
919911 value_to_keys = {}
0 commit comments