fix(lora): guard OFT constraint for LyCORIS oft_diag files

LyCORIS files have self.constraint=None (only the kohya path
uses it). Wrap the .to() call to avoid the NoneType AttributeError.
This commit is contained in:
CalamitousFelicitousness
2026-05-09 15:55:27 +01:00
parent bdf2899955
commit 4aca63e841
+1 -1
View File
@@ -55,7 +55,7 @@ class NetworkModuleOFT(network.NetworkModule): # pylint: disable=abstract-method
def calc_updown(self, target):
oft_blocks = self.oft_blocks.to(target.device, dtype=target.dtype)
eye = torch.eye(self.block_size, device=target.device)
constraint = self.constraint.to(target.device)
constraint = self.constraint.to(target.device) if self.constraint is not None else None
if self.is_kohya:
block_Q = oft_blocks - oft_blocks.transpose(1, 2) # ensure skew-symmetric orthogonal matrix