-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
132 lines (108 loc) · 5.7 KB
/
Copy pathinstall.sh
File metadata and controls
132 lines (108 loc) · 5.7 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
#!/usr/bin/env bash
# install.sh — Full installation script for HairPort
# Usage: bash scripts/install.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
# ── Prerequisites ──────────────────────────────────────────────────
npm install -g gltfpack
git lfs install
# ── Repository checkout ────────────────────────────────────────────
if [[ ! -d "${REPO_ROOT}/.git" ]]; then
echo "ERROR: scripts/install.sh must be run from an existing HairPort checkout." >&2
exit 1
fi
# ── Blender ────────────────────────────────────────────────────────
if ! command -v blender &>/dev/null; then
BLENDER_ARCHIVE="blender-4.0.2-linux-x64.tar.xz"
if [[ ! -f "${BLENDER_ARCHIVE}" ]]; then
wget https://download.blender.org/release/Blender4.0/${BLENDER_ARCHIVE}
fi
tar -xf "${BLENDER_ARCHIVE}"
sudo mv blender-4.0.2-linux-x64 /usr/local/blender-4.0.2
sudo ln -sf /usr/local/blender-4.0.2/blender /usr/local/bin/blender
fi
# ── Conda environment ─────────────────────────────────────────────
eval "$(conda shell.bash hook)"
if ! conda info --envs | grep -q "^hairport "; then
conda create -n hairport python=3.10 -y
else
echo ">> Conda env 'hairport' already exists, skipping."
fi
conda activate hairport
# ── PyTorch (CUDA 12.8) ───────────────────────────────────────────
pip install torch==2.9.0 torchvision==0.24.0 torchaudio==2.9.0 \
--index-url https://download.pytorch.org/whl/cu128
# ── Core Python tooling ───────────────────────────────────────────
python -m pip install -U pip setuptools wheel packaging
# ── Python dependencies ───────────────────────────────────────────
pip install \
accelerate \
safetensors \
Pillow \
scipy \
opencv-python \
mediapipe==0.10.20 \
roma \
huggingface_hub \
scikit-image \
imageio \
plotly \
dash \
psutil \
ninja \
ftfy \
regex \
nltk \
matplotlib \
open3d \
wandb \
pandas \
gdown \
tensorboard \
onnxruntime-gpu
# Embree is preferred by Landmark3D; rtree supports the validated triangle fallback.
pip install trimesh pyrender embreex rtree
# ── Diffusers, Transformers, Flash Attention (from source) ────────
PACKAGES_DIR="${REPO_ROOT}/local_packages"
mkdir -p "${PACKAGES_DIR}"
pushd "${PACKAGES_DIR}"
[[ -d diffusers/.git ]] || git clone --recursive https://github.com/huggingface/diffusers.git
[[ -d transformers/.git ]] || git clone --recursive https://github.com/huggingface/transformers.git
pip install diffusers/ transformers/ \
git+https://github.com/huggingface/peft \
sentence-transformers
# MAX_JOBS=8 TORCH_CUDA_ARCH_LIST="9.0" pip install flash-attn --no-build-isolation
popd
# ── easy_dwpose (from source) ────────────────────────────────────
[[ -d "${PACKAGES_DIR}/easy_dwpose/.git" ]] || \
git clone https://github.com/deepmancer/easy_dwpose.git "${PACKAGES_DIR}/easy_dwpose"
pip install -e "${PACKAGES_DIR}/easy_dwpose"
# ── BEN2, rembg, mediapipe ────────────────────────────────────────
pip install git+https://github.com/PramaLLC/BEN2.git "rembg[gpu]" numpy==1.26.4
# ── Chumpy (for FLAME/SMPL .pkl loading in PEAR) ──────────────────────
pip install chumpy --no-build-isolation
# ── Jupyter ────────────────────────────────────────────────────────
# conda install -c conda-forge jupyter notebook jupyterlab \
# nb_conda_kernels nb_conda ipykernel -y
# pip install jupyter_contrib_nbextensions
# jupyter contrib nbextension install --user
# ── PyTorch3D & nvdiffrast ────────────────────────────────────────
pip install fvcore iopath
FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST="9.0" \
pip install --no-build-isolation "git+https://github.com/facebookresearch/pytorch3d.git@stable"
FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST="9.0" \
pip install --no-build-isolation "git+https://github.com/NVlabs/nvdiffrast.git"
# ── Blender Python module ─────────────────────────────────────────
pip install bpy==4.0.0 --extra-index-url https://download.blender.org/pypi/
pip install fake-bpy-module
pip install omegaconf
# ── Pin numpy last (some packages may override it) ────────────────
pip install numpy==1.26.4
# ── Setup submodules (CodeFormer, MV-Adapter, PEAR) ────
# bash "${SCRIPT_DIR}/setup_submodules.sh"
# ── Install HairPort itself ───────────────────────────────────────
cd "${REPO_ROOT}"
# pip install -e .
echo ""
echo "HairPort installation complete!"