-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·89 lines (70 loc) · 2.12 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·89 lines (70 loc) · 2.12 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
#!/usr/bin/env bash
set -Eeuo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODEL_DIR=/workspace/models/MiniMax-H3
APP_DIR=/workspace/scripts
WEB_DIR=/workspace/web
export HF_HOME=/workspace/huggingface
export HF_HUB_CACHE=/workspace/huggingface/hub
export PYTHONUNBUFFERED=1
export TOKENIZERS_PARALLELISM=false
export MALLOC_ARENA_MAX=2
mkdir -p \
"$MODEL_DIR" \
"$APP_DIR" \
"$WEB_DIR" \
/workspace/uploads \
/workspace/outputs \
/workspace/logs
echo "[1/5] Installing pinned packages..."
python -m pip install \
--no-cache-dir \
--no-deps \
-r "$ROOT/requirements.txt"
echo "[2/5] Checking available disk space..."
AVAILABLE_KB="$(df -Pk /workspace | awk 'NR==2 {print $4}')"
REQUIRED_KB="$((160 * 1024 * 1024))"
if [[ ! -f "$MODEL_DIR/modular_model_index.json" ]] \
&& (( AVAILABLE_KB < REQUIRED_KB )); then
echo "At least 160GB of free disk space is required."
df -h /workspace
exit 1
fi
echo "[3/5] Downloading required MiniMax-H3 FL2VA components..."
hf download MiniMaxAI/MiniMax-H3 \
--include \
"model_index.json" \
"modular_model_index.json" \
"LICENSE" \
"transformer/*" \
"text_encoder/*" \
"vae/*" \
"audio_vae/*" \
"tokenizer/*" \
"processor/*" \
"scheduler/*" \
"audio_scheduler/*" \
--local-dir "$MODEL_DIR"
test -f "$MODEL_DIR/transformer/config.json"
test -f "$MODEL_DIR/text_encoder/config.json"
test -f "$MODEL_DIR/vae/config.json"
echo "[4/5] Installing application and compatibility patch..."
cp "$ROOT/app/minimax_runtime.py" "$APP_DIR/minimax_runtime.py"
cp "$ROOT/app/web_app.py" "$APP_DIR/web_app.py"
cp "$ROOT/web/index.html" "$WEB_DIR/index.html"
GROUP_OFFLOAD_FILE="$(
python -c 'import diffusers.hooks.group_offloading as module; print(module.__file__)'
)"
cp "$ROOT/patches/group_offloading.py" "$GROUP_OFFLOAD_FILE"
python -m py_compile \
"$GROUP_OFFLOAD_FILE" \
"$APP_DIR/minimax_runtime.py" \
"$APP_DIR/web_app.py"
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
echo "[5/5] Starting web interface on port 8000..."
exec uvicorn web_app:app \
--app-dir "$APP_DIR" \
--host 0.0.0.0 \
--port 8000 \
--workers 1