-
Notifications
You must be signed in to change notification settings - Fork 9
/
pre_start.sh
executable file
·55 lines (45 loc) · 1.73 KB
/
pre_start.sh
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
#!/usr/bin/env bash
export PYTHONUNBUFFERED=1
echo "Container is running"
# Sync venv to workspace to support Network volumes
echo "Syncing venv to workspace, please wait..."
rsync -au /venv/ /workspace/venv/
# Sync Oobabooga Text Generation Web UI to workspace to support Network volumes
echo "Syncing Oobabooga Text Generation Web UI to workspace, please wait..."
rsync -au /text-generation-webui/ /workspace/text-generation-webui/
# Fix the venv to make it work from /workspace
echo "Fixing venv..."
/fix_venv.sh /venv /workspace/venv
mkdir -p /workspace/logs
if [[ ${MODEL} ]];
then
if [[ ! -e "/workspace/text-gen-model" ]];
then
echo "Downloading model (${MODEL}), this could take some time, please wait..."
source /workspace/venv/bin/activate
/workspace/text-generation-webui/fetch_model.py "${MODEL}" /workspace/text-generation-webui/models >> /workspace/logs/download-model.log 2>&1
deactivate
fi
fi
if [[ ${DISABLE_AUTOLAUNCH} ]];
then
echo "Auto launching is disabled so the application will not be started automatically"
echo "You can launch it manually:"
echo ""
echo " cd /workspace/text-generation-webui"
echo " deactivate && source /workspace/venv/bin/activate"
echo " ./start_textgen_server.sh"
else
ARGS=()
if [[ ${UI_ARGS} ]];
then
ARGS=("${ARGS[@]}" ${UI_ARGS})
fi
echo "Starting Oobabooga Text Generation Web UI"
source /workspace/venv/bin/activate
cd /workspace/text-generation-webui && nohup ./start_textgen_server.sh "${ARGS[@]}" > /workspace/logs/textgen.log 2>&1 &
echo "Oobabooga Text Generation Web UI started"
echo "Log file: /workspace/logs/textgen.log"
deactivate
fi
echo "All services have been started"