<img alt="" src="https://secure.insightful-enterprise-intelligence.com/783141.png" style="display:none;">

Access NVIDIA H100s from just $2.06/hour. Reserve here

Deploy 8 to 16,384 NVIDIA H100 SXM GPUs on the AI Supercloud. Learn More

|

Published on 29 Oct 2024

How to Generate Images with Stable Diffusion on Hyperstack: A Quick Tutorial

TABLE OF CONTENTS

updated

Updated: 29 Oct 2024

NVIDIA H100 GPUs On-Demand

Sign up/Login

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

  1. Visit the Hyperstack website and log in to your account.
  2. 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.
  3. 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

  1. Navigate to the "Virtual Machines" section and click "Deploy New Virtual Machine."
  2. Click it to start the deployment process.

Select Hardware Configuration

  1. 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

  1. Select the "Server 22.04 LTS R535 CUDA 12.2".
  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

  1. 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

  1. Ensure you assign a Public IP to your Virtual machine.
  2. This allows you to access your VM from the internet, which is crucial for remote management and API access.

Enable SSH Access

  1. Make sure to enable an SSH connection.
  2. You'll need this to connect and manage your VM securely.

Add Firewall Rules

  1. 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

  1. Look for the "Configure Additional Settings" section and click on it.
  2. 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

  1. Double-check all your settings.
  2. 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.
  3. 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

  1. 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

  1. In the Hyperstack dashboard, find your VM's details.
  2. Look for the public IP address, which you will need to connect to your VM with SSH.

Connect via SSH

  1. Open a terminal on your local machine.
  2. 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)
  3. 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.

  1. Disable public-ip.
  2. 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
  3. After running the above command, go to localhost:7860 in your browser to access the demo.

  4. See the attached screenshot for an example:

image-3

Troubleshooting Tips for Stable Diffusion AI on Hyperstack

If you are having any issues, please follow the following instructions:

  1. SSH into your machine.
  2. Run this command to see logs: cat /var/log/cloud-init-output.log
  3. 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:

  1. In the Hyperstack dashboard, locate your Virtual machine.
  2. Look for a "Hibernate" option.
  3. 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:

  1. Return to the Hyperstack dashboard and find your hibernated VM.
  2. Select the "Resume" or "Start" option.
  3. Wait a few moments for the VM to become active.
  4. 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.

Subscribe to Hyperstack!

Enter your email to get updates to your inbox every week

Get Started

Ready to build the next big thing in AI?

Sign up now
Talk to an expert

Share On Social Media

Hyperstack - Tutorials link

23 Oct 2024

IBM has just released Granite 3.0 8B, the latest in its series of LLMs designed for ...

Hyperstack - Tutorials link

22 Oct 2024

The buzz around Llama 3.1 is not over yet as NVIDIA recently released its fine-tuned ...