Creating Stable Diffusion Docker Image and its Docker Container

First step was get the text to image python code from their official github repository

Making a docker file (just the imports, which python libraries, such as pytorch, and directories)

Making directories, putting an environment file (version, diffusion, model), running the code

Creating the docker image by going through the lifecycle

Creating, building, pushing to dockerhub docker build -f /Users/somyatomar/stable-diffusor-docker-text2image/Dockerfile .

Connecting to dockerhub from remote setup (Colab for now)

Docker run + path of image

Connect it

Run the python environment (anaconda) run text2image python file (pass in prompt, command with structure)

All we need is a GPU and server to run the script == Bacalhau, Runpod, Huggingface, Colab

Key question is on how to experiment with the different options

Service/GPU type

Models

S.No. Link Learnt Emoji
1. https://towardsdatascience.com/stable-diffusion-using-hugging-face-501d8dbdd8 Stable diffusion’s entire code and concept explanation. Nothing left under the hood. 😎
2. https://towardsdatascience.com/launch-a-web-api-for-stable-diffusion-under-45-seconds-bbd88cfe41d8

https://towardsdatascience.com/launch-a-web-api-for-stable-diffusion-under-45-seconds-bbd88cfe41d8 | Implementing this for paid GPU performance testing | 😍 | | 3. | https://www.reddit.com/r/StableDiffusion/comments/10ifs37/gpu_rtx_3060_12gb_or_3060_ti_8gb/ | people discussing which config of GPUs work best for Stable Diff | ✌️ | | 4. | ‣ | Text-to-Image (txt2img) To run: ./build.sh run 'Andromeda galaxy in a bottle' | 🤩 | | 5. | https://hub.docker.com/r/sharrnah/stable-diffusion-guitard | | 🤓 | | 6. | https://stablediffusionapi.com/

https://documenter.getpostman.com/view/18679074/2s83zdwReZ#intro | Stable Diffusion and DreamBooth APIs for remote model access

What is price of dreambooth API? Each dreambooth model is of 4$, you can buy API access credits plan from 8$, 49$ and 149$. These are API access plans. There is no training fee. Only API access fee.

Do i need any GPU to use Stable Diffusion? No, Its API which connects to Our GPUs, we do processing for you. So you can generates images in seconds.

Can I use Commercially? Yes, all images you generate have your copyright. Use it as you like or sell as you like. | 💲 | | 7. | https://github.com/JustinGuese/stable-diffusor-docker-text2image/blob/master/txt2img.py | dockerized https://github.com/CompVis/stable-diffusion

needs to run the command a little different to activate docker: conda run -n ldm /bin/bash -c "python scripts/txt2img.py --prompt 'talking chicken nuggets being scared to be eaten' --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1" | ❤️ | | 8. | ‣ | Easy Docker setup for Stable Diffusion with user-friendly UI | 🚀 | | 9. | https://hub.docker.com/r/kestr3l/stable-diffusion-webui | First find its docker image in docker hub, don’t re-invent the wheel

Dockerized Stable-Diffusion-Webui based on AUTOMATIC1111/stable-diffusion-webui Prequisites

  1. Linux environment (WSL2 is fine)
  2. 'Appropriate' GPU
  3. docker-ce
  4. docker-compose
  5. NVIDIA Container Toolkit
  6. Basic knowledges of Linux commands | 🔥 | | 10. | https://hub.docker.com/r/av11/stablediffusion_webui_automatic1111/tags | | | | 11. | https://hub.docker.com/r/nicklucche/stable-diffusion/tags | The one that worked- https://github.com/NickLucche/stable-diffusion-nvidia-docker | 🚀 | | 12. | How to Run Stable Diffusion on EC2 | See pricing and get some idea of things other than docker for cloud compute | 👀 | | 13. | https://youtu.be/rt4kYmcwtu8 | Vast.ai, RunPod, Stable Diffusion Depth Image Model | | | 14. | https://medium.com/@baichuansun/deploy-stable-diffusion-on-amazon-sagemaker-endpoint-c6f6e1097a5 | Deploy Stable Diffusion on Amazon SageMaker Endpoint | | | 15. | https://medium.com/@vishnuvig/deploy-stable-diffusion-on-gpu-instance-using-fastapi-d0743eeb735d | Deploy stable diffusion on GPU instance using FastAPI In this blog, let’s explore how we can deploy a Stable diffusion model on a GPU and expose it as an API. To do this we will use GPU instance using Jarvislabs —— applied for student scholarship https://jarvislabs.ai/pricing/ | | | 16. | https://www.youtube.com/watch?v=Kxlcj7BnO8I https://replicate.com/stability-ai/stable-diffusion | Using Replicate | | | 17. | https://github.com/rapidrabbit76/stable-diffusion-API

https://github.com/shyamsn97/stable-diffusion-server

https://www.kaggle.com/code/dhruviiitb/stable-diffusion-fastapi-html-colabcode | Google Search Results for - “fast api for stable diffusion” | | | 18. | https://youtu.be/ReO6vqJxg-s | Deploy Stable Diffusion as Service - Build your own Stable Diffusion API | | | 19. | Google it | SD on Azure | | | 20. | https://www.reddit.com/r/StableDiffusion/comments/wqaizj/list_of_stable_diffusion_systems/ | List of Stable Diffusion best systems | | | 21. | https://github.com/runpod/runpodctl/blob/main/README.md | runpodctl is a CLI tool to automate / manage GPU pods for runpod.io | | | 22. | https://lightning.ai/pages/community/tutorial/deploy-diffusion-models/ | How to Deploy Diffusion Models from the creators of Pytorch lightening Autoscaling the Model Servers | | | 23. | https://github.com/SouravJohar/ocr-tool | OCR | | | 24. | https://github.com/chetan/fast-ocr-api | OCR, hurray it works | | | 25. | https://blog.logrocket.com/deploying-fastapi-applications-to-vercel/ | Deploying FastAPI applications to Vercel | | | 26. | https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features | sd features & updates | | | | | | |


I also figured out that for expanding beyond just dragonborns we can deploy different models into the same pipeline, and according to the charactersheet the model gets selected.. so if the charactersheet says dragonborn then DnDDragonborn.cpkt file gets loaded out of a bunch of other DnDtrained models..

Handling concurrent users in SD Startups

Screenshot 2023-02-09 at 8.16.26 PM.png

Screenshot 2023-01-30 at 5.35.50 AM.png

I can use runpod’s SD docker image and insert our model using command line

Screenshot 2023-02-09 at 8.20.49 PM.png