Add stt-server.py and fix setup scripts #1

Merged
mikael-lovqvist merged 6 commits from mikael-lovqvists-claude-agent/stt-server:stt-process into main 2026-06-07 08:51:23 +00:00
Showing only changes of commit bbde89a2cc - Show all commits

View File

@@ -96,26 +96,29 @@ ls "${VENV}/include/ctranslate2/" | head -3
ls "${VENV}/lib/libctranslate2"* 2>/dev/null || { echo "ERROR: libctranslate2 not found in venv/lib" >&2; exit 1; }
grep "WITH_CUDA" "${BUILD_DIR}/cmake-build/CMakeCache.txt" | grep -v "^#" || true
# --- Python bindings ---
# Always reinstall from source to ensure we use our locally built library,
# not a PyPI wheel that may have been pulled in as a dependency.
echo "==> removing any existing ctranslate2 install..."
# --- faster-whisper (with all deps, including PyPI ctranslate2) ---
# Install faster-whisper normally so all its dependencies (av, huggingface_hub, etc.)
# are satisfied. This will pull in the PyPI ctranslate2 wheel, which we override next.
if ! "${VENV}/bin/python3" -c "import faster_whisper" &>/dev/null 2>&1; then
echo "==> installing faster-whisper"
"${VENV}/bin/pip" install faster-whisper
else
echo "==> faster-whisper already installed, skipping"
fi
# --- Python bindings (always reinstalled from source) ---
# Override the PyPI ctranslate2 wheel pulled in above with our source-built version.
# This is the whole point of this script: the PyPI wheel links against a fixed CUDA
# major version (e.g. libcublas.so.12) while our build links against the system version.
echo "==> removing PyPI ctranslate2..."
"${VENV}/bin/pip" uninstall -y ctranslate2 2>/dev/null || true
echo "==> building ctranslate2 Python bindings from source..."
echo "==> installing source-built ctranslate2 Python bindings..."
CT2_ROOT="${VENV}" \
LIBRARY_PATH="${VENV}/lib:${VENV}/lib64${LIBRARY_PATH:+:${LIBRARY_PATH}}" \
LDFLAGS="-Wl,-rpath,${VENV}/lib" \
"${VENV}/bin/pip" install "${BUILD_DIR}/src/python" --no-build-isolation
# --- faster-whisper ---
if ! "${VENV}/bin/python3" -c "import faster_whisper" &>/dev/null 2>&1; then
echo "==> installing faster-whisper"
"${VENV}/bin/pip" install faster-whisper --no-deps
else
echo "==> faster-whisper already installed, skipping"
fi
# --- model download ---
if [ -f "${TOKEN_FILE}" ]; then
export HF_TOKEN="$(cat "${TOKEN_FILE}")"