(module, state_dict, *args, **kwargs)
| 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) |
nothing calls this directly
no outgoing calls
no test coverage detected