(
self,
state_dict,
prefix,
local_metadata,
strict,
missing_keys,
unexpected_keys,
error_msgs,
)
| 132 | sd["diff_b"] = self.bias.data.cpu() - self.org_bias[0] |
| 133 | return sd |
| 134 | |
| 135 | def load_weight_prehook( |
| 136 | self, |
| 137 | state_dict, |
| 138 | prefix, |
| 139 | local_metadata, |
| 140 | strict, |
| 141 | missing_keys, |
| 142 | unexpected_keys, |
| 143 | error_msgs, |
| 144 | ): |
| 145 | diff_weight = state_dict.pop(f"{prefix}diff") |
| 146 | state_dict[f"{prefix}weight"] = diff_weight + self.weight.data.to(diff_weight) |
| 147 | if f"{prefix}diff_b" in state_dict: |
| 148 | diff_bias = state_dict.pop(f"{prefix}diff_b") |
| 149 | state_dict[f"{prefix}bias"] = diff_bias + self.bias.data.to(diff_bias) |
| 150 | |
| 151 | def _org_bias_tensor(self, device=None, dtype=None): |
nothing calls this directly
no outgoing calls
no test coverage detected