How to use SMU M3 Virtual Dekstop
Overview
Teaching: 5 min min
Exercises: 0 minQuestions
How to use SMU M3 Virtual Dekstop?
Objectives
1. SMU ManeFrame 3 Virtual Desktop
- In order to use User Interface with GPU support for Stable Diffusion, we need to use the Virtual Desktop from ManeFrame 3
- To access the Virtual Desktop, visit: hpc.m3.smu.edu, select Remote Desktop on the left sidebar with following information:
- Slurm Account: smu (workshop is only for the workshop day)
- Partition: gpu-dev (workshop is only for the workshop day) Note: gpu-dev is the development queue that have gpu available, each node has 8 V100 NVIDIA GPUs. The limitation of this dev queue is 2 hours walltime
- Time: 2 hours
- Cores per node: 4
- Memory: 16gb
- Number of GPUs: 1
-
Hit launch.
- Select High Image quality for better resolution
- If you see the following screen, click on MATE terminal (or search for Terminal in the Menu box)
Key Points
M3 Virtual Desktop
Creating your own conda environment
Overview
Teaching: 5 min min
Exercises: 0 minQuestions
How to create conda environment with GPU supported library
Objectives
2. Creating the conda environment
Now it the time to create your own conda environment so that you can get the GPU supported library working for you. Follow these steps:
Load neccesary modules with GPU supported library
$ module load spack conda cuda-11.8.0-gcc-11.2.0/cudnn/8.7.0.84-11.8-aydlfs6 cuda/gcc-11.2.0/cuda/11.8.0-vnha6cm
Create conda environment and name it sd (for stable diffusion), save it on your desktop:
$ conda create --prefix ~/sd python=3.10.13 pip –y
activate it once you done creating the environment:
$ conda activate ~/sd
Key Points
Conda environment, GPU, cuda
Install Automatic1111 to M3
Overview
Teaching: 5 min min
Exercises: 0 minQuestions
How to install Automatic1111 and use the UI?
Objectives
3. Install Automatic1111 onto M3 with UI and GPU supported
One of the most popular UI for Stable Diffusion is Automatic1111 which is an open source project and can be found from their github: https://github.com/AUTOMATIC1111/stable-diffusion-webui
The following steps instruct you to install it on SMU M3, after creating the conda env and activate it in Step 1:
$ conda activate ~/sd
Download the model (either by gitclone or download zip file from their repo):
I encourage you to download it to your $WORK folder since you have plenty of space (avoid the limitted $HOME storage):
$ cd $WORK
$ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
Next download one sample checkpoint (pre-trained model) for your usage.
I suggest to download one from HuggingFace, runwayml
- Navigate to https://huggingface.co/runwayml/stable-diffusion-v1-5
- Select Files and versions
- Right click and copy link address of the ckpt file
$ cd $WORK/stable-diffusion-webui/models/Stable-diffusion
$ wget https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.ckpt
You can download as many checkpoint in the format of ckpt or safetensors to the models folder for your usage.
Run the executable: webui.sh
$ cd $WORK/stable-diffusion-webui
$ ./webui.sh
If you see the http link appear as in the screenshot below, copy it and paste to the Chrome browser from the Virtual Desktop:
Want to have shortcut?
Put the following line to your bashrc file:
$ echo alias sd1="'module load spack conda && module load cuda-11.8.0-gcc-11.2.0/cudnn/8.7.0.84-11.8-aydlfs6 cuda/gcc-11.2.0/cuda/11.8.0-vnha6cm && conda activate ~/sd && cd $WORK/stable-diffusion-webui && ./webui.sh'" >> ~/.bashrc
$ source ~/.bashrc
$ sd1
Key Points
Automatic1111, GUI
Installing ComfyUI to M3
Overview
Teaching: 20 min
Exercises: 0 minQuestions
How to use install ComfyUI?
Objectives
Install ComfyUI
4. Install ComfyUI to M3
Alternative to Automatic1111, is ComfyUI which is an open source project and can be found from their github: https://github.com/AUTOMATIC1111/stable-diffusion-webui
The following steps instruct you to install it on SMU M3, after creating the conda env and activate it in Step 1:
$ conda activate ~/sd
Download the model (either by gitclone or download zip file from their repo):
I encourage you to download it to your $WORK folder since you have plenty of space (avoid the limitted $HOME storage):
$ cd $WORK
$ git clone https://github.com/comfyanonymous/ComfyUI.git
$ cd ComfyUI/custom_nodes
$ git clone https://github.com/ltdrdata/ComfyUI-Manager.git
Run the GUI
$ cd $WORK/ComfyUI
$ pip install -r requirement.txt
$ python main.py
If you see the http link appear as in the screenshot below, copy it and paste to the Chrome browser from the Virtual Desktop:
Key Points
ComfyUI
Install InvokeAI to M3
Overview
Teaching: 20 min
Exercises: 0 minQuestions
How to install InvokeAI to M3
Objectives
Install InvokeAI
5. Install InvokeAI to M3
Alternative to Automatic1111 and ComfyUI, InvokeAI is open source package: https://github.com/invoke-ai/InvokeAI
The following steps instruct you to install it on SMU M3, after creating the conda env and activate it in Step 1:
$ conda activate ~/sd
Download the latest model (either by gitclone or download zip file from their repo):
https://github.com/invoke-ai/InvokeAI/releases/tag/3.7.0
I encourage you to download it to your $WORK folder since you have plenty of space (avoid the limitted $HOME storage):
$ cd $WORK
$ wget https://github.com/invoke-ai/InvokeAI/releases/download/3.7.0/InvokeAI-installer-v3.7.0.zip
Unzip and Run the installer
$ cd $WORK
$ unzip InvokeAI-installer-v3.7.0.zip
$ cd InvokeAI-Installer
$ ./install.sh
Follow the prompt, when asked to select the install destination, change it to
/lustre/work/client/users/**$your_username**/invokeai
- Remember to select 1 for an NVIDIA GPU (using CUDA),
- Select a for automatic install
Once done installation, you can run the GUI:
$ cd $WORK/invokeai
$ ./invoke.sh
Select 1 to “Generate images with a browser-based interface”
If you see the http link appear as in the screenshot below, copy it and paste to the Chrome browser from the Virtual Desktop:
Run the sample:
Key Points
InvokeAI
Install Fooocus to M3
Overview
Teaching: 15 min min
Exercises: 0 minQuestions
Install Fooocus to M3
Objectives
5. Install Fooocus to M3
Foocus is open source package: https://github.com/invoke-ai/InvokeAI
The following steps instruct you to install it on SMU M3, after creating the conda env and activate it in Step 1:
$ conda activate ~/sd
Download the latest model (either by gitclone or download zip file from their repo):
I encourage you to download it to your $WORK folder since you have plenty of space (avoid the limitted $HOME storage):
$ cd $WORK
$ git clone https://github.com/lllyasviel/Fooocus.git
Run the installer
$ cd $WORK/Fooocus
$ python launch.py
If you see the http link appear as in the screenshot below, copy it and paste to the Chrome browser from the Virtual Desktop:
And run a sample:
Key Points
Foocus
Port-Forwarding your UI with SuperPOD
Overview
Teaching: 5 min min
Exercises: 0 minQuestions
How to Port-Forwarding with SuperPOD
Objectives
7. Using SuperPOD
The method of using conda environment in SuperPOD is similar to ManeFrame 3. These are the steps:
1. Setup your own conda environment in SuperPOD with cuda library supported (refer to my SuperPOD 101 lecture notes)
2. Install the Stable Diffusion UI model onto your SuperPOD account (Automatic1111,ComfyUI, InvokeAI, Fooocus)
3. Notice the following ports are used for each model:
- Automatic1111: 172.0.0.1:7860
- ComfyUI: 172.0.0.1:8188
- InvokeAI: 172.0.0.1:9090
- Fooocus: 172.0.0.1:7865
4. Setup the model using the following method with 2 opened terminal
4.1. Terminal 1
- ssh to superpod account with Dynamic port number, for example port 8000 and request a compute node:
$ ssh -C -D 8000 tuev@superpod.smu.edu
$ srun -N 1 -G 1 -c 10 --mem=64gb --time=12:00:00 --pty $SHELL
Assume you are given a node name: bcm-dgxa100-0001
- Load neccessary libraries:
$ module load conda gcc cuda cudnn
- Activate the conda environment for stable diffusion
$ conda activate ~/sd
- Go to the UI model, for example stable-diffusion-webui for Automatic1111 and run the command:
$ cd $WORK/stable-diffusion-webui
$ jupyter lab &
$ ./webui.sh & # Note this is changed for each model (ComfyUI, InvokeAI, Fooocus)
Leave this terminal 1 going on and open another terminal
4.2. Terminal 2
Now you will need to ssh to the SuperPOD with the Dynamic and Static port and the requested node bcm-dgxa100-0001.
$ ssh -J tuev@superpod.smu.edu tuev@bcm-dgxa100-0001 -L 8000:localhost:8000 -L 7860:localhost:7860
Enter password twice with DUO, then you will be logged in a node
4.3. Open your browser that you have already setup the forwarding port to localhost with port 8000
Type in the address 127.0.0.1:7860, you will be able to run Automatic1111.
Do the same step for other UI model.
Key Points
Conda environment, GPU, cuda