MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / split_state_dict_with_prefix

Function split_state_dict_with_prefix

diffsynth/models/utils.py:164–176  ·  view source on GitHub ↗
(state_dict)

Source from the content-addressed store, hash-verified

162
163
164def split_state_dict_with_prefix(state_dict):
165 keys = sorted([key for key in state_dict if isinstance(key, str)])
166 prefix_dict = {}
167 for key in keys:
168 prefix = key if "." not in key else key.split(".")[0]
169 if prefix not in prefix_dict:
170 prefix_dict[prefix] = []
171 prefix_dict[prefix].append(key)
172 state_dicts = []
173 for prefix, keys in prefix_dict.items():
174 sub_state_dict = {key: state_dict[key] for key in keys}
175 state_dicts.append(sub_state_dict)
176 return state_dicts
177
178
179def hash_state_dict_keys(state_dict, with_shape=True):

Callers 2

matchMethod · 0.85
loadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected