Running Stable Diffusion on AWS with an Insane 8GPU 196GB Video Memory EC2 Instance

Published: 05 September 2022
on channel: Code Workshop
10,035
160

Let's set up a workflow for experimenting with Stable Diffusion (or other machine learning work) on an AWS EC2 instance designed for Machine Learning engineers. We'll cover provisioning the instance, installing the Stable Diffusion code and models, configuring the EC2 instance to share files via an S3 bucket, and try doing our first text2image and image2image model runs on EC2. I'll also show you how to stop the image when you're not using it and how to bring it back online.

Disclaimer: AWS is a powerful tool but it can be easy to over spend, or to open yourself up to security vulnerabilities. If you do not already know how to use AWS there are easier ways for you to experiment with Stable Diffusion. The StableDiffusion subreddit has a great guide that will help you run Stable Diffusion for free on your own computer, or in the cloud. Running on AWS is for advanced users who want to control their infrastructure and who plan to build on top of it.

  / guide  

UPDATE: This video was made shortly after Stable Diffusion was released and there has been a lot of progress on the best workflow to self host Stable Diffusion.

If you want to get a modern WebUI installed to run StableDiffusion Text2Img, Img2Img, or DreamBooth training you can still follow everything in this video up to the section called Connecting to EC2 Instance over SSH (You can use a g5.xlarge instance instead of the g5.48xlarge used in the video, it's much cheaper and still gives you a 24gb NVIDIA A10G) that will get you a running machine in the cloud. Then instead of using the default Stable Diffusion repo, it's much easier to use the Automatic1111 WebUI. You can find the instructions for installing it on Linux here. https://github.com/AUTOMATIC1111/stab...

I've been Using the Automatic1111 UI on this instance for a while now and it works great for pretty much everything you'd want to do.


0:00 Introduction
0:40 AWS Warning
1:30 Creating an EC2 Instance
5:25 Connecting to EC2 Instance over SSH
6:09 Cloning the Stable Diffusion Repository in to the EC2 Instance
8:53 Download the Stable Diffusion Weights on EC2 Instance
11:10 Run the Text to Image Script
14:49 Configure an S3 Bucket to transfer Output and Input Files
19:00 Viewing the results of our first model run
19:28 Run the Image to Image Script
23:07 Stopping the EC2 instance when not in use
23:45 Restarting the EC2 instance


Watch video Running Stable Diffusion on AWS with an Insane 8GPU 196GB Video Memory EC2 Instance online without registration, duration hours minute second in high quality. This video was added by user Code Workshop 05 September 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 10,035 once and liked it 160 people.