MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / map_to

Method map_to

diffusers/src/diffusers/loaders/utils.py:32–39  ·  view source on GitHub ↗
(module, state_dict, *args, **kwargs)

Source from the content-addressed store, hash-verified

30 # we add a hook to state_dict() and load_state_dict() so that the
31 # naming fits with `unet.attn_processors`
32 def map_to(module, state_dict, *args, **kwargs):
33 new_state_dict = {}
34 for key, value in state_dict.items():
35 num = int(key.split(".")[1]) # 0 is always "layers"
36 new_key = key.replace(f"layers.{num}", module.mapping[num])
37 new_state_dict[new_key] = value
38
39 return new_state_dict
40
41 def remap_key(key, state_dict):
42 for k in self.split_keys:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected