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

support for SDXL #50

Open
wzq728 opened this issue Jul 25, 2023 · 4 comments
Open

support for SDXL #50

wzq728 opened this issue Jul 25, 2023 · 4 comments

Comments

@wzq728
Copy link

wzq728 commented Jul 25, 2023

Thanks for your nice work! I want to know if tome support SDXL? And if it is, how to use it.

@dbolya
Copy link
Owner

dbolya commented Aug 8, 2023

I haven't looked into it. How does SDXL differ from normal SD? If it's similar, there's probably a way to get it to work.

@theAdamColton
Copy link

I haven't done any detailed tests, but wrapping a huggingface pipeline.unet seems to work without crashing for training and inference, and produces images that are ok
A bustling Parisian café scene in the 1920s  Jazz musicians, flapper girls, and intellectuals in conversation  Oil painting, canvas and oil paints  Warm, dimly lit ambiance

this is with r=0.5 at 672x672

@dbolya
Copy link
Owner

dbolya commented Sep 20, 2023

Does it speed it up? I think the default behavior of the diffusers implementation is to do nothing when wrapping the wrong thing, so it might not actually be doing anything.

@theAdamColton
Copy link

import tomesd
from diffusers import StableDiffusionXLPipeline, StableDiffusionPipeline
import torch
import time

pipeline = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16").to("cuda")

batch_size = 4
resolution = 896
trials = 2

tt = 0
for _ in range(trials):
    st = time.time()
    pipeline(prompt="Laundromat Stories: Inside a laundromat on a rainy day. People load clothes into washing machines and read magazines while waiting. Charcoal drawing, chiaroscuro, dramatic
 lighting from overhead fluorescents.", num_inference_steps=20, num_images_per_prompt=batch_size, width = resolution, height=resolution)
    tt += time.time() - st
print("SDXL no tomesd: avg time", tt/trials)

pipeline = tomesd.apply_patch(pipeline, ratio=0.75, max_downsample = 4)

tt = 0
for _ in range(trials):
    st = time.time()
    pipeline(prompt="Laundromat Stories: Inside a laundromat on a rainy day. People load clothes into washing machines and read magazines while waiting. Charcoal drawing, chiaroscuro, dramatic
 lighting from overhead fluorescents.", num_inference_steps=20, num_images_per_prompt=batch_size, width = resolution, height=resolution)
    tt += time.time() - st
print("SDXL w/ tomesd: avg time", tt/trials)

I get around a 12% speedup on a 3090: 18.9267s vs 16.891s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants