How to Set Up Stable Diffusion on Your GPU-Equipped PC

Dec 18, 2023 | Data Science

If you’re looking to dive into the world of AI-generated art using Stable Diffusion but don’t possess a wealth of coding knowledge, fret not! This guide is designed to help you get Stable Diffusion up and running on your own GPU-equipped PC quickly and efficiently, using Docker as a straightforward solution. Let’s get started!

Requirements: What You Need Before Starting

  • Operating System: Ubuntu (tested on 20.04) or Windows (tested on Windows 10 21H2)
  • An Nvidia GPU with at least 6GB VRAM (GTX 700 and onward)
  • Free Disk Space: 2.8GB
  • Docker and Nvidia-docker installed
  • No longer require a HuggingFace account for default v2 model access

Installation Steps

Follow these steps to install Stable Diffusion on your machine:

  1. Make sure Docker and Nvidia-docker are installed by following the respective official installation guides.
  2. Windows Users:
  3. To start the model, run the following command:
  4. docker run --name stable-diffusion --pull=always --gpus all -it -p 7860:7860 nicklucchesi/stable-diffusion
  5. This command pulls the latest Docker image and initializes the model (you may need to wait a few minutes).
  6. Once set up, visit http://localhost:7860 in your browser to access the web interface.

Multi-GPU Inference

If you have multiple GPUs, you can leverage them for parallel processing. Here’s a breakdown:

Data Parallelism

Data Parallelism is like having multiple chefs each preparing the same dish but in their own kitchen. Each GPU generates a separate image simultaneously. To enable this, specify your devices using:

-e DEVICES=0,1

This means both GPU 0 and 1 will be utilized to generate images faster!

Running the Model

By default, the model runs in half-precision (FP16) to utilize memory more effectively. If you wish to utilize single-precision (FP32), use this command:

docker run .. -e FP16=0 ...

Troubleshooting

If you encounter issues during installation or operation:

  • Ensure that all components (Docker, GPU drivers) are up to date.
  • Verify your GPU is being recognized by running the command nvidia-smi in your terminal.
  • For memory-related errors while generating images, consider reducing the image size or number of simultaneous images.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Final Thoughts

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox