Run Stable Diffusion on 6GB VRAM (Automatic 1111)

Sujeet Kumar
3 Min Read

Stable Diffusion is a popular text-to-image AI model that has gained a lot of traction in recent years. However, one of the main limitations of the model is that it requires a significant amount of VRAM (Video Random Access Memory) to work efficiently. In particular, the model needs at least 6GB of VRAM to function correctly.

For those who do not have a high-end graphics card with ample VRAM, running Stable Diffusion can be a challenging task. Fortunately, there are some optimizations that can be applied to the model to make it run on machines with less VRAM.

Commands Optimizations

Two of these optimizations are the “–medvram” and “–lowvram” commands.

The “–medvram” command is an optimization that splits the Stable Diffusion model into three parts: “cond” (for transforming text into numerical representation), “first_stage” (for converting a picture into latent space and back), and “unet” (for actual denoising of latent space). With this command, only one part of the model is kept in VRAM at all times, while the other parts are sent to CPU RAM. This significantly reduces the VRAM consumption of the model, making it easier to run on machines with less VRAM.

However, the downside of using the “–medvram” command is that it lowers the performance of the model, particularly if live previews are enabled. While the performance decrease is not significant, it is something to keep in mind when using this optimization.

For those who want an even more thorough optimization of the Stable Diffusion model, there is the “–lowvram” command. This command splits the “unet” part of the model into many modules, and only one module is kept in VRAM at a time. This optimization significantly reduces the VRAM consumption of the model but comes at the cost of devastating performance. Therefore, it is recommended that the “–lowvram” command is only used as a last resort and only when the machine’s VRAM is severely limited.

Where to Add these commands?

image 10 - Run Stable Diffusion on 6GB VRAM (Automatic 1111)

To use these commands in Stable Diffusion’s Automatic 1111 interface, users need to add them to the “webui-user.bat” file. To do this, right-click on the file, click “edit,” and add the commands after the “set COMMANDLINE_ARGS=” line.

Share This Article
SK, an ardent writer whose creativity knows no bounds. With a profound love for anime, a fascination for the world of VFX, and an insatiable appetite for innovative storytelling, SK embarks on a journey where art and artificial intelligence converge to bring captivating narratives to life.