OpenVINO Stable Diffusion.
2023-03-174 turns8,167 charstext-davinci-002-render-sha
Summary
User seeks free AI image generators for art, with interest in running Stable Diffusion on Intel GPUs via OpenVINO.
Messages
How to run Stable Diffusion on Intel GPUs with OpenVINO
Note: It will also work on CPUs too! :)
OpenVINO Notebooks comes with a handful of AI examples. But do you know that we can also run Stable Diffusion and convert the model to OpenVINO Intermediate Representation (IR) Format, and so it can run on CPUs and GPUs efficiently? Also, by compressing the FP32 model to FP16, we reduced the model size by half (close to), and also now it requires much less RAM/VRAM to run. Most importantly, this also provides a significant speed-up in GPU processing because Intel Xe Matrix Extensions (XMX-systolic array) kicked in.
Here are some results I got running the notebook and it’s pretty fun. With my Intel Arc A770m, I can get approximately 6.0 iterations per second (without debug mode). What it means is usually it takes less about 10 seconds to generate a high-quality image below.
Stable Diffusion text-to-image results with the OpenVINO Notebooks and Intel Arc A770m.
Image-to-Image example, turning a photo into a watercolor painting.
First, here is the OpenVINO Notebooks repository. It has everything you would need to complete the demo here today.
openvino_notebooks/notebooks at main · openvinotoolkit/openvino_notebooks
If you wish to launch only one notebook, like the Monodepth notebook, run the command below. In your browser, select a…
github.com
Stable Diffusion is under the 225-stable-diffusion-text-to-image folder
And in the demo notebook, we introduced not only the famous Text-to-mage pipeline but also included the Image-to-Image generation pipeline. But what does it really mean and how do we run it?
Pipelines
How to Install
Quick Video Instruction.
To install OpenVINO Notebooks, you can follow the instruction here if you are using Windows: https://github.com/openvinotoolkit/openvino_notebooks/wiki/Windows
If you are a Linux user, you can follow this link: https://github.com/openvinotoolkit/openvino_notebooks/wiki/Ubuntu
On a high level, it’s a few steps below.
Install Python 3.10.x. (or below) and create a virtual environment
python3 -m venv openvino_env
source openvino_env/bin/activate #for linux
Git Clone the directory
git clone --depth=1 https://github.com/openvinotoolkit/openvino_notebooks.git
cd openvino_notebooks
Install all libraries and dependencies
pip install -r requirements.txt
Run the Jupyter Notebooks
jupyter lab notebooks
Run All Cells and wait =)
Now, if you look into the code. What we have done is really optimize the PyTorch pipeline and execute the code with OpenVINO.
The downloading and converting may take a little while for the first time. Once it’s completed you will get a set of IR files. For your convenience, I’ve already updated these pre-trained, optimized models here to huggingface.
bes-dev/stable-diffusion-v1-4-openvino at main
We're on a journey to advance and democratize artificial intelligence through open source and open science.
huggingface.co
Now, if you are blessed with the Intel Arc GPUs, you can change the code to “GPU”. By default, it’s using AUTO, and thus it will switch to GPU automatically if it’s detected.
Make it run on GPUs
Auto-plugin. It started by first using the CPU, then switch to GPU automatically.
And here in this step, I have set the steps to 30. Ideally, I would use 50 as it will provide the best-looking results. You can generate different scenes here by modifying the input text. If you want to get some really cool looking images, you can try some of the top prompts the community put together. https://mpost.io/best-100-stable-diffusion-prompts-the-most-beautiful-ai-text-to-image-prompts/
In the end, we also generated the GIF file for you to visualize what happened between each step.
Image-to-image pipeline
Now, if you continue on the notebooks, you will see we can also use a prompt to ‘influence’ the look of the final image. Here we provided an example of converting our photo into a watercolor painting.
Generating an image based on an initial image and a prompt. This way the result will be guided.
Image-to-image result.
Conclusion
Today, if you want to learn how Stable Diffusion works and also see how hardware acceleration works with Intel hardware, the OpenVINO Notebooks is definitely my go-to. If you have any questions or want to show some of your best results, please make a comment here or on our GitHub discussion board! Happy coding. explain how to do all of this
To run Stable Diffusion on Intel GPUs with OpenVINO, follow the steps below:
1. Install Python 3.10.x or below and create a virtual environment:
```
python3 -m venv openvino_env
source openvino_env/bin/activate # for Linux
```
2. Clone the OpenVINO Notebooks repository:
```
git clone --depth=1 https://github.com/openvinotoolkit/openvino_notebooks.git
cd openvino_notebooks
```
3. Install all libraries and dependencies:
```
pip install -r requirements.txt
```
4. Run the Jupyter Notebooks:
```
jupyter lab notebooks
```
5. Navigate to the `225-stable-diffusion-text-to-image` folder and open the `Stable_Diffusion_T2I.ipynb` notebook.
6. Follow the notebook instructions to download and convert the pre-trained Stable Diffusion model to OpenVINO Intermediate Representation (IR) format.
7. Once the conversion is complete, update the notebook to load the optimized IR files instead of the original PyTorch model. You can use the pre-optimized models available on Hugging Face at https://huggingface.co/bes-dev/stable-diffusion-v1-4-openvino.
8. To run on Intel GPUs, change the code to `"GPU"`. By default, it is set to `"AUTO"`, which will switch to the GPU automatically if it is detected.
9. Run the cells in the notebook, and wait for the results. The notebook will generate high-quality images based on the input text and the specified number of diffusion steps.
10. To run the image-to-image pipeline, open the `Image_to_Image.ipynb` notebook in the `230-image-to-image` folder. Follow the instructions to generate an image based on an initial image and a prompt.
11. Visualize the results by generating a GIF file to show the transition between each step.
By using OpenVINO to optimize the Stable Diffusion model, you can run it efficiently on Intel CPUs and GPUs, and reduce the model size by compressing it to FP16. This will also provide a significant speed-up in GPU processing by leveraging Intel Xe Matrix Extensions (XMX-systolic array).
text-davinci-002-render-sha
best AI image generators for art that are free
There are several AI image generators for art that are available for free. Here are some of the best ones:
1. Deep Dream Generator: This is a popular online platform for creating and sharing psychedelic images generated by AI. It allows users to upload their own images and apply various styles to them using neural networks.
2. Artbreeder: This is a free website that allows users to generate unique digital art by combining different styles and features. It uses a machine learning algorithm to create images that can range from realistic to surrealistic.
3. Ganbreeder: This is a free online tool that allows users to generate and evolve images using a generative adversarial network (GAN). It is similar to Artbreeder, but with a focus on generating more abstract and experimental images.
4. AI Painter: This is a free online tool that uses artificial intelligence to transform photos into various styles of paintings, such as oil, watercolor, and pencil sketches.
5. Prisma: This is a free app that allows users to transform their photos into works of art using neural networks. It offers a variety of styles inspired by famous artists and art movements.
6. NeuralStyler: This is a free desktop application that uses neural networks to apply different art styles to images. It allows users to adjust the level of abstraction and detail in the final output.
7. DeepArt.io: This is a free online platform that allows users to turn their photos into works of art using neural networks. It offers a variety of styles inspired by famous artists and art movements.
All of these AI image generators are free and offer unique features and styles, so you can choose the one that best suits your needs and preferences.
text-davinci-002-render-sha