mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user