-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Expand file tree
/
Copy pathinstall_mac.sh
More file actions
executable file
·77 lines (63 loc) · 2.48 KB
/
install_mac.sh
File metadata and controls
executable file
·77 lines (63 loc) · 2.48 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
#!/usr/bin/env bash
set -e
# check prerequisites
command -v conda >/dev/null 2>&1 || { echo >&2 "conda not found. Please install Miniconda from https://docs.conda.io/en/latest/miniconda.html"; exit 1; }
command -v git >/dev/null 2>&1 || { echo >&2 "git not found. Please install Git (e.g. xcode-select --install or brew install git)."; exit 1; }
source scripts/settings.sh
source $(conda info --base)/etc/profile.d/conda.sh
CLIENT_ONLY=0
for arg in "$@"; do
case "$arg" in
--client-only)
CLIENT_ONLY=1
;;
esac
done
# Use Python 3.11 for best compatibility with modern PyTorch and numpy 2.x
conda create -y -n $CONDA_ENV_NAME python=3.11
conda activate $CONDA_ENV_NAME
if [[ $CLIENT_ONLY == 1 ]]; then
echo "--- Installing client-only dependencies ---"
pip install -r requirements_client.txt
else
echo "--- Installing full local mode dependencies ---"
# Detect Apple Silicon vs Intel
ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]]; then
echo "Detected Apple Silicon (arm64). PyTorch will use MPS backend for GPU acceleration."
else
echo "Detected Intel Mac. PyTorch will run on CPU."
fi
# Install PyTorch (pip handles platform detection automatically)
pip install torch torchvision
# Install llvmlite/numba via conda (pip requires LLVM dev headers to build)
conda install -y -c conda-forge llvmlite numba
# Clone First Order Motion Model
if [ ! -d "fomm" ]; then
git clone https://github.com/alievk/first-order-model.git fomm
else
echo "fomm directory already exists, skipping clone."
fi
# Install main requirements (includes face-alignment, opencv, etc.)
pip install -r requirements.txt
# Download model weights if not present
if [ ! -f "vox-adv-cpk.pth.tar" ]; then
echo "--- Downloading model weights ---"
bash scripts/download_data.sh
else
echo "Model weights already present, skipping download."
fi
fi
echo ""
echo "=== Installation complete ==="
if [[ $CLIENT_ONLY == 1 ]]; then
echo "Client-only mode installed. Use run_mac.sh --is-client to connect to a remote GPU server."
else
echo "Full local mode installed. Use run_mac.sh to run locally."
ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]]; then
echo "Apple Silicon detected: MPS GPU acceleration will be used automatically."
else
echo "Intel Mac detected: running on CPU. For better performance, consider using --is-client with a remote GPU."
fi
fi