andyshih12 / paradigms Goto Github PK
View Code? Open in Web Editor NEWPyTorch implementation for "Parallel Sampling of Diffusion Models", NeurIPS 2023 Spotlight
License: MIT License
PyTorch implementation for "Parallel Sampling of Diffusion Models", NeurIPS 2023 Spotlight
License: MIT License
It seems that paradigms is only support for DDPM and DDIM. When testing on 2*V100 with batch_size=10 and DDPM, it achieves 1.5 times speed up. But if I use UniPCMultistepScheduler, the time cost is similar to DDPMParallelScheduler.
Any plan for support UniPCMultistepScheduler? @AndyShih12
Ideally running paradigms with a window size of 1 should be identical to running sequential DDIM given that there is no added noise in DDIM. But I am not observing this. Here is the code I used for testing. Please let me know if I am missing something.
import torch
from diffusers import DDIMParallelScheduler, DDIMScheduler
from diffusers import StableDiffusionParadigmsPipeline, StableDiffusionPipeline
import numpy as np
torch.manual_seed(1)
scheduler = DDIMParallelScheduler.from_pretrained("runwayml/stable-diffusion-v1-5", subfolder="scheduler", timestep_spacing="trailing")
pipe = StableDiffusionParadigmsPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", scheduler=scheduler, torch_dtype=torch.float16
)
pipe = pipe.to("cuda")
prompt = "a photo of an astronaut riding a horse on mars"
image1 = pipe(prompt, parallel=1, num_inference_steps=50).images[0]
torch.manual_seed(1)
scheduler = DDIMScheduler.from_pretrained("runwayml/stable-diffusion-v1-5", subfolder="scheduler", timestep_spacing="trailing")
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", scheduler=scheduler, torch_dtype=torch.float16
)
pipe = pipe.to("cuda")
prompt = "a photo of an astronaut riding a horse on mars"
image2 = pipe(prompt, num_inference_steps=50).images[0]
img1 = np.asarray(image1)
img2 = np.asarray(image2)
print((img1-img2).mean())
The output should be ideally 0 but that is not what I am observing. Please help.
Is it possible to run this with inpainting?
Also, any noticeable deterioration of images?
Thanks for your work!
We'd love to incorporate this into InvokeAI, but would like to request a license be added so we know how (and whether) we can use it.
Thanks for the excellent work, and congrats on the accomplishment @AndyShih12 et. al
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.