MCPcopy Index your code
hub / github.com/huggingface/diffusers / convert

Function convert

scripts/convert_animatediff_sparsectrl_to_diffusers.py:21–30  ·  view source on GitHub ↗
(original_state_dict: Dict[str, nn.Module])

Source from the content-addressed store, hash-verified

19
20
21def convert(original_state_dict: Dict[str, nn.Module]) -> dict[str, nn.Module]:
22 converted_state_dict = {}
23
24 for key in list(original_state_dict.keys()):
25 renamed_key = key
26 for new_name, old_name in KEYS_RENAME_MAPPING.items():
27 renamed_key = renamed_key.replace(new_name, old_name)
28 converted_state_dict[renamed_key] = original_state_dict.pop(key)
29
30 return converted_state_dict
31
32
33def get_args():

Calls 1

popMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…