Using Disco Diffusion to AI-Generate an Image with Cloud HPC, Faster than Ever

Currently, there are many AI platforms available on the market for users with AI

computing services, among which Google Colab is the most well-known one. However, due to some limitations, it still cannot meet the regular training needs of AI

fans and researchers. For example, the longest running time for Google Colab is 12 hours, even for the Pro edition, the running time can only last 24 hours. Also, the tasks are run on GPUs like K80, P100, T4, etc.


using disco diffusion to ai-generate an image with cloud hpc aws google  cloud azure

As it is widely known, AI training takes a tremendously long time, which highly relies on the performance of the GPUs. AlphaFold2 which is developed by Google DeepMind requires A100 to run tasks.


Cloudam HPC provides users with cost-effective cloud-HPC services for AI/ML, on which users can submit jobs as they prefer. You can submit jobs with command line, or by using Jupyter Notebook/Jupyter Lab to deploy your codes and check data.



AI-generated Painting Goes Viral



Disco Diffusion, an AIGC tool based on CLIP-Guided Diffusion, is all over the internet these days. It can generate a visually pleasing picture by just inputting one sentence. (For detailed technical analysis: https://arxiv.org/abs/2105.05233)


In this article, the main focus is to tell you how to run Diffusion on Cloudam. Before the tutorial, let's see the amazing pictures we generated. Below every picture is the input keywords.


Keywords: high performance computing, cloud,scientist, drug, time, future, cyberpunk


Keywords: artstation, Greg Rutkowski, sea, dikel, ship, industrialization, cloud, time, future, afternoon


If you want a picture with a new style, you can change the keywords in Jupyter Notebook. In this tutorial, the GPU we chose is NVIDIA T4, the image resolution is 1280*768, and other setups are default. It takes about 15 minutes to make an image which is 6 times faster than Google Colab.



Hands-on Disco Diffusion



First of all, start a Jupyter Notebook Desktop with an NVIDIA T4 graphic card, and open it when it is all set.



After it, open the terminal and copy the notebook (Disco_Diffusion.ipynb) and paste it locally.

git clone - https://github.com/alembics/disco-diffusion.git


Since the project needs to run on PyTorch which requires installations on multiple libraries, it is recommended to use Anaconda which is pre-installed on Cloudam, and can be executed by the command line below


module add Anaconda3
source activate

We can build an independent environment to use diffusion, select the 3.9 version of Python, and add the environment to ipykernel.


conda create -n diffusion python=3.9
conda activate 
conda install -c anaconda ipykernel
python -m ipykernel install --user --name=diffusion

Then, we can open Disco_Diffusion.ipynb, and choose diffusion as kernel.



Run the Notebook with 4 steps: build the environment, set models, generate text setup, and generate a picture.


Step 1: Build the environment


The first unit is to check the local CPU