mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-07-21 21:01:24 +08:00
unix
This commit is contained in:
parent
06eabbfdc0
commit
d9f2e1e252
13
webui-user.sh
Normal file
13
webui-user.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# export PYTHON=
|
||||
# export GIT=
|
||||
# export VENV_DIR=
|
||||
|
||||
export TORCH_COMMAND="pip install torch==2.10.0 torchvision==0.25.0"
|
||||
|
||||
export COMMANDLINE_ARGS="--uv"
|
||||
|
||||
# --skip-python-version-check --skip-torch-cuda-test --skip-version-check --skip-prepare-environment --skip-install
|
||||
|
||||
exec "$(dirname "$0")/webui.sh"
|
||||
99
webui.sh
Normal file
99
webui.sh
Normal file
@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Load optional settings
|
||||
if [ -f "webui.settings.sh" ]; then
|
||||
source webui.settings.sh
|
||||
fi
|
||||
|
||||
# Defaults
|
||||
PYTHON="${PYTHON:-python3}"
|
||||
VENV_DIR="${VENV_DIR:-$(cd "$(dirname "$0")" && pwd)/venv}"
|
||||
SD_WEBUI_RESTART="tmp/restart"
|
||||
ERROR_REPORTING="FALSE"
|
||||
|
||||
mkdir -p tmp
|
||||
|
||||
# Check python
|
||||
if uv help python >tmp/stdout.txt 2>tmp/stderr.txt; then
|
||||
:
|
||||
elif "$PYTHON" -c "" >tmp/stdout.txt 2>tmp/stderr.txt; then
|
||||
:
|
||||
else
|
||||
echo "Couldn't launch python"
|
||||
goto_show_logs=1
|
||||
fi
|
||||
|
||||
# Check pip
|
||||
if [ -z "$goto_show_logs" ]; then
|
||||
if uv help pip >tmp/stdout.txt 2>tmp/stderr.txt; then
|
||||
:
|
||||
elif "$PYTHON" -m pip --help >tmp/stdout.txt 2>tmp/stderr.txt; then
|
||||
:
|
||||
else
|
||||
echo "Couldn't launch pip"
|
||||
goto_show_logs=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Venv handling
|
||||
if [ -z "$goto_show_logs" ]; then
|
||||
if [ "$VENV_DIR" = "-" ] || [ "$SKIP_VENV" = "1" ]; then
|
||||
:
|
||||
else
|
||||
if [ -x "$VENV_DIR/bin/python" ]; then
|
||||
:
|
||||
else
|
||||
PYTHON_FULLNAME=$("$PYTHON" -c "import sys; print(sys.executable)")
|
||||
echo "Creating venv in directory $VENV_DIR using python $PYTHON_FULLNAME"
|
||||
|
||||
"$PYTHON_FULLNAME" -m venv "$VENV_DIR" >tmp/stdout.txt 2>tmp/stderr.txt || {
|
||||
echo "Unable to create venv in directory \"$VENV_DIR\""
|
||||
goto_show_logs=1
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -z "$goto_show_logs" ]; then
|
||||
"$VENV_DIR/bin/python" -m pip install --upgrade pip || \
|
||||
echo "Warning: Failed to upgrade PIP version"
|
||||
|
||||
# Activate venv
|
||||
# shellcheck disable=SC1091
|
||||
source "$VENV_DIR/bin/activate"
|
||||
PYTHON="$VENV_DIR/bin/python"
|
||||
echo "venv $PYTHON"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Launch
|
||||
if [ -z "$goto_show_logs" ]; then
|
||||
"$PYTHON" launch.py "$@"
|
||||
|
||||
if [ -f "$SD_WEBUI_RESTART" ]; then
|
||||
exec "$0" "$@"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Show logs
|
||||
echo
|
||||
echo "exit code: $?"
|
||||
|
||||
if [ -s tmp/stdout.txt ]; then
|
||||
echo
|
||||
echo "stdout:"
|
||||
cat tmp/stdout.txt
|
||||
fi
|
||||
|
||||
if [ -s tmp/stderr.txt ]; then
|
||||
echo
|
||||
echo "stderr:"
|
||||
cat tmp/stderr.txt
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Launch Unsuccessful! Exiting..."
|
||||
exit 1
|
||||
Loading…
Reference in New Issue
Block a user