-
Notifications
You must be signed in to change notification settings - Fork 587
Expand file tree
/
Copy pathsetup.sh
More file actions
139 lines (123 loc) · 4.4 KB
/
setup.sh
File metadata and controls
139 lines (123 loc) · 4.4 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
134
135
136
137
138
139
# Read Arguments
TEMP=`getopt -o h --long help,new-env,basic,flash-attn,cumesh,o-voxel,flexgemm,nvdiffrast,nvdiffrec -n 'setup.sh' -- "$@"`
eval set -- "$TEMP"
HELP=false
NEW_ENV=false
BASIC=false
FLASHATTN=false
CUMESH=false
OVOXEL=false
FLEXGEMM=false
NVDIFFRAST=false
NVDIFFREC=false
ERROR=false
if [ "$#" -eq 1 ] ; then
HELP=true
fi
while true ; do
case "$1" in
-h|--help) HELP=true ; shift ;;
--new-env) NEW_ENV=true ; shift ;;
--basic) BASIC=true ; shift ;;
--flash-attn) FLASHATTN=true ; shift ;;
--cumesh) CUMESH=true ; shift ;;
--o-voxel) OVOXEL=true ; shift ;;
--flexgemm) FLEXGEMM=true ; shift ;;
--nvdiffrast) NVDIFFRAST=true ; shift ;;
--nvdiffrec) NVDIFFREC=true ; shift ;;
--) shift ; break ;;
*) ERROR=true ; break ;;
esac
done
if [ "$ERROR" = true ] ; then
echo "Error: Invalid argument"
HELP=true
fi
if [ "$HELP" = true ] ; then
echo "Usage: setup.sh [OPTIONS]"
echo "Options:"
echo " -h, --help Display this help message"
echo " --new-env Create a new conda environment"
echo " --basic Install basic dependencies"
echo " --flash-attn Install flash-attention"
echo " --cumesh Install cumesh"
echo " --o-voxel Install o-voxel"
echo " --flexgemm Install flexgemm"
echo " --nvdiffrast Install nvdiffrast"
echo " --nvdiffrec Install nvdiffrec"
return
fi
# Get system information
WORKDIR=$(pwd)
if command -v nvidia-smi > /dev/null; then
PLATFORM="cuda"
elif command -v rocminfo > /dev/null; then
PLATFORM="hip"
else
echo "Error: No supported GPU found"
exit 1
fi
if [ "$NEW_ENV" = true ] ; then
conda create -n trellis2 python=3.10
conda activate trellis2
if [ "$PLATFORM" = "cuda" ] ; then
pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu124
elif [ "$PLATFORM" = "hip" ] ; then
pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/rocm6.2.4
fi
fi
if [ "$BASIC" = true ] ; then
pip install imageio imageio-ffmpeg tqdm easydict opencv-python-headless ninja trimesh transformers gradio==6.0.1 tensorboard pandas lpips zstandard
pip install git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057d642626897ec8
sudo apt install -y libjpeg-dev
pip install pillow-simd
pip install kornia timm
fi
if [ "$FLASHATTN" = true ] ; then
if [ "$PLATFORM" = "cuda" ] ; then
pip install flash-attn==2.7.3
elif [ "$PLATFORM" = "hip" ] ; then
echo "[FLASHATTN] Prebuilt binaries not found. Building from source..."
mkdir -p /tmp/extensions
git clone --recursive https://github.com/ROCm/flash-attention.git /tmp/extensions/flash-attention
cd /tmp/extensions/flash-attention
git checkout tags/v2.7.3-cktile
GPU_ARCHS=gfx942 python setup.py install #MI300 series
cd $WORKDIR
else
echo "[FLASHATTN] Unsupported platform: $PLATFORM"
fi
fi
if [ "$NVDIFFRAST" = true ] ; then
if [ "$PLATFORM" = "cuda" ] ; then
mkdir -p /tmp/extensions
git clone -b v0.4.0 https://github.com/NVlabs/nvdiffrast.git /tmp/extensions/nvdiffrast
pip install /tmp/extensions/nvdiffrast --no-build-isolation
else
echo "[NVDIFFRAST] Unsupported platform: $PLATFORM"
fi
fi
if [ "$NVDIFFREC" = true ] ; then
if [ "$PLATFORM" = "cuda" ] ; then
mkdir -p /tmp/extensions
git clone -b renderutils https://github.com/JeffreyXiang/nvdiffrec.git /tmp/extensions/nvdiffrec
pip install /tmp/extensions/nvdiffrec --no-build-isolation
else
echo "[NVDIFFREC] Unsupported platform: $PLATFORM"
fi
fi
if [ "$CUMESH" = true ] ; then
mkdir -p /tmp/extensions
git clone https://github.com/JeffreyXiang/CuMesh.git /tmp/extensions/CuMesh --recursive
pip install /tmp/extensions/CuMesh --no-build-isolation
fi
if [ "$FLEXGEMM" = true ] ; then
mkdir -p /tmp/extensions
git clone https://github.com/JeffreyXiang/FlexGEMM.git /tmp/extensions/FlexGEMM --recursive
pip install /tmp/extensions/FlexGEMM --no-build-isolation
fi
if [ "$OVOXEL" = true ] ; then
mkdir -p /tmp/extensions
cp -r o-voxel /tmp/extensions/o-voxel
pip install /tmp/extensions/o-voxel --no-build-isolation
fi