Advertisement
underlines

install.sh

Aug 21st, 2023
2,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.01 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3. set -x
  4. # forward port 8188 in runpod first, before running an instance
  5. echo "Did you forward the port 8188 in your runpod instance? Press Enter to continue..."
  6. read
  7.  
  8. # Check if /workspace exists
  9. if [ ! -d "/workspace" ]; then
  10.     echo "/workspace directory does not exist. Creating it now..."
  11.     mkdir /workspace
  12.     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."
  13. fi
  14.  
  15. # install comfyui
  16. cd /workspace
  17. if [ -d "ComfyUI" ]; then
  18.     echo "ComfyUI repository already exists. Pulling latest changes..."
  19.     cd ComfyUI
  20.     git pull
  21. else
  22.     echo "Cloning ComfyUI repository..."
  23.     git clone https://github.com/comfyanonymous/ComfyUI
  24.     cd ComfyUI
  25. fi
  26. pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 xformers
  27. pip install -r requirements.txt
  28.  
  29. # install custom nodes
  30. cd custom_nodes/
  31. if [ -d "ComfyUI-Manager" ]; then
  32.     echo "ComfyUI-Manager repository already exists. Pulling latest changes..."
  33.     cd ComfyUI-Manager
  34.     git pull
  35.     cd ..
  36. else
  37.     echo "Cloning ComfyUI-Manager repository..."
  38.     git clone https://github.com/ltdrdata/ComfyUI-Manager
  39. fi
  40. if [ -d "comfyui_controlnet_aux" ]; then
  41.     echo "comfyui_controlnet_aux repository already exists. Pulling latest changes..."
  42.     cd comfyui_controlnet_aux
  43.     git pull
  44.     cd ..
  45. else
  46.     echo "Cloning comfyui_controlnet_aux repository..."
  47.     git clone https://github.com/Fannovel16/comfyui_controlnet_aux/
  48. fi
  49. pip install -r comfyui_controlnet_aux/requirements.txt
  50. if [ -d "stability-ComfyUI-nodes" ]; then
  51.     echo "stability-ComfyUI-nodes repository already exists. Pulling latest changes..."
  52.     cd stability-ComfyUI-nodes
  53.     git pull
  54.     cd ..
  55. else
  56.     echo "Cloning stability-ComfyUI-nodes repository..."
  57.     git clone https://github.com/Stability-AI/stability-ComfyUI-nodes
  58. fi
  59. if [ -d "ComfyUI-post-processing-nodes" ]; then
  60.     echo "ComfyUI-post-processing-nodes repository already exists. Pulling latest changes..."
  61.     cd ComfyUI-post-processing-nodes
  62.     git pull
  63.     cd ..
  64. else
  65.     echo "Cloning ComfyUI-post-processing-nodes repository..."
  66.     git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes
  67. fi
  68.  
  69.  
  70. # Download SDXL (and VAE 0.9) based on user's choice
  71. cd ../models/checkpoints
  72. echo "Select the model you want to download:"
  73. echo "1. SDXL1.0 base and refiner with integrated 0.9 VAE (fixed VAE)"
  74. 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"
  75. echo "3. Both of the above (downloads all 4 models plus the faster fp16 VAE 0.9)"
  76. read -p "Enter your choice (1/2/3): " choice
  77. case $choice in
  78.     1)
  79.         [ ! -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
  80.         [ ! -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
  81.         ;;
  82.     2)
  83.         [ ! -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
  84.         [ ! -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
  85.         [ ! -f sdxl_vae.safetensors ] && wget https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors
  86.         ;;
  87.     3)
  88.         [ ! -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
  89.         [ ! -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
  90.         [ ! -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
  91.         [ ! -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
  92.         [ ! -f sdxl_vae.safetensors ] && wget https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors
  93.         ;;
  94.     *)
  95.         echo "Invalid choice. Exiting."
  96.         exit 1
  97.         ;;
  98. esac
  99.  
  100. # download controlnets
  101. cd ../controlnet
  102. [ ! -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
  103. [ ! -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
  104.  
  105. # download control loras
  106. [ ! -d control-lora ] && mkdir control-lora
  107. cd control-lora
  108. [ ! -f control-lora-canny-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-canny-rank256.safetensors
  109. [ ! -f control-lora-depth-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-depth-rank256.safetensors
  110. [ ! -f control-lora-recolor-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-recolor-rank256.safetensors
  111. [ ! -f control-lora-sketch-rank256.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-sketch-rank256.safetensors
  112.  
  113. # download clip vision
  114. cd ../../clip_vision
  115. [ ! -f clip_vision_g.safetensors ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/revision/clip_vision_g.safetensors
  116. cd ../..
  117.  
  118. # download workflows
  119. [ ! -d workflows ] && mkdir workflows
  120. cd workflows
  121. [ ! -f revision-image_mixing_example.json ] && wget https://huggingface.co/stabilityai/control-lora/resolve/main/revision/revision-image_mixing_example.json
  122. [ ! -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
  123. [ ! -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
  124. [ ! -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
  125. [ ! -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
  126. cd ..
  127.  
  128. # run comfyui
  129. echo "connect through runpod's CONNECT button to the interface"
  130. python main.py --listen 0.0.0.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement