From 530a2324c9ea83ddfc64200304edae11ea879958 Mon Sep 17 00:00:00 2001 From: sasha0552 Date: Thu, 28 Dec 2023 09:54:30 +0000 Subject: [PATCH] Use ROCm instead of CUDA on supported projects --- .gitignore | 5 +++++ ...sh => 1000-axolotl-dependencies.sh.jinja2} | 2 ++ ...sillytavern-extras-dependencies.sh.jinja2} | 11 +++++++++- ...t-generation-webui-dependencies.sh.jinja2} | 9 ++++++++- ...es.sh => 1000-vllm-dependencies.sh.jinja2} | 20 +++++++++++++++++-- ...9999-cleanup.sh => 9999-cleanup.sh.jinja2} | 5 +++++ 6 files changed, 48 insertions(+), 4 deletions(-) rename airootfs/root/customize_airootfs/scripts/{1000-axolotl-dependencies.sh => 1000-axolotl-dependencies.sh.jinja2} (96%) rename airootfs/root/customize_airootfs/scripts/{1000-sillytavern-extras-dependencies.sh => 1000-sillytavern-extras-dependencies.sh.jinja2} (64%) rename airootfs/root/customize_airootfs/scripts/{1000-text-generation-webui-dependencies.sh => 1000-text-generation-webui-dependencies.sh.jinja2} (63%) rename airootfs/root/customize_airootfs/scripts/{1000-vllm-dependencies.sh => 1000-vllm-dependencies.sh.jinja2} (69%) rename airootfs/root/customize_airootfs/scripts/{9999-cleanup.sh => 9999-cleanup.sh.jinja2} (64%) diff --git a/.gitignore b/.gitignore index 1666f4e..f87df35 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,11 @@ work/ # rendered files packages.x86_64 +airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh airootfs/root/customize_airootfs/scripts/0100-koboldcpp-patches.sh +airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh +airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh +airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh airootfs/root/customize_airootfs/scripts/0100-vllm-patches.sh airootfs/root/customize_airootfs/scripts/0100-automatic-patches.sh +airootfs/root/customize_airootfs/scripts/9999-cleanup.sh diff --git a/airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh b/airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh.jinja2 similarity index 96% rename from airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh rename to airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh.jinja2 index 129223f..5b15957 100644 --- a/airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh +++ b/airootfs/root/customize_airootfs/scripts/1000-axolotl-dependencies.sh.jinja2 @@ -3,6 +3,7 @@ set -eu # axolotl dependencies pushd "axolotl" +{% if CUDA %} # disable package caching export PIP_NO_CACHE_DIR=0 @@ -33,4 +34,5 @@ pushd "axolotl" # downgrade flash-attn (https://github.com/OpenAccess-AI-Collective/axolotl/issues/911#issuecomment-1868546443) pip3 install flash-attn==2.3.2 deactivate +{% endif %} popd diff --git a/airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh b/airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh.jinja2 similarity index 64% rename from airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh rename to airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh.jinja2 index 0613315..f27537a 100644 --- a/airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh +++ b/airootfs/root/customize_airootfs/scripts/1000-sillytavern-extras-dependencies.sh.jinja2 @@ -11,8 +11,17 @@ pushd "SillyTavern-Extras" # activate venv source venv/bin/activate - # install dependencies +{% if CUDA %} + # install dependencies (cuda) pip3 install -r requirements.txt +{% endif %} + +{% if ROCm %} + # install dependencies (rocm) + pip3 install -r requirements-rocm.txt +{% endif %} + + # install remaining dependencies pip3 install -r requirements-coqui.txt pip3 install -r requirements-rvc.txt deactivate diff --git a/airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh b/airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh.jinja2 similarity index 63% rename from airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh rename to airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh.jinja2 index ab5001b..a59a017 100644 --- a/airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh +++ b/airootfs/root/customize_airootfs/scripts/1000-text-generation-webui-dependencies.sh.jinja2 @@ -11,7 +11,14 @@ pushd "text-generation-webui" # activate venv source venv/bin/activate - # install dependencies +{% if CUDA %} + # install dependencies (cuda) pip3 install -r requirements.txt +{% endif %} + +{% if ROCm %} + # install dependencies (rocm) + pip3 install -r requirements_amd.txt +{% endif %} deactivate popd diff --git a/airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh b/airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh.jinja2 similarity index 69% rename from airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh rename to airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh.jinja2 index 6dce971..53d1396 100644 --- a/airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh +++ b/airootfs/root/customize_airootfs/scripts/1000-vllm-dependencies.sh.jinja2 @@ -24,8 +24,17 @@ pushd "vllm" # activate venv source venv/bin/activate - # install dependencies +{% if CUDA %} + # install dependencies (cuda) pip3 install -r requirements.txt +{% endif %} + +{% if ROCm %} + # install dependencies (rocm) + pip3 install -r requirements-rocm.txt +{% endif %} + + # install dependencies (build) pip3 install -r requirements-build.txt # build native extension @@ -40,7 +49,14 @@ pushd "vllm" # activate venv source venv/bin/activate - # install dependencies +{% if CUDA %} + # install dependencies (cuda) pip3 install -r requirements.txt +{% endif %} + +{% if ROCm %} + # install dependencies (rocm) + pip3 install -r requirements-rocm.txt +{% endif %} deactivate popd diff --git a/airootfs/root/customize_airootfs/scripts/9999-cleanup.sh b/airootfs/root/customize_airootfs/scripts/9999-cleanup.sh.jinja2 similarity index 64% rename from airootfs/root/customize_airootfs/scripts/9999-cleanup.sh rename to airootfs/root/customize_airootfs/scripts/9999-cleanup.sh.jinja2 index 4b6f6d5..ec5664d 100644 --- a/airootfs/root/customize_airootfs/scripts/9999-cleanup.sh +++ b/airootfs/root/customize_airootfs/scripts/9999-cleanup.sh.jinja2 @@ -9,3 +9,8 @@ rm -fr /home/tori/.config/matplotlib # keras rm -fr /home/tori/.keras + +{% if ROCm %} +# remove axolotl if rocm +rm -fr /home/tori/axolotl +{% endif %}