Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seamless generation mode #82

Open
parlance-zz opened this issue Oct 24, 2022 · 0 comments
Open

Seamless generation mode #82

parlance-zz opened this issue Oct 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@parlance-zz
Copy link
Owner

There are various use cases for wanting a sample to be seamless or "tile-able", the best way to achieve that is to allow the convolutions in the U-Net to wrap at the image edges rather than crop, and there is a built-in way to do this fairly easily, it just needs to be integrated into the grpc server:

import torch

def patch_conv(cls):
	init = cls.__init__
	def __init__(self, *args, **kwargs):
		return init(self, *args, **kwargs, padding_mode='circular')
	cls.__init__ = __init__

patch_conv(torch.nn.Conv2d)

from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
pipe.to("cuda")
pipe("a photograph of an astronaut riding a horse")["sample"][0].save("output.png")
@parlance-zz parlance-zz self-assigned this Oct 24, 2022
@parlance-zz parlance-zz added the enhancement New feature or request label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant