MCPcopy Create free account
hub / github.com/TencentARC/InstantMesh / map_to

Method map_to

zero123plus/pipeline.py:240–247  ·  view source on GitHub ↗
(module, state_dict, *args, **kwargs)

Source from the content-addressed store, hash-verified

238 # we add a hook to state_dict() and load_state_dict() so that the
239 # naming fits with `unet.attn_processors`
240 def map_to(module, state_dict, *args, **kwargs):
241 new_state_dict = {}
242 for key, value in state_dict.items():
243 num = int(key.split(".")[1]) # 0 is always "layers"
244 new_key = key.replace(f"layers.{num}", module.mapping[num])
245 new_state_dict[new_key] = value
246
247 return new_state_dict
248
249 def remap_key(key, state_dict):
250 for k in self.split_keys:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected