Taking Stable Diffusion for a spin on a basic laptop

I’ve been quite intrigued by the recent public releases of Dall-E followed by Stable Diffusion which allow you to generate images from simple text prompts, & had been trying them out on the free online platforms. The main limitation of these is that you are limited to a certain quota for free, and to really try an opensource tool like Stable Diffusion locally, you need to pretty beefy system with a high end GPU.

All that changed when I came across a project on GitHub that lets you run Stable Diffusion on the CPU thanks to Intel’s OpenVINO framework. I promptly took it for a spin on my 4 year old laptop with an Intel quad core 8th gen CPU. The instructions are provided on the GitHub project itself as expected. If you are using Windows like me, you can do the following:

  • Install Anaconda which simplifies the Python setup.
  • Create a new environment in Anaconda for the project.
  • Open the terminal, create a directory for the project & clone the GitHub repository for the project using the git clone https://github.com/bes-dev/stable_diffusion.openvino.git command with the project web URL.
  • Follow the installation instructions on the project page:
    • Install the project dependencies using pip install -r requirements.txt
    • Enable Developer Mode in Windows settings which allows the model to be downloaded on first run.
    • If you plan to use the web interface also install streamlit drawable canvas using pip install streamlit-drawable-canvas, as this module dependency seemed to be missing in the documentation & gave me errors on trying to run the web demo.
  • Run the script as per instructions replacing the prompt if you want (the developer seems to be a GoT/Emilia Clarke fan) – python demo.py --prompt "Street-art painting of Emilia Clarke in style of Banksy, photorealism"

On my laptop it takes about 8-10 min to generate an image, though a more powerful CPU with more RAM should be able to cut it down to 3-4 min as mentioned in the project page benchmarks. Either way, it is a worthwhile tradeoff to be able to run it locally.

Here are a couple of results from the prompts I ran on my laptop (I chose a couple of the timeless beauties to see what Stable Diffusion has to offer):

Pixar’s Global Illumination system & the Uncanny valley

CGI Lighting goes up another notch – just watch the clip from Pixar’s “Blue Umbrella” short below:

Also, check out the stills from the original article to get an idea of how far we’ve come. You’d be hard pressed to believe that it’s not real – Director Saschka Unseld discusses Pixar, photorealism, and the making of ‘The Blue Umbrella’ | The Verge.

Uncanny Valley at its eeriest