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):

Mouse Pointer Disappears in Chrome

I faced this issue when working on my HP Pavilion x2 which has a touchscreen. The mouse pointer disappeared when moved over the Chrome but continued to show up in other applications. It seems to be related to the hardware acceleration settings and seems to have been around for quite a while on various Windows devices ranging from the HP Envy to the Surface and affecting both Windows 8.x and 10 (2 years at least going by the Google Group thread).

Anyway, the fix seems to be to disable Hardware Acceleration in the Advanced Settings of Chrome:

Go to Chrome Settings > System and uncheck the following –
 Use hardware acceleration when available

Also, hardware acceleration does seem to be buggy on Chrome causing a range of problems related to mouse pointer lags, at least on Intel GPUs going by this post (came up as the top result when searching for “Chrome hardware acceleration“).

Source: Mouse Pointer Disappears – Google Product Forums

2012: The right time for Windows 8 tablets

Windows_8_Developer_Preview_Start_Screen

That is of course if the world doesn’t end. Jokes apart, the reason I think that the second half of 2012 is the right time for Windows 8 tablets is that it’ll guarantee the right mix of hardware will be available around that time. Quad core & higher ARM tablets would be the norm then with pretty powerful graphics (which would be a must if display resolutions hit the 2Kx1K levels with the iPad 3). Intel would also be closer to providing a compelling x86 based SoC in the tablet space. In fact, the tablet hardware is going to continue to scale up in leaps & bounds over the next 2-3 years before we reach a level of acceptable performance (just look at the roadmaps of the major SoC makers).

 

Apart from the hardware angle, the software landscape and usage model on tablets is also evolving. At the moment people are trying to mostly replicate the desktop or smartphone UI paradigms on the tablet. For Windows 8, it all boils down to how well Microsoft is able to adapt their MS Office UI to the tablet. Then again, we could also be looking at tablets being used as a laptop\desktop replacement when docked – Apple seems to be heading that way with their Thunderbolt display (MacBooks for now).

So, don’t fret over the timelines, and instead be excited over the emerging paradigms over the next couple of years.

P.S. Extremetech has a nice how-to for building your own Windows 8 tablet (you will need an existing Windows 7 tablet of course)