First we're going to install everything, then quit and relaunch it with a SLURM batch script using the same technique as running a Jupyter Notebook locally. In day to day use, you'll use the SLURM batch script.
Move to your working directory on "blue":
Code: Select all
cd /blue/art4612/share/<gatorlink>/
Code: Select all
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
Code: Select all
cd stable-diffusion-webui
nano webui-user.sh
Modify the TORCH_COMMAND to be:
Code: Select all
export TORCH_COMMAND="pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113"
Grab a GPU. Modify this based on how long you want, etc:
Code: Select all
srun -p gpu --nodes=1 --gpus=a100:1 --time=2:00:00 --mem=16gb --ntasks=1 --cpus-per-task=1 --pty -u -A art4612 -q art4612 bash -i
Code: Select all
module load cuda
module load gcc
module load git
module load pytorch/1.10
module load ffmpeg/4.3.1
module save webui
Code: Select all
module r webui
Code: Select all
module list
Code: Select all
module spider ffmpeg
Code: Select all
cd models/Stable-diffusion
cp ../../../../models/Stable-diffusion/sd-v1-4.ckpt .
Now we can proceed with installing the necessary dependencies and run webui.
Change directories from your current location (models/Stable-diffusion) to the root install directory (stable-diffusion-webui):
Code: Select all
cd ../../
Code: Select all
bash webui.sh
Move out of our current working directory and clone "slurm_examples":
Code: Select all
cd ..
git clone https://github.com/jstenner/slurm_examples.git
By now, you should know how to edit SLURM batch scripts to customize them for your purposes (e.g. runtime). Move to your webui working directory and edit the batch script:
Code: Select all
cd stable-diffusion-webui
nano webui_sbatch.sh
Set the time you want the job to run. Set your gradio-auth USERNAME:PASSWD in the python command on the last line.
Save your changes: Ctrl + o, Enter, Ctrl + x.
Now LAUNCH:
Code: Select all
sbatch webui_sbatch.sh
Code: Select all
tail -f webui_<jobid>.out
Finally, copy/paste the "Local browser URI" into your web browser. It may not work immediately because the application is still loading the model and starting up. After a minute or two, the Gradio login page should appear and you're ready to login and get started!
Notice that as you render, you'll get feedback about what's happening in your main terminal window (the one with "tail" running). At first webui needs to download certain models and support files so it may be a bit slow. Once everything is available to you, it's very quick.
HAVE FUN!
To quit, type "Ctrl + c" in your shell tunnel terminal window to close that down.
Type "Ctrl + c" in your main terminal window to close "tail". Then type:
Code: Select all
squeuemine
Code: Select all
scancel <JOBID>
Code: Select all
exit
