Reset parameters.
(self)
| 169 | self.weight.data = self.weight.data.T |
| 170 | |
| 171 | def reset_parameters(self): |
| 172 | """Reset parameters.""" |
| 173 | nn.Linear.reset_parameters(self) |
| 174 | if hasattr(self, "lora_A"): |
| 175 | # initialize A the same way as the default for nn.Linear and B to zero |
| 176 | nn.init.kaiming_uniform_(self.lora_A, a=math.sqrt(5)) |
| 177 | nn.init.zeros_(self.lora_B) |
| 178 | |
| 179 | def train(self, mode: bool = True): |
| 180 | """Train. |
no outgoing calls
no test coverage detected