Upload files to "/"

This commit is contained in:
2026-04-05 07:17:23 +00:00
parent f641dfa2ba
commit 09997ffd64
+47 -17
View File
@@ -1,13 +1,13 @@
#!/bin/bash
# Setup script for AUTOMATIC1111 Stable Diffusion WebUI
# Target: Ubuntu 22.04 LTS + NVIDIA RTX 2000 Ada (16GB VRAM)
# Setup script for Stable Diffusion WebUI Forge
# Target: Ubuntu 22.04 LTS + NVIDIA GPU (tested on RTX 2000 Ada 16GB)
set -e
SD_DIR="$HOME/stable-diffusion-webui"
echo "=== AUTOMATIC1111 Stable Diffusion WebUI Setup ==="
echo "=== Target: Ubuntu 22.04 LTS + NVIDIA RTX 2000 Ada ==="
echo "=== Stable Diffusion WebUI Forge Setup ==="
echo "=== Target: Ubuntu 22.04 LTS + NVIDIA GPU ==="
echo ""
# 1. Install system dependencies that Ubuntu 22.04 doesn't ship by default
@@ -46,32 +46,57 @@ echo ""
# 3. Check CUDA availability
if ! command -v nvcc &>/dev/null; then
echo "NOTE: nvcc not found — A1111 will download its own CUDA via PyTorch, which is fine."
echo "NOTE: nvcc not found — Forge will download its own CUDA via PyTorch, which is fine."
echo " (No need to install CUDA toolkit separately.)"
echo ""
fi
# 4. Clone A1111
# 4. Clone Forge (AUTOMATIC1111 fork with better performance)
if [ -d "$SD_DIR" ]; then
echo "Directory $SD_DIR already exists, pulling latest..."
cd "$SD_DIR" && git pull
else
echo "Cloning AUTOMATIC1111..."
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "$SD_DIR"
echo "Cloning Stable Diffusion WebUI Forge..."
git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git "$SD_DIR"
fi
cd "$SD_DIR"
# 5. Download a good default model (SD 1.5 — fast, 16GB friendly)
# You can swap this for SDXL later if you want higher quality
# 5. Download models
MODEL_DIR="$SD_DIR/models/Stable-diffusion"
mkdir -p "$MODEL_DIR"
if [ ! -f "$MODEL_DIR/v1-5-pruned-emaonly.safetensors" ]; then
echo "Downloading Stable Diffusion 1.5 model (~4GB)..."
wget -q --show-progress -O "$MODEL_DIR/v1-5-pruned-emaonly.safetensors" \
"https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors"
# SDXL Base 1.0 — default model (~6.9GB)
if [ ! -f "$MODEL_DIR/sd_xl_base_1.0.safetensors" ]; then
echo "Downloading SDXL Base 1.0 model (~6.9GB)..."
wget -q --show-progress -O "$MODEL_DIR/sd_xl_base_1.0.safetensors" \
"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
else
echo "SD 1.5 model already downloaded."
echo "SDXL Base 1.0 already downloaded."
fi
# Juggernaut XL v9 — uncensored model (~6.6GB)
if [ ! -f "$MODEL_DIR/juggernautXL_v9.safetensors" ]; then
echo "Downloading Juggernaut XL v9 model (~6.6GB)..."
wget -q --show-progress -O "$MODEL_DIR/juggernautXL_v9.safetensors" \
"https://huggingface.co/RunDiffusion/Juggernaut-XL-v9/resolve/main/Juggernaut-XL_v9_RunDiffusionPhoto_v2.safetensors"
else
echo "Juggernaut XL v9 already downloaded."
fi
# 6. First launch to create venv (will likely fail on CLIP — that's expected)
echo ""
echo "Running first launch to create Python venv..."
echo "(CLIP build failure is expected — we'll fix it next)"
echo ""
./webui.sh --api --listen --xformers --no-half-vae --exit || true
# 7. Fix CLIP build issue (Ubuntu 22.04 / Python 3.10)
if [ -d "$SD_DIR/venv" ]; then
echo ""
echo "Fixing CLIP build dependencies..."
venv/bin/pip install "setuptools<70" wheel
venv/bin/pip install --no-build-isolation \
https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip
fi
echo ""
@@ -81,10 +106,15 @@ echo "To start the WebUI with API enabled, run:"
echo " cd $SD_DIR"
echo " ./webui.sh --api --listen --xformers --no-half-vae"
echo ""
echo "First launch will take several minutes (installs PyTorch, xformers, etc.)"
echo "First full launch will take several minutes (installs PyTorch, xformers, etc.)"
echo ""
echo "The API will be available at http://localhost:7860"
echo "Test it with: curl http://localhost:7860/sdapi/v1/sd-models"
echo ""
echo "Optional: To run as a systemd service, run:"
echo "To select the default SDXL model via API:"
echo " curl -X POST http://localhost:7860/sdapi/v1/options \\"
echo " -H 'Content-Type: application/json' \\"
echo " -d '{\"sd_model_checkpoint\": \"sd_xl_base_1.0.safetensors\"}'"
echo ""
echo "To run as a systemd service:"
echo " chmod +x setup-sd-service.sh && sudo ./setup-sd-service.sh"