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 #!/bin/bash
# Setup script for AUTOMATIC1111 Stable Diffusion WebUI # Setup script for Stable Diffusion WebUI Forge
# Target: Ubuntu 22.04 LTS + NVIDIA RTX 2000 Ada (16GB VRAM) # Target: Ubuntu 22.04 LTS + NVIDIA GPU (tested on RTX 2000 Ada 16GB)
set -e set -e
SD_DIR="$HOME/stable-diffusion-webui" SD_DIR="$HOME/stable-diffusion-webui"
echo "=== AUTOMATIC1111 Stable Diffusion WebUI Setup ===" echo "=== Stable Diffusion WebUI Forge Setup ==="
echo "=== Target: Ubuntu 22.04 LTS + NVIDIA RTX 2000 Ada ===" echo "=== Target: Ubuntu 22.04 LTS + NVIDIA GPU ==="
echo "" echo ""
# 1. Install system dependencies that Ubuntu 22.04 doesn't ship by default # 1. Install system dependencies that Ubuntu 22.04 doesn't ship by default
@@ -46,32 +46,57 @@ echo ""
# 3. Check CUDA availability # 3. Check CUDA availability
if ! command -v nvcc &>/dev/null; then 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 " (No need to install CUDA toolkit separately.)"
echo "" echo ""
fi fi
# 4. Clone A1111 # 4. Clone Forge (AUTOMATIC1111 fork with better performance)
if [ -d "$SD_DIR" ]; then if [ -d "$SD_DIR" ]; then
echo "Directory $SD_DIR already exists, pulling latest..." echo "Directory $SD_DIR already exists, pulling latest..."
cd "$SD_DIR" && git pull cd "$SD_DIR" && git pull
else else
echo "Cloning AUTOMATIC1111..." echo "Cloning Stable Diffusion WebUI Forge..."
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "$SD_DIR" git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git "$SD_DIR"
fi fi
cd "$SD_DIR" cd "$SD_DIR"
# 5. Download a good default model (SD 1.5 — fast, 16GB friendly) # 5. Download models
# You can swap this for SDXL later if you want higher quality
MODEL_DIR="$SD_DIR/models/Stable-diffusion" MODEL_DIR="$SD_DIR/models/Stable-diffusion"
mkdir -p "$MODEL_DIR" mkdir -p "$MODEL_DIR"
if [ ! -f "$MODEL_DIR/v1-5-pruned-emaonly.safetensors" ]; then # SDXL Base 1.0 — default model (~6.9GB)
echo "Downloading Stable Diffusion 1.5 model (~4GB)..." if [ ! -f "$MODEL_DIR/sd_xl_base_1.0.safetensors" ]; then
wget -q --show-progress -O "$MODEL_DIR/v1-5-pruned-emaonly.safetensors" \ echo "Downloading SDXL Base 1.0 model (~6.9GB)..."
"https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" 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 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 fi
echo "" echo ""
@@ -81,10 +106,15 @@ echo "To start the WebUI with API enabled, run:"
echo " cd $SD_DIR" echo " cd $SD_DIR"
echo " ./webui.sh --api --listen --xformers --no-half-vae" echo " ./webui.sh --api --listen --xformers --no-half-vae"
echo "" 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 ""
echo "The API will be available at http://localhost:7860" echo "The API will be available at http://localhost:7860"
echo "Test it with: curl http://localhost:7860/sdapi/v1/sd-models" echo "Test it with: curl http://localhost:7860/sdapi/v1/sd-models"
echo "" 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" echo " chmod +x setup-sd-service.sh && sudo ./setup-sd-service.sh"