From 4aca63e841abc36fa5e30523038c40fa81ecaf31 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sat, 9 May 2026 15:55:27 +0100 Subject: [PATCH] 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. --- modules/lora/network_oft.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lora/network_oft.py b/modules/lora/network_oft.py index e2e61ad45..533cb97b7 100644 --- a/modules/lora/network_oft.py +++ b/modules/lora/network_oft.py @@ -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