* This blog post is a summary of this video.

Speed Up Stable Diffusion 10X: Download This One File

Author: Sebastian KamphTime: 2024-03-22 20:20:00

Table of Contents

Introducing LCM Lora for Faster Stable Diffusion Image Generation

LCM Lora is a new technique that can speed up Stable Diffusion image generation by up to 10x. By utilizing latent diffusions, LCM Lora allows Stable Diffusion to render images using fewer steps while maintaining quality. This means you can generate images much faster without needing better GPU hardware.

In this post, we'll cover everything you need to know to get set up with LCM Lora. We'll discuss what LCM Lora is, how to install it, best settings to use, and more. Read on to unlock fasterStable Diffusion speeds with LCM Lora!

What is LCM Lora?

LCM stands for Latent Diffusion Model and Lora is Latent Optimal Random Average. LCM Lora works by training a secondary model to predict the latent states that Stable Diffusion would generate in 25 steps. This allows skipping straight to the final latent state much quicker rather than slowly stepping through all the intermediates. By going directly to the final predicted latent state, LCM Lora can render images in just 4-8 steps while retaining the same level of quality and coherence as a full 25 step diffusion process. This results in much faster image generation speeds.

How Does LCM Lora Speed Up Stable Diffusion?

Standard Stable Diffusion slowly steps through 25 latent states to render an image. Each step adds a little more detail until the final image emerges. Rendering an image this way can take 15-60 seconds on consumer GPUs. LCM Lora works by training a model that learns to predict what the final latent state will be. By skipping straight to the predicted final latent, LCM Lora bypasses all the intermediate steps. This means you only need 4-8 diffusion steps to render the same quality image, speeding things up dramatically.

Downloading and Installing LCM Lora

Getting set up with LCM Lora is straightforward. You simply need to download the files and integrate them into whichever Stable Diffusion UI you use. We'll cover the steps for Automatic1111 WebUI and Confin UI here.

Downloading the LCM Lora Files

First, head over to the LCM Lora GitHub release page and download the files for your preferred Stable Diffusion model. Make sure to select SD 1.5, SD 1.4, or SD 2.0 models - LCM Lora currently doesn't support other version like 2.1. Save the .safe file to your Stable Diffusion models/Lora folder. For example, models/StableDiffusion/Lora. Rename the file to match the model, like LCM_sd15.ckpt for SD 1.5. That's it for downloads!

Integrating LCM Lora into Stable Diffusion UI

For Automatic1111, go to Settings > Samplers > Quick Settings List. Click Add and give it a name like 'LCM Lora'. Now when sampling, choose your Lora from the model dropdown. For Confin, go to Model Manager > Latent Diffusion tab. Click the + button to add the Lora .ckpt file you downloaded earlier. Make sure to add the Lora model in between your base SD model and scheduler/sampler.

Using LCM Lora for Faster Image Generation

Once integrated with your UI of choice, leveraging LCM Lora for speed is straightforward. But there are some settings you'll want to configure properly. Here's what we recommend for optimal performance and quality.

Configuring LCM Lora Settings

The two most important settings are number of steps and CFG scale. We recommend trying steps values between 4 to 8. More steps don't necessarily improve quality. CFG scale controls coherence - set between 1.0 to 2.0. Higher values cause more distortion. Also try different samplers. For Automatic1111, Euler a and DPM 2 can work well. For Confin, the K sampler integrated with LCM tends to produce the best results.

Seeing LCM Lora Speed Improvements

Once configured correctly, you should see image generation speed improve dramatically. With an RTX 4090, you can achieve less than 1 second render times for a 1024x1024 image with LCM Lora, over 10x faster than typical! Speed improvements are significant even on much lower end hardware like old GTX GPUs and M1 Macs. Basically no matter your hardware, LCM Lora will provide a hefty speed boost.

Getting Optimal Results with LCM Lora

While LCM Lora delivers excellent performance, dialing in the best settings takes some trial and error. Let's go over top settings and configurations to try for getting optimal quality and coherence.

Choosing the Best Samplers and CFG Settings

As mentioned before, 4-8 steps tend to work best in most cases. For CFG scale, values between 1.0 and 1.5 provide a good balance. Higher values often show artifacts and distortions. It's also crucial to test different samplers - some work better than others. In Confin, the LCM sampler integrated specifically for Lora delivers the best quality. For Auto1111, samplers like Euler a, DPMa, DPM 2, and DPM SDE can yield good results depending on the prompt.

Using LCM Lora for Animations and Webcam

LCM Lora isn't just for static images - it also unlocks real-time animation and webcam processing with Stable Diffusion! For animations, LCM Lora allows rendering each frame in just a few seconds instead of minutes. For webcam, LCM Lora can apply styles and effects to your webcam feed in real-time for the first time.

Frequently Asked Questions

Let's review some common questions about LCM Lora to further understand how it works and best practices.

Conclusion

LCM Lora delivers massive speed improvements for Stable Diffusion through latent upsampling techniques. With proper configuration, you can achieve 10x faster rendering without any drawbacks to image quality or coherence compared to normal diffusion.

The quick set up process and broad hardware support make LCM Lora a no-brainer upgrade for any Stable Diffusion user looking to save time without breaking the bank on expensive GPUs. Unlock new real-time use cases with LCM Lora!

FAQ

Q: What hardware do I need to use LCM Lora?
A: LCM Lora provides speed improvements even on lower-end hardware, but the fastest speeds require powerful GPUs like Nvidia RTX 4090.

Q: Does LCM Lora work with all Stable Diffusion models?
A: Yes, LCM Lora is compatible with models like SD 1.5, SD 1.4, and SDXL.

Q: Will using lower LCM Lora steps degrade image quality?
A: Using as few as 4 LCM Lora steps can retain good image quality while significantly improving speed.