Spaces:
Running
on
Zero
Running
on
Zero
Update setup_blender.sh
Browse files- setup_blender.sh +14 -12
setup_blender.sh
CHANGED
@@ -24,20 +24,20 @@ TARGET_CUDA_VERSION_SHORT="cu121" # PyTorch 2.3.1 wheels are available for cu121
|
|
24 |
TORCH_INDEX_URL="https://download.pytorch.org/whl/${TARGET_CUDA_VERSION_SHORT}"
|
25 |
|
26 |
# flash-attn version known to have compatible wheels (Python 3.11, PyTorch 2.3.1+cu121)
|
27 |
-
FLASH_ATTN_VERSION_TO_INSTALL="2.5.
|
28 |
|
29 |
# --- Set Environment Variables for Build ---
|
30 |
-
export CUDA_HOME=${CUDA_HOME:-/usr/local/cuda}
|
31 |
export PATH="${CUDA_HOME}/bin:${LOCAL_BIN_DIR}:${PATH}"
|
32 |
-
export MAX_JOBS=${MAX_JOBS:-4} #
|
33 |
|
34 |
PYTHON_INCLUDE_DIR="/usr/include/python${BLENDER_PYTHON_VERSION#python}"
|
35 |
export CPATH="${PYTHON_INCLUDE_DIR}:${CPATH}"
|
36 |
export C_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${C_INCLUDE_PATH}"
|
37 |
export CPLUS_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${CPLUS_INCLUDE_PATH}"
|
38 |
|
39 |
-
# TORCH_CUDA_ARCH_LIST
|
40 |
-
export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"
|
41 |
|
42 |
echo "--- Setup Script Start ---"
|
43 |
echo "Target Blender Installation Directory: ${INSTALL_DIR}"
|
@@ -96,7 +96,7 @@ fi
|
|
96 |
echo "Upgrading pip for Blender Python..."
|
97 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir --upgrade pip setuptools wheel -vvv
|
98 |
|
99 |
-
echo "Installing packaging and ninja for flash-attn
|
100 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir packaging ninja -vvv
|
101 |
|
102 |
echo "Step 1: Installing PyTorch ${TORCH_VERSION} (for CUDA ${TARGET_CUDA_VERSION_SHORT}) and Torchvision ${TORCHVISION_VERSION}..."
|
@@ -106,18 +106,20 @@ echo "Step 1: Installing PyTorch ${TORCH_VERSION} (for CUDA ${TARGET_CUDA_VERSIO
|
|
106 |
--index-url ${TORCH_INDEX_URL} -vvv
|
107 |
echo "PyTorch and Torchvision installation attempted."
|
108 |
|
109 |
-
echo "Step 2: Installing flash-attn==${FLASH_ATTN_VERSION_TO_INSTALL} from PyPI
|
110 |
-
#
|
111 |
-
#
|
|
|
|
|
112 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
113 |
--no-build-isolation \
|
|
|
114 |
flash-attn==${FLASH_ATTN_VERSION_TO_INSTALL} -vvv
|
115 |
echo "flash-attn installation attempted from PyPI."
|
116 |
|
117 |
echo "Step 3: Installing remaining dependencies from ${UNIRIG_REQS_FILE_IN_SPACE}..."
|
118 |
-
# Ensure flash-attn is REMOVED from unirig_requirements.txt
|
119 |
# This will install torch-scatter, torch-cluster, spconv, bpy, etc.
|
120 |
-
# These packages should find the PyTorch and flash-attn already installed.
|
121 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
122 |
-r "${UNIRIG_REQS_FILE_IN_SPACE}" -vvv
|
123 |
|
@@ -139,7 +141,7 @@ else
|
|
139 |
fi
|
140 |
|
141 |
# (Optional) VRM Addon installation
|
142 |
-
VRM_ADDON_REL_PATH="blender/add-on-vrm-v2.20.77_modified.zip"
|
143 |
ABSOLUTE_ADDON_PATH="${UNIRIG_REPO_CLONE_DIR}/${VRM_ADDON_REL_PATH}"
|
144 |
if [ -f "${ABSOLUTE_ADDON_PATH}" ]; then
|
145 |
echo "Attempting to install optional VRM addon for Blender..."
|
|
|
24 |
TORCH_INDEX_URL="https://download.pytorch.org/whl/${TARGET_CUDA_VERSION_SHORT}"
|
25 |
|
26 |
# flash-attn version known to have compatible wheels (Python 3.11, PyTorch 2.3.1+cu121)
|
27 |
+
FLASH_ATTN_VERSION_TO_INSTALL="2.5.9.post1" # This version has pt23cu121 wheels
|
28 |
|
29 |
# --- Set Environment Variables for Build ---
|
30 |
+
export CUDA_HOME=${CUDA_HOME:-/usr/local/cuda} # This might be nominal if nvcc isn't actually used
|
31 |
export PATH="${CUDA_HOME}/bin:${LOCAL_BIN_DIR}:${PATH}"
|
32 |
+
export MAX_JOBS=${MAX_JOBS:-4} # For compilation jobs if any occur
|
33 |
|
34 |
PYTHON_INCLUDE_DIR="/usr/include/python${BLENDER_PYTHON_VERSION#python}"
|
35 |
export CPATH="${PYTHON_INCLUDE_DIR}:${CPATH}"
|
36 |
export C_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${C_INCLUDE_PATH}"
|
37 |
export CPLUS_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${CPLUS_INCLUDE_PATH}"
|
38 |
|
39 |
+
# TORCH_CUDA_ARCH_LIST is important if flash-attn *does* try to compile parts of itself.
|
40 |
+
export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0" # Common GPU architectures
|
41 |
|
42 |
echo "--- Setup Script Start ---"
|
43 |
echo "Target Blender Installation Directory: ${INSTALL_DIR}"
|
|
|
96 |
echo "Upgrading pip for Blender Python..."
|
97 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir --upgrade pip setuptools wheel -vvv
|
98 |
|
99 |
+
echo "Installing packaging and ninja (recommended for flash-attn)..."
|
100 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir packaging ninja -vvv
|
101 |
|
102 |
echo "Step 1: Installing PyTorch ${TORCH_VERSION} (for CUDA ${TARGET_CUDA_VERSION_SHORT}) and Torchvision ${TORCHVISION_VERSION}..."
|
|
|
106 |
--index-url ${TORCH_INDEX_URL} -vvv
|
107 |
echo "PyTorch and Torchvision installation attempted."
|
108 |
|
109 |
+
echo "Step 2: Installing flash-attn==${FLASH_ATTN_VERSION_TO_INSTALL} from PyPI (binary only, no build isolation)..."
|
110 |
+
# Try to install flash-attn, strongly preferring a binary wheel.
|
111 |
+
# The --no-build-isolation flag allows it to see the already installed PyTorch.
|
112 |
+
# The --only-binary :all: flag (or --only-binary flash-attn) tells pip to not attempt source builds.
|
113 |
+
# We use :all: here for this specific command to be absolutely sure pip doesn't try to build flash-attn or its immediate small deps from source.
|
114 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
115 |
--no-build-isolation \
|
116 |
+
--only-binary ":all:" \
|
117 |
flash-attn==${FLASH_ATTN_VERSION_TO_INSTALL} -vvv
|
118 |
echo "flash-attn installation attempted from PyPI."
|
119 |
|
120 |
echo "Step 3: Installing remaining dependencies from ${UNIRIG_REQS_FILE_IN_SPACE}..."
|
121 |
+
# Ensure flash-attn is REMOVED from unirig_requirements.txt.
|
122 |
# This will install torch-scatter, torch-cluster, spconv, bpy, etc.
|
|
|
123 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
124 |
-r "${UNIRIG_REQS_FILE_IN_SPACE}" -vvv
|
125 |
|
|
|
141 |
fi
|
142 |
|
143 |
# (Optional) VRM Addon installation
|
144 |
+
VRM_ADDON_REL_PATH="blender/add-on-vrm-v2.20.77_modified.zip"
|
145 |
ABSOLUTE_ADDON_PATH="${UNIRIG_REPO_CLONE_DIR}/${VRM_ADDON_REL_PATH}"
|
146 |
if [ -f "${ABSOLUTE_ADDON_PATH}" ]; then
|
147 |
echo "Attempting to install optional VRM addon for Blender..."
|