jkorstad commited on
Commit
1be0478
·
verified ·
1 Parent(s): 1a31940

Update setup_blender.sh

Browse files
Files changed (1) hide show
  1. setup_blender.sh +16 -7
setup_blender.sh CHANGED
@@ -23,6 +23,9 @@ TORCHVISION_VERSION="0.18.1"
23
  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
  # --- Set Environment Variables for Build ---
27
  export CUDA_HOME=${CUDA_HOME:-/usr/local/cuda}
28
  export PATH="${CUDA_HOME}/bin:${LOCAL_BIN_DIR}:${PATH}"
@@ -33,7 +36,7 @@ export CPATH="${PYTHON_INCLUDE_DIR}:${CPATH}"
33
  export C_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${C_INCLUDE_PATH}"
34
  export CPLUS_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${CPLUS_INCLUDE_PATH}"
35
 
36
- # TORCH_CUDA_ARCH_LIST might still be useful for other compiled packages if any
37
  export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"
38
 
39
  echo "--- Setup Script Start ---"
@@ -42,7 +45,7 @@ echo "Blender Python Executable: ${BLENDER_PY_EXEC}"
42
  echo "Using CUDA_HOME=${CUDA_HOME}"
43
  echo "Targeting PyTorch for CUDA: ${TARGET_CUDA_VERSION_SHORT}"
44
  echo "TORCH_CUDA_ARCH_LIST: ${TORCH_CUDA_ARCH_LIST}"
45
- echo "NOTE: flash-attn installation is SKIPPED."
46
 
47
  # --- Download and Extract Blender ---
48
  mkdir -p "${BLENDER_INSTALL_BASE}"
@@ -100,11 +103,19 @@ echo "Step 1: Installing PyTorch ${TORCH_VERSION} (for CUDA ${TARGET_CUDA_VERSIO
100
  --index-url ${TORCH_INDEX_URL} -vvv
101
  echo "PyTorch and Torchvision installation attempted."
102
 
103
- # Step 2 for flash-attn has been removed.
 
 
 
 
 
 
 
104
 
105
- echo "Step 2 (formerly Step 3): Installing remaining dependencies from ${UNIRIG_REQS_FILE_IN_SPACE}..."
106
- # Ensure flash-attn is REMOVED from unirig_requirements.txt.
107
  # This will install torch-scatter, torch-cluster, spconv, bpy, etc.
 
108
  "${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
109
  -r "${UNIRIG_REQS_FILE_IN_SPACE}" -vvv
110
 
@@ -130,8 +141,6 @@ VRM_ADDON_REL_PATH="blender/add-on-vrm-v2.20.77_modified.zip" # Relative to UniR
130
  ABSOLUTE_ADDON_PATH="${UNIRIG_REPO_CLONE_DIR}/${VRM_ADDON_REL_PATH}"
131
  if [ -f "${ABSOLUTE_ADDON_PATH}" ]; then
132
  echo "Attempting to install optional VRM addon for Blender..."
133
- # Try to install and enable the addon. If it fails, print a warning and continue.
134
- # The || true ensures that if the python command fails, the script doesn't exit due to set -e
135
  (cd "${UNIRIG_REPO_CLONE_DIR}" && \
136
  "${BLENDER_PY_EXEC}" -c "import bpy, os; print(f'Attempting to install addon from: {os.path.abspath(\"${VRM_ADDON_REL_PATH}\")}'); bpy.ops.preferences.addon_install(overwrite=True, filepath=os.path.abspath('${VRM_ADDON_REL_PATH}')); print('Addon installation script executed. Attempting to enable...'); bpy.ops.preferences.addon_enable(module='io_scene_vrm'); print('VRM Addon enabled successfully.')") \
137
  || echo "WARNING: VRM addon installation or enabling failed. This is an optional addon. Continuing setup..."
 
23
  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.8"
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}"
 
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 might still be useful if any part of flash-attn or other packages try to compile kernels.
40
  export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"
41
 
42
  echo "--- Setup Script Start ---"
 
45
  echo "Using CUDA_HOME=${CUDA_HOME}"
46
  echo "Targeting PyTorch for CUDA: ${TARGET_CUDA_VERSION_SHORT}"
47
  echo "TORCH_CUDA_ARCH_LIST: ${TORCH_CUDA_ARCH_LIST}"
48
+ echo "Attempting to install flash-attn version: ${FLASH_ATTN_VERSION_TO_INSTALL}"
49
 
50
  # --- Download and Extract Blender ---
51
  mkdir -p "${BLENDER_INSTALL_BASE}"
 
103
  --index-url ${TORCH_INDEX_URL} -vvv
104
  echo "PyTorch and Torchvision installation attempted."
105
 
106
+ echo "Step 2: Installing flash-attn==${FLASH_ATTN_VERSION_TO_INSTALL} from PyPI (binary only)..."
107
+ # Install flash-attn from PyPI, specifying version and forcing binary only.
108
+ # This command does NOT use the PyTorch index-url, allowing pip to search PyPI normally for flash-attn.
109
+ # The --only-binary flag applies to the package name immediately following it.
110
+ "${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
111
+ --only-binary flash-attn \
112
+ flash-attn==${FLASH_ATTN_VERSION_TO_INSTALL} -vvv
113
+ echo "flash-attn installation attempted from PyPI."
114
 
115
+ echo "Step 3: Installing remaining dependencies from ${UNIRIG_REQS_FILE_IN_SPACE}..."
116
+ # Ensure flash-attn is REMOVED from unirig_requirements.txt to avoid conflicts or reinstallation attempts.
117
  # This will install torch-scatter, torch-cluster, spconv, bpy, etc.
118
+ # These packages should find the PyTorch and flash-attn already installed.
119
  "${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
120
  -r "${UNIRIG_REQS_FILE_IN_SPACE}" -vvv
121
 
 
141
  ABSOLUTE_ADDON_PATH="${UNIRIG_REPO_CLONE_DIR}/${VRM_ADDON_REL_PATH}"
142
  if [ -f "${ABSOLUTE_ADDON_PATH}" ]; then
143
  echo "Attempting to install optional VRM addon for Blender..."
 
 
144
  (cd "${UNIRIG_REPO_CLONE_DIR}" && \
145
  "${BLENDER_PY_EXEC}" -c "import bpy, os; print(f'Attempting to install addon from: {os.path.abspath(\"${VRM_ADDON_REL_PATH}\")}'); bpy.ops.preferences.addon_install(overwrite=True, filepath=os.path.abspath('${VRM_ADDON_REL_PATH}')); print('Addon installation script executed. Attempting to enable...'); bpy.ops.preferences.addon_enable(module='io_scene_vrm'); print('VRM Addon enabled successfully.')") \
146
  || echo "WARNING: VRM addon installation or enabling failed. This is an optional addon. Continuing setup..."