Stable diffusion is a new AI technique for generating images that are both realistic and creative. It is based on the diffusion models that have been used for image generation for many years, but it has been improved to be more stable and to generate higher-quality images.
In this blog article, I will show you how to set up Stable diffusion on Paperspace cloud platform. Paperspace is a great option for running stable diffusion because it offers powerful GPUs that can handle the computationally demanding task of image generation.
What is Paperspace?
Paperspace is a cloud computing platform that offers GPU-powered virtual machines. It is a great option for running computationally demanding tasks such as image generation with stable diffusion.
Paperspace offers paid plans starting at $8 per month that allow you to use a Free GPU for up to 6 hours per day and you can restart the notebook and use it again. This is sufficient for running the stable diffusion web UI.
Benefits of using PaperSpace for stable diffusion:
- Paperspace offers powerful GPUs that can handle the computationally demanding task of image generation.
- Paperspace is easy to use and can be set up in minutes.
- Paperspace is affordable, with plans starting at just $8 per month.
How do I run the Stable diffusion on PaperSpace ?
There are two ways to run the stable diffusion workspace on Paperspace:
- Using the automatic1111 web UI: This is the easiest way to get started with stable diffusion on PaperSpace. The web UI takes care of all the setup and configuration for you, so you can just focus on generating images.
- Setting up your own environment: This gives you more control over the setup, but it is more complex. You will need to install the necessary software, configure the environment, and download the stable diffusion model.
I suggest utilizing the automatic1111 web UI if you’re unfamiliar with stable diffusion or aiming for a straightforward initiation process. Opting for the automatic1111 web UI when running stable diffusion on PaperSpace is a wise decision due to its user-friendly nature and its ability to handle all the necessary setup and configuration tasks on your behalf.
This guide will demonstrate the steps to effectively employ the Automatic1111 web UI on the PaperSpace platform.
Installing Stable Diffusion Automatic1111 WebUI on PaperSpace Notebook
Upgrade to a Suitable PaperSpace Plan:
- To utilize the Automatic1111 WebUI for stable diffusion, you’ll require a robust graphics card. Paperspace offers powerful graphics cards for free, but these are accessible under the pro or growth subscription plans. If you’re not already on a paid plan, you can upgrade through this link: https://www.paperspace.com/pricing
Create a PaperSpace Project:
- Log in to your Paperspace account. Choose the “Gradient” option from the dashboard. Click on “Create Project” and provide a meaningful name for your project. Create the project.
- Set Up a Notebook Environment
- Inside your created project, select “Create Notebook.”
- Choose “PyTorch” as the runtime for the notebook.
- Choose a GPU:
- Under “Select a Machine,” opt for any of the available free GPUs.
- Click on “Start Notebook.” This ensures that you only choose a GPU marked as “free” to avoid extra charges beyond your subscription.
- Access the Notebook:
- Once the notebook starts, you’ll be redirected to a new page. Allow some time for the notebook to initialize.
- Upon startup completion, choose the “Open in JupyterLab” option.
- Setup Commands in JupyterLab:
The JupyterLab interface will open, providing you with a notebook environment.
- Run Necessary Commands:
Inside the JupyterLab notebook, follow these steps:
- Create a new notebook
- Create a new notebook cell.
- Copy and paste the commands
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
%cd /notebooks/stable-diffusion-webui
!git checkout master
!git pull
- Create another new notebook cell.
- Copy and paste the commands
!pip uninstall -y torch torchvision torchaudio protobuf
- Create a final new notebook cell.
- Copy and paste the commands
%cd /notebooks/stable-diffusion-webui
!python launch.py --share --xformers --enable-insecure-extension-access
- Run each cell sequentially by clicking the “Run” button for each cell. This will execute the required commands for setup.
- Access WebUI Link:
After running the third command, a link will be provided as output in the notebook. Please refer to the red box highlighted in the image below. Click on the provided link. This will redirect you to the Stable Diffusion Automatic1111 WebUI interface.
- Start Image Generation:
Upon accessing the Automatic1111 WebUI, you can start generating images using the stable diffusion models.
By following these steps, you’ll successfully set up the Stable Diffusion Automatic1111 WebUI on your Paperspace Notebook, enabling you to generate images using the stable diffusion models.