Building a Stable Diffusion WebUI environment with RunPod
gladevise
Posted on May 7, 2023
As Google Colab has restricted the execution of Stable Diffusion in the free tier, we introduce RunPod as an alternative cloud resource.
What you need:
- $10
- RunPod account
- Backblaze account
First, visit RunPod and Backblaze to create accounts.
Paying the fee
RunPod requires a prepayment, so you will need to pay a minimum of $10 upfront.
You will be redirected to the Stripe page, where you can enter your credit card information.
If your payment is successful, the following screen will be displayed.
Building a Stable Diffusion environment
We will build a Stable Diffusion environment with RunPod.
Go to the Secure Cloud and select the resources you want to use. In this case, we will choose the cheapest option, the RTX A4000.
From the existing templates, select RunPod Fast Stable Diffusion.
Once the confirmation screen is displayed, click Deploy.
Click My Pods and check the deployed Pod.
After confirming that the CPU usage has decreased, click Connect and then Connect to Jupyter Lab.
Open the RNPD-A1111.ipynb file.
Once the notebook is open, execute the cells in order from Dependencies, Install/Update AUTOMATIC1111 repo, Model Download/Load, ControlNet, to Start Stable-Diffusion.
When you run Start Stable-Diffusion, a URL like Running on local URL: https://foobar-3000.proxy.runpod.net
will be displayed, so access it.
Enjoy generating images within the limits of your credit with the familiar interface.
To stop, click Stop in My Pods.
A confirmation screen will appear, so click Stop Pod.
As mentioned on the confirmation screen, RunPod will continue to charge you until the storage you are using is released, even after stopping the Pod. In the example above, $0.014 will be deducted per hour.
The only way to stop this is to click Terminate to completely delete the Pod.
Saving RunPod data with Backblaze
As it stands, the generated images will be lost, so we will save them to Backblaze.
Go to Backblaze and click Create a Bucket from Buckets.
Enter the Bucket Unique Name and click Create a Bucket.
Next, go to Application Keys.
Click Add a New Application Key to issue a new key.
Enter the key name and specify the bucket you set earlier.
Take note of the keyID and keyName displayed here.
Return to RunPod and click CloudSync.
When the cloud storage selection screen appears, click Backblaze B2.
Click Copy to Backblaze B2.
Enter the keyID and keyName you noted earlier as follows:
Account ID: keyID displayed when generating the key in Backblaze
Application Key: keyName displayed when generating the key in Backblaze
Bucket Path: {bucket} is the bucketName, {folder} is an appropriate name. ex: RunPodCloudSyncSDWebUI/fast-stable-diffusion
Pod Path: /workspace
This will save the output results and properties of Stable Diffusion to Backblaze B2.
Once the upload is complete, you can check the specified folder in Backblaze's Browse Files to see that the files have been saved.
Now, even if you terminate the Pod, the generated images will not be lost. When launching the next Pod, click Copy from Backblaze B2 to copy files from Backblaze B2, allowing you to continue generating images from where you left off.
Conclusion
- If you frequently generate images with Stable Diffusion, Google Colab Pro is more cost-effective.
- If you only generate images occasionally with Stable Diffusion, RunPod's pay-as-you-go flexibility may be better.
- If you temporarily need more specs than those provided by Google Colab, such as for model training, RunPod is more suitable.
Posted on May 7, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.