-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCDMF.sh
More file actions
executable file
·133 lines (111 loc) · 5.35 KB
/
CDMF.sh
File metadata and controls
executable file
·133 lines (111 loc) · 5.35 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
125
126
127
128
129
130
131
132
133
#!/bin/bash
# ---------------------------------------------------------------------------
# AceForge - Bootstrap / Launcher for macOS
# ---------------------------------------------------------------------------
set -e # Exit on error
echo "---------------------------------------------"
echo " AceForge - Server Console"
echo " This window must stay open while AceForge runs."
echo " Press Ctrl+C to stop the server."
echo "---------------------------------------------"
# App root = folder this script lives in
APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="${APP_DIR}/venv_ace"
VENV_PY="${VENV_DIR}/bin/python"
REQ_FILE="${APP_DIR}/requirements_ace_macos.txt"
APP_SCRIPT="${APP_DIR}/music_forge_ui.py"
LOADING_HTML="${APP_DIR}/static/loading.html"
APP_URL="http://127.0.0.1:5056/"
# Check if we want to use GPU for lyrics processing
export CDMF_LYRICS_USE_GPU=1
echo "[AceForge] App dir : ${APP_DIR}"
echo "[AceForge] VENV_PY : ${VENV_PY}"
# ---------------------------------------------------------------------------
# Open loading page right away so user sees something nice
# ---------------------------------------------------------------------------
if [ -f "${LOADING_HTML}" ]; then
echo "[AceForge] Opening loading page in your default browser..."
if [[ "$OSTYPE" == "darwin"* ]]; then
open "${LOADING_HTML}" 2>/dev/null || echo "[AceForge] Could not open browser automatically"
else
xdg-open "${LOADING_HTML}" 2>/dev/null || echo "[AceForge] Could not open browser automatically"
fi
else
echo "[AceForge] loading.html not found; open this URL in your browser:"
echo " ${APP_URL}"
fi
# ---------------------------------------------------------------------------
# Check for existing venv
# ---------------------------------------------------------------------------
if [ -f "${VENV_PY}" ]; then
echo "[AceForge] Found existing venv_ace, launching app..."
exec "${VENV_PY}" "${APP_SCRIPT}"
fi
echo "[AceForge] No venv_ace found, running one-time setup..."
# ---------------------------------------------------------------------------
# Sanity checks
# ---------------------------------------------------------------------------
if ! command -v python3 &> /dev/null; then
echo "[ERROR] python3 not found in PATH"
echo "Please install Python 3.10 or later:"
echo " - Using Homebrew: brew install python@3.10"
echo " - Or download from: https://www.python.org/downloads/"
exit 1
fi
PYTHON_CMD=$(command -v python3)
PYTHON_VERSION=$("${PYTHON_CMD}" --version 2>&1 | awk '{print $2}')
echo "[AceForge] Found Python ${PYTHON_VERSION} at ${PYTHON_CMD}"
if [ ! -f "${REQ_FILE}" ]; then
echo "[ERROR] requirements_ace_macos.txt not found at:"
echo " ${REQ_FILE}"
echo "Cannot install dependencies without this file."
exit 1
fi
# ---------------------------------------------------------------------------
# Create venv_ace using system Python
# ---------------------------------------------------------------------------
echo "[AceForge] Creating virtual environment at:"
echo " ${VENV_DIR}"
"${PYTHON_CMD}" -m venv "${VENV_DIR}"
if [ ! -f "${VENV_PY}" ]; then
echo "[ERROR] venv Python not found at:"
echo " ${VENV_PY}"
exit 1
fi
# ---------------------------------------------------------------------------
# Install pip (if needed) and upgrade it
# ---------------------------------------------------------------------------
echo "[AceForge] Ensuring pip is available / up to date..."
"${VENV_PY}" -m ensurepip --upgrade > /dev/null 2>&1 || true
"${VENV_PY}" -m pip install --upgrade pip
# ---------------------------------------------------------------------------
# Install app requirements into venv_ace
# ---------------------------------------------------------------------------
echo "[AceForge] Installing dependencies from requirements_ace_macos.txt..."
"${VENV_PY}" -m pip install -r "${REQ_FILE}"
# Note: These packages have specific version conflicts with other dependencies
# and need to be installed with --no-deps to avoid breaking the environment
echo "[AceForge] Installing audio-separator (--no-deps due to beartype version conflict)..."
"${VENV_PY}" -m pip install "audio-separator==0.40.0" --no-deps
echo "[AceForge] Installing py3langid (--no-deps due to numpy>=2.0.0 requirement conflict)..."
"${VENV_PY}" -m pip install "py3langid==0.3.0" --no-deps
# ---------------------------------------------------------------------------
# Install ACE-Step from GitHub (WITHOUT touching deps like numpy/torch)
# ---------------------------------------------------------------------------
echo "[AceForge] Installing ACE-Step from GitHub (no deps; using our pinned stack)..."
"${VENV_PY}" -m pip install "git+https://github.com/ace-step/ACE-Step.git" --no-deps
echo "[AceForge] venv_ace setup complete."
# ---------------------------------------------------------------------------
# Launch the app
# ---------------------------------------------------------------------------
if [ ! -f "${APP_SCRIPT}" ]; then
echo "[ERROR] Cannot find app script:"
echo " ${APP_SCRIPT}"
exit 1
fi
echo ""
echo "---------------------------------------------"
echo "[AceForge] Starting AceForge UI..."
echo "[AceForge] THIS MAY TAKE A FEW MOMENTS IF YOU'VE NEVER BOOTED UP BEFORE. PLEASE WAIT."
echo "[AceForge] (Close this window to stop the server.)"
exec "${VENV_PY}" "${APP_SCRIPT}"