Reset parameters.
(self)
| 293 | self.weight.data = self.weight.data.T |
| 294 | |
| 295 | def reset_parameters(self): |
| 296 | """Reset parameters.""" |
| 297 | nn.Linear.reset_parameters(self) |
| 298 | if hasattr(self, "lora_A"): |
| 299 | # initialize A the same way as the default for nn.Linear and B to zero |
| 300 | nn.init.kaiming_uniform_(self.lora_A, a=math.sqrt(5)) |
| 301 | nn.init.zeros_(self.lora_B) |
| 302 | |
| 303 | def zero_pad(self, x): |
| 304 | """Zero pad. |
no test coverage detected