MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / map_from

Method map_from

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

Source from the content-addressed store, hash-verified

48 )
49
50 def map_from(module, state_dict, *args, **kwargs):
51 all_keys = list(state_dict.keys())
52 for key in all_keys:
53 replace_key = remap_key(key, state_dict)
54 new_key = key.replace(replace_key, f"layers.{module.rev_mapping[replace_key]}")
55 state_dict[new_key] = state_dict[key]
56 del state_dict[key]
57
58 self._register_state_dict_hook(map_to)
59 self._register_load_state_dict_pre_hook(map_from, with_module=True)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected