stable-diffusion-webui
stable-diffusion-webui copied to clipboard
Tileable texture from Stable Diffusion
Someone requested Tileable textures be implemented, this code is for diffusers codebase, needs implementing for stable-diffusion codebase
I simply inserted this partial code from here in line 34 of optimized_txt2img.py and got Tileable texture scripts for stable-diffusion codebase. (I'm new to python so I could be wrong on this.)
def patch_conv(klass):
init = klass.__init__
def __init__(self, *args, **kwargs):
return init(self, *args, **kwargs, padding_mode='circular')
klass.__init__ = __init__
for klass in [torch.nn.Conv2d, torch.nn.ConvTranspose2d]:
patch_conv(klass)

https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html
from the documentation, the "padding mode" have several options:
padding_mode (string, optional) – 'zeros', 'reflect', 'replicate' or 'circular'. Default: 'zeros'
the default mode is zeros so I think it would be wise to have a toggle to switch between them