Skip to content

Local Installation

Ben Rugg edited this page Apr 14, 2023 · 25 revisions

Instructions for running Stable Diffusion locally

Intro

"Local Installation" means that you are running Stable Diffusion on your own machine, instead of using a 3rd party service like DreamStudio. Running locally gives you the ability to create unlimited images for free, but it also requires some advanced setup and a good gpu.

Currently, AI Render only integrates with Automatic1111's Stable Diffusion Web UI. Their code is changing almost daily, so you will need to update it to the latest version.

Disclaimer

Setting up Stable Diffusion locally is for advanced users. There are a number of steps, and you may have to do some serious troubleshooting! You will also need to know your way around a Terminal, or be willing to do a lot of googling.

Instructions

  1. Get the latest version of AI Render (on Blender Market, Gumroad or the releases page). Install it and restart Blender.

  2. If you DON'T have the Automatic1111 Stable Diffusion Web UI installed:

    1. Install the Automatic1111 Stable Diffusion Web UI. Follow all the installation instructions on their page, and make sure you can see it successfully running in a web browser. (You can then close the web browser).
    2. In the Automatic1111 terminal window, quit the web server and keep the terminal window open.
  3. If you DO already have the Automatic1111 Stable Diffusion Web UI installed:

    1. Open a terminal window and cd to the web ui directory (wherever you previously installed it).
    2. Make sure the web ui is not running.
  4. In the terminal window, in the Automatic1111 directory, run this command to make sure you've got the latest version: git pull

    Note: If this doesn't run successfully, you'll need to do a fresh reinstall Automatic1111. (Copy the 4gb model weights file out first, so you don't have to download it again)

  5. In the terminal window, update the Automatic1111 config so it starts its API:

    • On Windows:

      1. Run notepad.exe .\webui-user.bat
      2. In Notepad, change set COMMANDLINE_ARGS= to set COMMANDLINE_ARGS=--api webui-user screenshot
      3. Save the file and close Notepad
    • On Mac or Linux:

      1. Run vi webui-user.sh
      2. Change #export COMMANDLINE_ARGS="" to export COMMANDLINE_ARGS="--api" (In vim (the text editor), type a to enter edit mode. Then add --api to the right place and make sure to delete the pound sign) webui-user screenshot
      3. Save the file by hitting the ESC key, then typing ZZ (holding Shift)
  6. Start the Automatic1111 server:

    • On Windows: Run .\webui-user.bat ← the file you edited
    • On Mac or Linux: Run ./webui.sh ← NOT the file you edited
  7. In Blender, in the add-on preferences for AI Render, enable Local Stable Diffusion. Make sure the settings match what you saw in Automatic1111. AI-Render Preferences Panel

You're ready to go!

When you render, you should see the progress in the Automatic1111 terminal, and the output image should be pulled into Blender when it's done.

Troubleshooting

  • For issues when installing Automatic1111's Stable Diffusion Web UI, please see their wiki or other installation tutorials.

  • If the Web UI installed successfully, when it's running, you should be able to see it at http://127.0.0.1:7860/. If you can't see it, it's not installed correctly, or it's not running.

  • If you see this error: It looks like the Automatic1111 server is running, but it's not in API mode, make sure to carefully follow steps 5 and 6 above and make sure you are running the command with -user as part of the filename (ie. .\webui-user.bat rather than .\webui.bat). If you are on a Mac or Linux, make sure you removed the pound sign at the beginning of the line.

  • Make sure you are running the latest version of Automatic1111. It is updated extremely regularly! Using a terminal, run git pull in the Automatic1111 directory.

  • Images come back all black: Something in Stable Diffusion isn't set up correctly. If you see the same results in the Web UI, then for sure it's something about your installation, and not an issue with AI Render. You'll need to search for help, unfortunately.

  • Image generation is really slow or images come back garbled/noisy: Decrease your image size. Definitely don't do 1024x1024 if you are experiencing issues. Try 512x512 and then use an AI upscaler like https://www.upscale.media/.


If you are still having issues, please submit a bug report. If have suggestions on how to improve these instructions, please submit a feature request.

Clone this wiki locally