Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e
- set -x
- # forward port 8188 in runpod first, before running an instance
- echo "Did you forward the port 8188 in your runpod instance? Press Enter to continue..."
- read
- # Check if /workspace exists
- if [ ! -d "/workspace" ]; then
- echo "/workspace directory does not exist. Creating it now..."
- mkdir /workspace
- echo "NOTE: If /workspace doesn't exist, you're probably running this script on a different environment than runpod. The script will still attempt to install everything."
- fi
- # install comfyui
- cd /workspace
- if [ -d "ComfyUI" ]; then
- echo "ComfyUI repository already exists. Pulling latest changes..."
- cd ComfyUI
- git pull
- else
- echo "Cloning ComfyUI repository..."
- git clone https://github.com/comfyanonymous/ComfyUI
- cd ComfyUI
- fi
- pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 xformers
- pip install -r requirements.txt
- # install custom nodes
- cd custom_nodes/
- if [ -d "ComfyUI-Manager" ]; then
- echo "ComfyUI-Manager repository already exists. Pulling latest changes..."
- cd ComfyUI-Manager
- git pull
- cd ..
- else
- echo "Cloning ComfyUI-Manager repository..."
- git clone https://github.com/ltdrdata/ComfyUI-Manager
- fi
- if [ -d "comfyui_controlnet_aux" ]; then
- echo "comfyui_controlnet_aux repository already exists. Pulling latest changes..."
- cd comfyui_controlnet_aux
- git pull
- cd ..
- else
- echo "Cloning comfyui_controlnet_aux repository..."
- git clone https://github.com/Fannovel16/comfyui_controlnet_aux/
- fi
- pip install -r comfyui_controlnet_aux/requirements.txt
- if [ -d "stability-ComfyUI-nodes" ]; then
- echo "stability-ComfyUI-nodes repository already exists. Pulling latest changes..."
- cd stability-ComfyUI-nodes
- git pull
- cd ..
- else
- echo "Cloning stability-ComfyUI-nodes repository..."
- git clone https://github.com/Stability-AI/stability-ComfyUI-nodes
- fi
- if [ -d "ComfyUI-post-processing-nodes" ]; then
- echo "ComfyUI-post-processing-nodes repository already exists. Pulling latest changes..."
- cd ComfyUI-post-processing-nodes
- git pull
- cd ..
- else
- echo "Cloning ComfyUI-post-processing-nodes repository..."
- git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes
- fi
- # Download SDXL (and VAE 0.9) based on user's choice
- cd ../models/checkpoints
- echo "Select the model you want to download:"
- echo "1. SDXL1.0 base and refiner with integrated 0.9 VAE (fixed VAE)"
- echo "2. SDXL1.0 base and refiner with 1.0 VAE (buggy) and download fixed and faster fp16 VAE 0.9 - so you must separately load the VAE in your workflows"
- echo "3. Both of the above (downloads all 4 models plus the faster fp16 VAE 0.9)"
- read -p "Enter your choice (1/2/3): " choice
- case $choice in
- 1)
- [ ! -f sd_xl_base_1.0_0.9vae.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors
- [ ! -f sd_xl_refiner_1.0_0.9vae.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors
- ;;
- 2)
- [ ! -f sd_xl_base_1.0.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
- [ ! -f sd_xl_refiner_1.0.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors
- [ ! -f sdxl_vae.safetensors ] && wget https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors
- ;;
- 3)
- [ ! -f sd_xl_base_1.0_0.9vae.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors
- [ ! -f sd_xl_refiner_1.0_0.9vae.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors
- [ ! -f sd_xl_base_1.0.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
- [ ! -f sd_xl_refiner_1.0.safetensors ] && wget https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors
- [ ! -f sdxl_vae.safetensors ] && wget https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors
- ;;
- *)
- echo "Invalid choice. Exiting."
- exit 1
- ;;
- esac
- # download controlnets
- cd ../controlnet
- [ ! -f controlnet-canny-sdxl-1.0.safetensors ] && wget -O controlnet-canny-sdxl-1.0.safetensors https://huggingface.co/diffusers/controlnet-canny-sdxl-1.0/resolve/main/diffusion_pytorch_model.fp16.safetensors
- [ ! -f controlnet-depth-sdxl-1.0.safetensors ] && wget -O controlnet-depth-sdxl-1.0.safetensors https://huggingface.co/diffusers/controlnet-depth-sdxl-1.0/resolve/main/diffusion_pytorch_model.fp16.safetensors
- # download control loras
- [ ! -d control-lora ] && mkdir control-lora
- cd control-lora
- [ ! -f control-lora-canny-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-canny-rank256.safetensors
- [ ! -f control-lora-depth-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-depth-rank256.safetensors
- [ ! -f control-lora-recolor-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-recolor-rank256.safetensors
- [ ! -f control-lora-sketch-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-sketch-rank256.safetensors
- # download clip vision
- cd ../../clip_vision
- [ ! -f clip_vision_g.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/revision/clip_vision_g.safetensors
- cd ../..
- # download workflows
- [ ! -d workflows ] && mkdir workflows
- cd workflows
- [ ! -f revision-image_mixing_example.json ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/revision/revision-image_mixing_example.json
- [ ! -f control-lora-canny-basic_example.json ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/comfy-control-LoRA-workflows/control-lora-canny-basic_example.json
- [ ! -f control-lora-depth-basic_example.json ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/comfy-control-LoRA-workflows/control-lora-depth-basic_example.json
- [ ! -f control-lora-recolor-basic_example.json ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/comfy-control-LoRA-workflows/control-lora-recolor-basic_example.json
- [ ! -f control-lora-sketch-basic_example.json ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/comfy-control-LoRA-workflows/control-lora-sketch-basic_example.json
- cd ..
- # run comfyui
- echo "connect through runpod's CONNECT button to the interface"
- python main.py --listen 0.0.0.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement