Deploying Stable Diffusion on m7i.4xlarge and Accelerate with OpenVINO
Explaining on how to deploy Stable Diffusion on EC2
Stable Diffusion
employs a specific diffusion model (DM) known as a latent diffusion model
(LDM), pioneered by the CompVis group at LMU Munich.
enhances AI inference by minimizing latency and maximizing throughput without
compromising accuracy. It achieves this by reducing model size, optimizing
hardware utilization, and facilitating streamlined development and integration
of deep learning across various domains such as computer vision, large language
models, and generative AI.
1
2
conda create -n sd_env python==3.10.6
conda activate sd_env
1
2
git clone https://github.com/openvinotoolkit/stable-diffusion-webui.git
cd stable-diffusion-webui
1
2
export PYTORCH_TRACING_MODE=TORCHFX
export COMMANDLINE_ARGS="--skip-torch-cuda-test --precision full --no-half"
1
2
wget https://huggingface.co/nitrosocke/mo-di-diffusion/resolve/main/moDi-v1-pruned.ckpt
mv moDi-v1-pruned.ckpt models/Stabble-diffusions
1
apt install freeglut3-dev
1
2
3
4
pip install insightface
pip install xformers
pip install
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
1
vim /home/ubuntu/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py
1
./webui.sh --share --listen --enable-insecure-extension-access
- Choose img2img
- Put on the prompt = Modern Cartoon Characters smiling
- Negative prompt = girl women
- Sampling method = DPM++ 2M Keras
- Script = Accelerate with OpenVINO and Override model = DPM++ 2M Keras
* The performance is variative depends on the environment and instance family.Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Image CFG scale: 1.5, Seed: 448692853, Size: 512x768, Denoising strength: 0.75, Version: 1.6.0, Warm up time: 13.81 secs , Performance: 1.09 it/s
Time taken:37.6 sec.
- We can do Generative AI using M7i, R7i and C7i family and powered by CPU Intel(R) 4th Gen
- Stable Diffusion process will be more performing using OpenVINO
- https://github.com/openvinotoolkit/stable-diffusion-webui/wiki/Installation-on-Intel-Silicon
- https://github.com/openvinotoolkit/stable-diffusion-webui?tab=readme-ov-file
- https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/overview.html