forked from gysahlgreene/CloudCIX_AI-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudcix-ai-lab.def
More file actions
93 lines (78 loc) · 3.32 KB
/
cloudcix-ai-lab.def
File metadata and controls
93 lines (78 loc) · 3.32 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
Bootstrap: docker
From: ubuntu:24.04
%labels
Author Eóin Mc Dermott
Version 1.0
Description CloudCIX AI-Lab OpenOnDemand Interactive App
SourceCode https://github.com/oobabooga/text-generation-webui
License https://github.com/oobabooga/text-generation-webui/blob/main/LICENSE
%environment
export PATH=/usr/local/bin:$PATH
export GRADIO_SERVER_NAME="${GRADIO_SERVER_NAME:-0.0.0.0}"
export GRADIO_SERVER_PORT="${GRADIO_SERVER_PORT:-7860}"
export GRADIO_ROOT_PATH="${GRADIO_ROOT_PATH:-/}"
%post
set -eux
# System dependencies
apt-get update && apt-get install -y --no-install-recommends \
wget curl ca-certificates git vim \
build-essential python3 python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
# Create global virtual environment
python3 -m venv /opt/textgen-venv
. /opt/textgen-venv/bin/activate
python -m pip install --upgrade pip setuptools wheel
# Clone and install text-generation-webui
git clone https://github.com/oobabooga/text-generation-webui.git /tmp/textgen-repo
python -m pip install -r /tmp/textgen-repo/requirements/portable/requirements.txt
python -m pip install pyyaml requests gradio fastapi uvicorn
# Copy application
mkdir -p /opt/app
cp -r /tmp/textgen-repo/* /opt/app/
rm -rf /tmp/textgen-repo
# Set permissions
chmod -R a+rX /opt/app /opt/textgen-venv
%runscript
echo "=== Starting Text Generation WebUI ==="
echo "Server name: $GRADIO_SERVER_NAME"
echo "Server port: $GRADIO_SERVER_PORT"
echo "Root path: $GRADIO_ROOT_PATH"
cd /opt/app || exit 1
# Create CloudCIX AI Lab directory structure in user's home directory
mkdir -p \
"$HOME/cloudcix_ai_lab/cache/gradio" \
"$HOME/cloudcix_ai_lab/logs/notebook" \
"$HOME/cloudcix_ai_lab/logs/instruct" \
"$HOME/cloudcix_ai_lab/logs/chat" \
"$HOME/cloudcix_ai_lab/models" \
"$HOME/cloudcix_ai_lab/loras" \
"$HOME/cloudcix_ai_lab/characters" \
"$HOME/cloudcix_ai_lab/presets" \
"$HOME/cloudcix_ai_lab/mmproj" \
"$HOME/cloudcix_ai_lab/grammars" \
"$HOME/cloudcix_ai_lab/instruction-templates" \
"$HOME/cloudcix_ai_lab/extensions" \
"$HOME/cloudcix_ai_lab/training/datasets" \
"$HOME/cloudcix_ai_lab/training/formats" \
"$HOME/cloudcix_ai_lab/settings"
echo "CloudCIX AI Lab directory structure created at: $HOME/cloudcix_ai_lab"
# Create symbolic link so the app finds user_data where it expects
mkdir -p user_data
ln -sf "$HOME/cloudcix_ai_lab/models" user_data/models
ln -sf "$HOME/cloudcix_ai_lab/characters" user_data/characters
ln -sf "$HOME/cloudcix_ai_lab/presets" user_data/presets
ln -sf "$HOME/cloudcix_ai_lab/loras" user_data/loras
ln -sf "$HOME/cloudcix_ai_lab/logs" user_data/logs
ln -sf "$HOME/cloudcix_ai_lab/cache" user_data/cache
ln -sf "$HOME/cloudcix_ai_lab/settings" user_data/settings
# Activate virtual environment
. /opt/textgen-venv/bin/activate
# Run server
exec python server.py \
--portable \
--listen \
--listen-port "${GRADIO_SERVER_PORT:-7860}" \
--listen-host "${GRADIO_SERVER_NAME:-0.0.0.0}" \
--subpath "${GRADIO_ROOT_PATH:-/}" \
--api \
--verbose