|
|
cat > /workspace/bootstrap_forge.sh <<'EOF' |
|
|
|
|
|
set -euo pipefail |
|
|
|
|
|
|
|
|
mkdir -p /workspace/.cache/pip /workspace/.cache/huggingface |
|
|
|
|
|
cat > /workspace/env.sh <<'EOS' |
|
|
export PIP_CACHE_DIR=/workspace/.cache/pip |
|
|
export HF_HOME=/workspace/.cache/huggingface |
|
|
export HUGGINGFACE_HUB_CACHE=/workspace/.cache/huggingface/hub |
|
|
EOS |
|
|
|
|
|
|
|
|
source /workspace/env.sh |
|
|
|
|
|
|
|
|
REPO_DIR="/workspace/stable-diffusion-webui-forge" |
|
|
if [ ! -d "$REPO_DIR/.git" ]; then |
|
|
git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git "$REPO_DIR" |
|
|
else |
|
|
git -C "$REPO_DIR" fetch --all --prune |
|
|
git -C "$REPO_DIR" pull --ff-only |
|
|
fi |
|
|
|
|
|
|
|
|
if [ ! -d /workspace/venv-hh ]; then |
|
|
python3.10 -m venv --system-site-packages /workspace/venv-hh |
|
|
fi |
|
|
source /workspace/venv-hh/bin/activate |
|
|
|
|
|
python -m pip install -U pip wheel |
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive |
|
|
apt-get update |
|
|
apt-get install -y --no-install-recommends pkg-config libcairo2-dev python3.10-dev cmake |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
python -m pip install -U joblib gdown |
|
|
python -m pip install -U pycairo svglib |
|
|
|
|
|
|
|
|
cd "$REPO_DIR" |
|
|
grep -vE '^(torch|torchvision|torchaudio)\b' requirements_versions.txt > /workspace/req-no-torch.txt |
|
|
python -m pip install -r /workspace/req-no-torch.txt |
|
|
|
|
|
|
|
|
cat > "$REPO_DIR/webui-user.sh" <<'EOW' |
|
|
venv_dir="/workspace/venv-hh" |
|
|
EOW |
|
|
|
|
|
|
|
|
mkdir /workspace/stable-diffusion-webui-forge/models/ESRGAN |
|
|
cd /workspace/stable-diffusion-webui-forge/models/ESRGAN |
|
|
wget https://huggingface.co/willseijits/HH12Solo80/resolve/main/4xUltrasharp_4xUltrasharpV10.pth |
|
|
|
|
|
|
|
|
|
|
|
cat > /workspace/start_forge.sh <<'EOS' |
|
|
|
|
|
set -euo pipefail |
|
|
source /workspace/env.sh |
|
|
source /workspace/venv-hh/bin/activate |
|
|
cd /workspace/stable-diffusion-webui-forge |
|
|
|
|
|
./webui.sh -f --listen --port 7860 --enable-insecure-extension-access |
|
|
EOS |
|
|
chmod +x /workspace/start_forge.sh |
|
|
|
|
|
echo "OK. Para iniciar (ou reiniciar) o Forge: bash /workspace/start_forge.sh" |
|
|
EOF |
|
|
|
|
|
bash /workspace/bootstrap_forge.sh |
|
|
|