Skip to content

Commit

Permalink
Add bitsandbytes for ROCm
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Jun 19, 2024
1 parent 82e97d2 commit fdc33b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 0 additions & 1 deletion build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/amd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ build_amd_install_torch() {
torch==${PYTORCH_VERSION} \
torchvision \
torchaudio \
xformers \
--extra-index-url=https://download.pytorch.org/whl/rocm${ROCM_VERSION}
}

Expand Down
24 changes: 24 additions & 0 deletions build/COPY_ROOT_1/opt/ai-dock/bin/build/layer1/amd.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
#!/bin/false

build_amd_main() {
build_amd_install_bitsandbytes
build_amd_install_kohya_ss
build_common_run_tests
}

build_amd_install_bitsandbytes() {
# TODO - This really needs moving to a separate, external build step
# https://github.com/ROCm/bitsandbytes
DEV_PACKAGES="rocm-dev hipblas-dev hipblaslt-dev hipcub-dev hiprand-dev hipsparse-dev rocblas-dev rocthrust-dev"
if [[ $ROCM_LEVEL != "devel" ]]; then
$APT_INSTALL $DEV_PACKAGES
fi
cd /tmp
git clone --recurse https://github.com/ROCm/bitsandbytes
cd bitsandbytes
git checkout rocm_enabled
"$KOHYA_VENV_PIP" install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=hip -S . #Use -DBNB_ROCM_ARCH="gfx90a;gfx942" to target specific gpu arch
make
"$KOHYA_VENV_PIP" install .
cd /tmp
rm -rf /tmp/bitsandbytes
if [[ $ROCM_LEVEL != "devel" ]]; then
apt-get remove -y $DEV_PACKAGES
apt-get autoremove -y
fi
}

build_amd_install_kohya_ss() {
build_common_install_kohya_ss
"$KOHYA_VENV_PIP" install --no-cache-dir \
Expand Down

0 comments on commit fdc33b7

Please sign in to comment.