stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Tileable texture from Stable Diffusion

Open hlky opened this issue 4 years ago • 2 comments

Someone requested Tileable textures be implemented, this code is for diffusers codebase, needs implementing for stable-diffusion codebase

hlky avatar Aug 25 '22 19:08 hlky

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)

image

KawaNae avatar Aug 27 '22 16:08 KawaNae

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

FuouM avatar Aug 28 '22 04:08 FuouM