voice-dictation/scripts/install_gigaam_runtime.sh

22 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Explicit experimental setup. Never install PyTorch into the desktop app venv.
set -euo pipefail
GIGAAM_COMMIT="7447938d791c4f3e643386ee22c33777004293a5"
RUNTIME_ROOT="${1:-${VOICE_DICTATION_HOME:-$HOME/.dictate-beta}/runtimes/gigaam}"
PYTHON_BIN="${PYTHON_GIGAAM:-/Library/Frameworks/Python.framework/Versions/3.12/bin/python3}"
if [[ -e "${RUNTIME_ROOT}" ]]; then
echo "Runtime target already exists; refusing to overwrite: ${RUNTIME_ROOT}" >&2
exit 1
fi
"${PYTHON_BIN}" -c 'import platform,sys; assert sys.version_info[:2] == (3,12); assert platform.machine() == "arm64"'
"${PYTHON_BIN}" -m venv "${RUNTIME_ROOT}"
if [[ -n "${GIGAAM_SOURCE:-}" ]]; then
git clone --no-hardlinks "${GIGAAM_SOURCE}" "${RUNTIME_ROOT}/source"
else
git clone https://github.com/salute-developers/GigaAM.git "${RUNTIME_ROOT}/source"
fi
git -C "${RUNTIME_ROOT}/source" checkout --detach "${GIGAAM_COMMIT}"
[[ "$(git -C "${RUNTIME_ROOT}/source" rev-parse HEAD)" == "${GIGAAM_COMMIT}" ]]
"${RUNTIME_ROOT}/bin/python" -m pip install 'torch==2.8.0' 'torchaudio==2.8.0' "${RUNTIME_ROOT}/source"
"${RUNTIME_ROOT}/bin/python" -I -c 'import gigaam,torch,torchaudio; print("GigaAM isolated runtime installed; CPU available")'
echo "Runtime: ${RUNTIME_ROOT}/bin/python3"