Running "AI" on PC requires rich computational resources as GPU with VRAM, and storage for its model. "bes-dev/stable_diffusion.openvino"*1 made running Stable Diffusion on poor consumer PC.
And "intel/openvino-ai-plugins-gimp" allows an user to operate Stable Diffusion via GUI of GIMP plugin. It provides 5 plugins including Stable Diffusion.
|OS||Windows 11 Pro 22H2|
|CPU||Intel Core i7-6650U|
SD card: 32GB (D drive in this post)
Container and WSL are not used in this post. On limited resource environment, it is better run SDOV directly than to use them. Actually, SDOV can run stably even on a PC with RAM=8GB.
Computational resource assignment is done by Windows OS to them, and it sometime causes OOM kill, which a process is killed forcibly due to out of memory. Although there are workaround to avoid it, they are not recommended.
You should not try to circumvent these safeguards by manually setting --oom-score-adj to an extreme negative number on the daemon or a container, or by setting --oom-kill-disable on a container.
- Run Stable Diffusion
To proceed the work below, following tools are required. "version" is the one in this post.
|Visual Studio 2022||17.5.1|
Use GIMP of development release, not stable version. This plugin doesn't work in stable version. The latest version of the development release at the moment of this post is 2.99.14.
A development release doesn't overwrite a stable version. It can be used in parallel with a stable version.
Visual Studio and C++ build tools
C++ builder is required to install Python packages. This tool is included in Visual Studio, or "Build Tools for Visual Studio". In advance of starting procedure below, one of both must be installed with appropriate options.
Tools > Get Tools and Features...
Python 3.11 is in progress and will be available in 2023.0 release.
This program provides a bat file (install.bat) for its install. It defines environment values and Python packages, but subsequent install processes are also defined in other Python scripts. And they also defines required packages and install folders there. A user should not insert own settings into them.
This post follows default configuration excepting the working folders.
|git cloneed folder
|Python virtual environment||c:\myapp\openvino-ai-plugins-gimp\gimpenv3|
Move to the working folder and download program with Git command or GitHub Desktop.
git clone git clone https://github.com/intel/openvino-ai-plugins-gimp.git
Edit "install.bat" and run it
Open "install.bat" in the install folder, and rewrite the next line as
The relational path initially written has risk to install files and folders to unexpected location depending on the location it run. To void this risk, it should be rewritten as absolute path.
Run the edited bat file.
After the install process of "install.bat", copy all data under the source below to the destination.
GitHub introduces xcopy command including Windows environment variable "%userprofile%". Running this command from Command Prompt is no problem, but from PowerShell is not. Description manner of environment variable there is different as "$env:userprofile".
Just copy and paste all data in a folder, it is enough to perform manually on File Explorer.
Download and copy Stable-Diffusion-1.4 model
Download model with Git command or GitHub Desktop.
Copy all files downloaded to the next folder.
Launch GIMP and follow next menu and settings.
Edit > Preferences Folders > Plug-ins
Add the next folder and restart GIMP.
Creating new image after relaunching GIMP, and OpenVINO-AI-Plugins are enabled. They can be accessed at the next menu item.
Layer > OpenVINO-AI-Plugins
Run Stable Diffusion
Below is major items of Stable Diffusion.
|Enter text to generate image||prompt
explain expected factors
|Negative Prompt||explain unexpected/unnecessary factors|
|Number of Inference steps||the more times, the longer it takes to process|
|Seed||random number seed
reproduce random number generation
In assumption with performance of consumer PC as Surface Pro 4, Number of inference and time for image output are
|inference||image output (min)|
To generate image efficiently, repeat inference with small number as possible until determining direction, then finish with larger inference number as possible and the last random seed number. Next images were output with inference = 8, 16, 32, 50.
|prompt||Cleopatra, art of Mucha and Utamaro, in style of movie|
|negative prompt||ugly, deformed|
In inference to render Cleopatra in style of MuCha and Utamaro, a image becomes from rough to detailed in accordance with larger inference number. It is understandable that the characteristics of specific areas become clearer as
- decoration and background become more MuCha-tic
- facial features become as mixed race between European and Asian
Fine tuning prompt to render close-up of the face, and the image at the top of this post after 50 inferences outputs.