Run Stable Diffusion on 6GB VRAM (Automatic 1111)

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?

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.

Recent