-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllm-stack
More file actions
executable file
·124 lines (114 loc) · 2.63 KB
/
Copy pathllm-stack
File metadata and controls
executable file
·124 lines (114 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env bash
set -euo pipefail
resolve_self() {
local source_path="${BASH_SOURCE[0]}"
while [[ -L "$source_path" ]]; do
local dir
dir="$(cd -P -- "$(dirname -- "$source_path")" >/dev/null 2>&1 && pwd)"
source_path="$(readlink "$source_path")"
[[ "$source_path" != /* ]] && source_path="$dir/$source_path"
done
cd -P -- "$(dirname -- "$source_path")" >/dev/null 2>&1 && pwd
}
LLM_STACK_REPO_ROOT="$(resolve_self)"
export LLM_STACK_REPO_ROOT
# shellcheck source=lib/config.sh
source "$LLM_STACK_REPO_ROOT/lib/config.sh"
usage() {
cat <<'HELP'
local-llm-stack
Usage:
./llm-stack setup [options]
./llm-stack start [vulkan|rocm|webui]
./llm-stack stop
./llm-stack status [--verbose] [--show-cache-models]
./llm-stack storage
./llm-stack logs [backend|webui|vulkan|rocm]
./llm-stack update
./llm-stack uninstall [--dry-run]
./llm-stack help
Examples:
./llm-stack setup
./llm-stack status
./llm-stack start vulkan
./llm-stack status
./llm-stack stop
HELP
}
cmd="${1:-help}"
if [[ $# -gt 0 ]]; then
shift
fi
if [[ "$cmd" != "setup" ]]; then
warn_running_via_sudo
fi
case "$cmd" in
setup)
exec "$LLM_STACK_REPO_ROOT/scripts/setup.sh" "$@"
;;
start)
backend="${1:-}"
if [[ "$backend" == "-h" || "$backend" == "--help" ]]; then
echo "Usage: ./llm-stack start [vulkan|rocm|webui]"
exit 0
fi
if [[ -z "$backend" ]]; then
load_config
backend="$DEFAULT_BACKEND"
else
shift
fi
case "$backend" in
vulkan)
exec "$LLM_STACK_REPO_ROOT/scripts/vulkan-start.sh" "$@"
;;
rocm)
exec "$LLM_STACK_REPO_ROOT/scripts/rocm-start.sh" "$@"
;;
webui)
exec "$LLM_STACK_REPO_ROOT/scripts/webui-start.sh" "$@"
;;
*)
echo "Unknown backend: $backend" >&2
usage
exit 1
;;
esac
;;
stop)
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
echo "Usage: ./llm-stack stop"
exit 0
fi
[[ $# -eq 0 ]] || die "Usage: ./llm-stack stop"
exec "$LLM_STACK_REPO_ROOT/scripts/stop.sh" "$@"
;;
status)
exec "$LLM_STACK_REPO_ROOT/scripts/stack-status.sh" "$@"
;;
logs)
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
echo "Usage: ./llm-stack logs [backend|webui|vulkan|rocm]"
exit 0
fi
[[ $# -le 1 ]] || die "Usage: ./llm-stack logs [backend|webui|vulkan|rocm]"
exec "$LLM_STACK_REPO_ROOT/scripts/logs.sh" "$@"
;;
storage)
exec "$LLM_STACK_REPO_ROOT/scripts/storage.sh" "$@"
;;
update)
exec "$LLM_STACK_REPO_ROOT/scripts/update-images.sh" "$@"
;;
uninstall)
exec "$LLM_STACK_REPO_ROOT/scripts/uninstall.sh" "$@"
;;
help | -h | --help)
usage
;;
*)
echo "Unknown command: $cmd" >&2
usage
exit 1
;;
esac