MCPcopy Create free account
hub / github.com/KohakuBlueleaf/LyCORIS / apply_to

Method apply_to

lycoris/modules/full.py:108–120  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

106 def org_weight(self, value):
107 self.org_module[0].weight.data.copy_(value)
108
109 def apply_to(self, **kwargs):
110 self.org_forward = self.org_module[0].forward
111 self.org_module[0].forward = self.forward
112 self.weight.data.add_(self.org_module[0].weight.data)
113 self._org_weight = [self.org_module[0].weight.data.cpu().clone()]
114 delattr(self.org_module[0], "weight")
115 if self.org_module[0].bias is not None:
116 self.bias.data.add_(self.org_module[0].bias.data)
117 self.org_bias = [self.org_module[0].bias.data.cpu().clone()]
118 delattr(self.org_module[0], "bias")
119 else:
120 self.org_bias = None
121 self.is_diff = False
122
123 def restore(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected