stable-diffusion.cpp/start-server.sh
leejet 0518b34374
Some checks failed
CI / ubuntu-latest-cmake (push) Has been cancelled
CI / ubuntu-latest-cmake-vulkan (push) Has been cancelled
CI / Build and push container images (push) Has been cancelled
CI / macOS-latest-cmake (push) Has been cancelled
CI / windows-latest-cmake (cpu, -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_LIBS=ON -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON) (push) Has been cancelled
CI / windows-latest-cmake (cuda12, -DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES='61;70;75;80;86;89;90;100;120' -DCMAKE_CUDA_FLAGS='-Xcudafe "--diag_suppress=177" -Xcudafe "--diag_suppress=550"' -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_L… (push) Has been cancelled
CI / windows-latest-cmake (vulkan, -DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON) (push) Has been cancelled
CI / windows-latest-rocm (push) Has been cancelled
CI / ubuntu-latest-rocm (10.1.0, x64, gfx900;gfx906;gfx908;gfx90a;gfx90c;gfx942;gfx950;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201) (push) Has been cancelled
CI / release (push) Has been cancelled
feat(server): add recipe-based model management (#2176)
2026-10-21 00:17:30 +08:00

53 lines
1.3 KiB
Bash

#!/bin/sh
set -eu
SD_SERVER_PATH="${SD_SERVER_PATH:-}"
MODEL_DIR="./models"
COMMANDLINE_ARGS=""
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
if [ -f "$script_dir/start-server.local.sh" ]; then
. "$script_dir/start-server.local.sh"
fi
if [ "${1:-}" != "--version" ]; then
# Split configured arguments on whitespace without expanding wildcards.
set -f
set -- --model-dir "$MODEL_DIR" $COMMANDLINE_ARGS "$@"
fi
run_server() {
printf 'Running:'
for arg do
printf " '%s'" "$(printf '%s' "$arg" | sed "s/'/'\\\\''/g")"
done
printf '\n'
exec "$@"
}
if [ -n "$SD_SERVER_PATH" ]; then
case "$SD_SERVER_PATH" in
*/*) ;;
*) SD_SERVER_PATH="./$SD_SERVER_PATH" ;;
esac
if [ ! -f "$SD_SERVER_PATH" ] || [ ! -x "$SD_SERVER_PATH" ]; then
printf 'SD_SERVER_PATH is not an executable file: %s\n' "$SD_SERVER_PATH" >&2
exit 1
fi
run_server "$SD_SERVER_PATH" "$@"
fi
for server in \
"$script_dir/sd-server" \
"$script_dir/bin/Release/sd-server" \
"$script_dir/bin/sd-server" \
"$script_dir/build/bin/Release/sd-server" \
"$script_dir/build/bin/sd-server"
do
if [ -f "$server" ] && [ -x "$server" ]; then
run_server "$server" "$@"
fi
done
printf '%s\n' 'sd-server was not found. Build it first or set SD_SERVER_PATH to its executable path.' >&2
exit 1