Stable Diffusion AI is transforming image generation and Hyperstack provides the optimised infrastructure to support it at scale. In this tutorial, we will cover everything from setting up a virtual machine to configuring model access via the Stable Diffusion Web UI. Check out our detailed tutorial below to learn how to generate images with Stable Diffusion on Hyperstack today.
How to Generate Images with Stable Diffusion on Hyperstack
Let's walk through the step-by-step process to generate images with stable diffusion on Hyperstack:
Step 1: Accessing Hyperstack
- Visit the Hyperstack website and log in to your account.
- If you don't already have an account, you'll need to create one and set up your billing information. Check our documentation to get started with Hyperstack.
- Once logged in, you'll enter the Hyperstack dashboard, which provides an overview of your resources and deployments.
Step 2: Deploying a New Virtual Machine
Initiate Deployment
- Navigate to the "Virtual Machines" section and click "Deploy New Virtual Machine."
- Click it to start the deployment process.
Select Hardware Configuration
- For small images, we recommend choosing the NVIDIA RTX A6000 x1. For large or batch of images, we recommend the NVIDIA A100 x1.
Choose the Operating System
- Select the "Server 22.04 LTS R535 CUDA 12.2".
- This image comes pre-installed with Ubuntu 22.04 LTS, NVIDIA drivers (R535), and CUDA 12.2, providing an optimised environment for AI workloads.
Select a Keypair
- Select one of the keypairs in your account. If you don't have a keypair yet, see our Getting Started tutorial for creating one.
Network Configuration
- Ensure you assign a Public IP to your Virtual machine.
- This allows you to access your VM from the internet, which is crucial for remote management and API access.
Enable SSH Access
- Make sure to enable an SSH connection.
- You'll need this to connect and manage your VM securely.
Add Firewall Rules
- Open port "7680" to allow incoming traffic on this port.
Please note: This will open your port to the public internet, allowing anyone with the public IP address and port number to access the dashboard. In case you don't want this, please refer to the section below "Interacting with Stable Diffusion Web UI"
Configure Additional Settings
- Look for the "Configure Additional Settings" section and click on it.
- Here, you'll find a field for cloud-init scripts. Use the provided cloud-init script for deployment and ensure it is in bash syntax. This script is pre-configured to deploy the StableDiffusion v1.5 model by default, which is optimised for speed. Click here to get the cloud-init script!
Review and Deploy the Script
- Double-check all your settings.
- Paste the cloud-init script into the initialisation section when deploying your VM. The script will automatically install the necessary dependencies, clone the repository, and set up the environment. This script uses the AUTOMATIC1111/stablediffusion-webui repository.
- Click the "Deploy" button to launch your virtual machine.
DISCLAIMER
This tutorial will only enable the Stable Diffusion WebUI once for demo-ing purposes. For production environments, consider using containerised deployment, secure connections and authentication, secret management, monitoring etc.
Step 3: Setting Up the Model
- Set up time of cloud-init script: +-5 minutes to install libraries, download models and set up the UI.
Step 4: Accessing Your VM
Once the initialisation is complete, you can access your VM:
Locate SSH Details
- In the Hyperstack dashboard, find your VM's details.
- Look for the public IP address, which you will need to connect to your VM with SSH.
Connect via SSH
- Open a terminal on your local machine.
- Use the command ssh -i [path_to_ssh_key] [os_username]@[vm_ip_address] (e.g: ssh -i /users/username/downloads/keypair_hyperstack ubuntu@0.0.0.0.0)
- Replace username and ip_address with the details provided by Hyperstack.
Interacting with the Stable Diffusion Web UI
Once the deployment is complete, access the Stable Diffusion Web UI by navigating to[public-ip]:7860 in your web browser to generate images with stable diffusion.
Please note: This link will be accessible to anyone with the link. To restrict access, you can disable the Public IP and use SSH port forwarding instead.
- Disable public-ip.
- Use SSH port forwarding together with your keypair, with this command:
ssh -i [path_to_ssh_key] -L 7860:localhost:7860 [os_username]@[vm_ip_address] # e.g: ssh -i /users/username/downloads/keypair_hyperstack -L 7860:localhost:7860 ubuntu@0.0.0.0
-
After running the above command, go to localhost:7860 in your browser to access the demo.
- See the attached screenshot for an example:
Troubleshooting Tips for Stable Diffusion AI on Hyperstack
If you are having any issues, please follow the following instructions:
- SSH into your machine.
- Run this command to see logs:
cat /var/log/cloud-init-output.log
- Debug any issues you see there.
Step 5: Hibernating Your VM
When you're finished with your current workload, you can hibernate your VM to avoid incurring unnecessary costs:
- In the Hyperstack dashboard, locate your Virtual machine.
- Look for a "Hibernate" option.
- Click to hibernate the VM, which will stop billing for compute resources while preserving your setup.
To continue your work without repeating the setup process:
- Return to the Hyperstack dashboard and find your hibernated VM.
- Select the "Resume" or "Start" option.
- Wait a few moments for the VM to become active.
- Reconnect via SSH using the same credentials as before.
Similar Reads:
FAQs
How can I generate images with Stable Diffusion on Hyperstack?
You can generate images by following our tutorial above which walks you through deploying a VM, configuring Stable Diffusion and accessing the Web UI.
Is Stable Diffusion AI available on Hyperstack?
Yes, Stable Diffusion AI is fully supported on Hyperstack, providing high-performance GPUs like the NVIDIA A100 80GB optimised for large AI models, ideal for fast image generation.
Is it possible to generate images with Stable Diffusion for free on Hyperstack?
Hyperstack’s flexible pricing means you can start generating images with Stable Diffusion without commitment to high upfront costs, almost like generating images with Stable Diffusion free.