Skip to content

Commit adf1a97

Browse files
Suggested changes
Co-Authored-By: Ryan Dick <[email protected]>
1 parent ca21996 commit adf1a97

File tree

1 file changed

+6
-10
lines changed
  • invokeai/backend/stable_diffusion/extensions

1 file changed

+6
-10
lines changed

invokeai/backend/stable_diffusion/extensions/seamless.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def static_patch_model(
3737
yield
3838
return
3939

40+
x_mode = "circular" if "x" in seamless_axes else "constant"
41+
y_mode = "circular" if "y" in seamless_axes else "constant"
42+
4043
# override conv_forward
4144
# https://github.com/huggingface/diffusers/issues/556#issuecomment-1993287019
4245
def _conv_forward_asymmetric(
@@ -51,18 +54,11 @@ def _conv_forward_asymmetric(
5154
)
5255

5356
original_layers: List[Tuple[nn.Conv2d, Callable]] = []
54-
5557
try:
56-
x_mode = "circular" if "x" in seamless_axes else "constant"
57-
y_mode = "circular" if "y" in seamless_axes else "constant"
58-
59-
conv_layers: List[torch.nn.Conv2d] = []
60-
61-
for module in model.modules():
62-
if isinstance(module, torch.nn.Conv2d):
63-
conv_layers.append(module)
58+
for layer in model.modules():
59+
if not isinstance(layer, torch.nn.Conv2d):
60+
continue
6461

65-
for layer in conv_layers:
6662
if isinstance(layer, LoRACompatibleConv) and layer.lora_layer is None:
6763
layer.lora_layer = lambda *x: 0
6864
original_layers.append((layer, layer._conv_forward))

0 commit comments

Comments
 (0)