SD - 0. How to set up your diffusion webui?

In this article, I will present a step-to-step guide to help you set up stable-diffusion-webui uploaded by automatic1111.

Pre-requisite

  • Large AI models perform better on GPUs, check your GPU's version by running nvidia-smi command. This would allow you to check your CUDA version (kind of GPU driver), which will be used in later package selection.
  • Check you have installed Python and git.
    • By command python --version && git --version you could check whether they are installed.
    • If you haven't installed Python, you could check the official website to download the package(^^3.9+ version with installer recommended!^^).
    • If you haven't installed Git, check the Official website to download the package.

Choose your model

Set up your environment

One popular repository for diffusion is the stable-diffusion-webui by AUTOMATIC1111

  • Run the command below under the directory where you want the application to be placed.
1
$ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

Automatic Download

  • Following the instructions in the README, you could either run webui-user.bat (Windows Users) or webui.sh (linux user by bash webui.sh) to automatically download the required packages

Manual Download

  • Create a virtual environment for the required packages using conda.
    • create a new conda environment with command
      1
      2
      3
      4
      // You could change the word after -n 
      // to customize the environment name
      $ conda create -n diffusion
      $ conda activate diffusion
  • Download the corresponding pytorch package (the CUDA version) using the command from official website
    • For example, if your CUDA version is 11.4, run the below command
      1
      $ conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
  • Run python launch.py and let the script install the other packages for you. Or you could run pip install -r requirements.txt.
    • If failed to launch, you could
        1. Manually download the repository git clone https://github.com/Stability-AI/stablediffusion.git
        2. Install the required package according to Requirements - skip the pytorch installation
        3. run pip install -e . in the directory

Place your models

  • After you could run python launch.py with no error, put the downloaded model under stable-diffusion-webui/models/Stable-diffusion/ directory, then you should be able to adjust the model on the top left corner.
    diffusion-webui-example

You are ready to go!

  • Make sure your conda environment is correctly activated, then copy and paste the command python path/to/your/webui/folder/launch.py
  • For prompt reference, you could dive into different communities and use this wonderful search engine.
  • In a later article, I will present more detailed introductions to the different components of diffusion models (like inference steps, sampling methods and so on). You could also reference to the wonderful tutorials on Stable diffusion webui wiki for advanced features.

SD - 0. How to set up your diffusion webui?
https://delusion4013.github.io/2023/02/28/How-to-set-up-your-diffusion-webui/
Author
Chenkai
Posted on
February 28, 2023
Licensed under