From 7cfd86cf966da0eb89c95507d94a18c99cf5e345 Mon Sep 17 00:00:00 2001 From: Mathieu Broillet Date: Tue, 27 Aug 2024 15:37:35 +0200 Subject: [PATCH] update and add text gen --- comfyui-rocm/install.sh | 2 +- comfyui-rocm/run.sh | 2 +- stablediffusion-forge-rocm/install.sh | 2 +- stablediffusion-forge-rocm/run.sh | 2 +- stablediffusion-rocm/install.sh | 2 +- stablediffusion-rocm/run.sh | 2 +- text-generation-rocm/.gitignore | 4 ++ text-generation-rocm/install.sh | 66 +++++++++++++++++++++++++++ text-generation-rocm/run.sh | 17 +++++++ 9 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 text-generation-rocm/.gitignore create mode 100755 text-generation-rocm/install.sh create mode 100755 text-generation-rocm/run.sh diff --git a/comfyui-rocm/install.sh b/comfyui-rocm/install.sh index dbfd90d..afffafb 100755 --- a/comfyui-rocm/install.sh +++ b/comfyui-rocm/install.sh @@ -1,6 +1,6 @@ #!/bin/bash source ../utils.sh -python_exec=venv/bin/python3.10 +python_exec="$(pwd)/venv/bin/python3.10" NAME="ComfyUI" diff --git a/comfyui-rocm/run.sh b/comfyui-rocm/run.sh index 9498f6a..923fb32 100755 --- a/comfyui-rocm/run.sh +++ b/comfyui-rocm/run.sh @@ -1,6 +1,6 @@ #!/bin/bash source ../utils.sh -python_exec=venv/bin/python3.10 +python_exec="$(pwd)/venv/bin/python3.10" # Main function main() { diff --git a/stablediffusion-forge-rocm/install.sh b/stablediffusion-forge-rocm/install.sh index da0eb01..176bbd7 100755 --- a/stablediffusion-forge-rocm/install.sh +++ b/stablediffusion-forge-rocm/install.sh @@ -1,6 +1,6 @@ #!/bin/bash source ../utils.sh -python_exec=venv/bin/python3.10 +python_exec="$(pwd)/venv/bin/python3.10" # Function to install/update StableDiffusion install_stablediffusionforge() { diff --git a/stablediffusion-forge-rocm/run.sh b/stablediffusion-forge-rocm/run.sh index 95fbe39..47198fe 100755 --- a/stablediffusion-forge-rocm/run.sh +++ b/stablediffusion-forge-rocm/run.sh @@ -1,6 +1,6 @@ #!/bin/bash source ../utils.sh -python_exec=venv/bin/python3.10 +python_exec="$(pwd)/venv/bin/python3.10" # Main function main() { diff --git a/stablediffusion-rocm/install.sh b/stablediffusion-rocm/install.sh index 0de13f3..a445ec1 100755 --- a/stablediffusion-rocm/install.sh +++ b/stablediffusion-rocm/install.sh @@ -1,6 +1,6 @@ #!/bin/bash source ../utils.sh -python_exec=venv/bin/python3.10 +python_exec="$(pwd)/venv/bin/python3.10" # Function to install/update StableDiffusion install_stablediffusion() { diff --git a/stablediffusion-rocm/run.sh b/stablediffusion-rocm/run.sh index e003f2b..70f9146 100755 --- a/stablediffusion-rocm/run.sh +++ b/stablediffusion-rocm/run.sh @@ -1,6 +1,6 @@ #!/bin/bash source ../utils.sh -python_exec=venv/bin/python3.10 +python_exec="$(pwd)/venv/bin/python3.10" # Main function main() { diff --git a/text-generation-rocm/.gitignore b/text-generation-rocm/.gitignore new file mode 100644 index 0000000..4c452cd --- /dev/null +++ b/text-generation-rocm/.gitignore @@ -0,0 +1,4 @@ +venv/ +webui/ +models/ +outputs/ \ No newline at end of file diff --git a/text-generation-rocm/install.sh b/text-generation-rocm/install.sh new file mode 100755 index 0000000..200931d --- /dev/null +++ b/text-generation-rocm/install.sh @@ -0,0 +1,66 @@ +#!/bin/bash +source ../utils.sh +python_exec="$(pwd)/venv/bin/python3.10" + +NAME="TextGeneration" + +# Function to install/update +install() { + if [ -d "webui" ]; then + echo $NAME "is already installed. Updating..." + yes_or_no "Do you want to update $NAME?" && { + cd webui + git pull + echo "$NAME WebUI successfully updated." + } + + else + # Add BnB + $python_exec -m pip install --upgrade ../bitsandbytes-rocm-build/bitsandbytes-0.43.3.dev0-cp310-cp310-linux_x86_64.whl # install bitsandbytes for rocm until it is available on pypi + + # Add AutoGPTQ + $python_exec -m pip install auto-gptq[triton] --no-build-isolation --extra-index-url https://huggingface.github.io/autogptq-index/whl/rocm573/ + + # Add LlamaCPP + CMAKE_ARGS="-DLLAMA_CLBLAST=on" FORCE_CMAKE=1 $python_exec -m pip install llama-cpp-python + # CMAKE_ARGS="-DGGML_HIPBLAS=on" FORCE_CMAKE=1 $python_exec -m pip install llama-cpp-python + + # Add Triton +# git clone https://github.com/ROCmSoftwarePlatform/triton.git .tritonrocm +# cd .tritonrocm/python +# $python_exec -m pip install ninja cmake; # build time dependencies +# $python_exec -m pip uninstall triton -y && $python_exec -m pip install -e . +# cd .. && sudo rm -R .tritonrocm + + echo "Cloning $NAME repository..." + git clone https://github.com/oobabooga/text-generation-webui.git webui + + echo "Running $NAME setup..." + + # For some reasons theses want to reinstall torch for nvidia instead of using the download for rocm so manually install them + sed -i '/accelerate/d' webui/requirements_amd.txt + sed -i '/lm_eval/d' webui/requirements_amd.txt + sed -i '/optimum/d' webui/requirements_amd.txt + sed -i '/autoawq/d' webui/requirements_amd.txt + + $python_exec -m pip install -r webui/requirements_amd.txt + + $python_exec -m pip install accelerate # only works after requirements_amd.txt is installed ??! + $python_exec -m pip install lm_eval optimum autoawq + $python_exec -m pip install https://github.com/casper-hansen/AutoAWQ_kernels/releases/download/v0.0.7/autoawq_kernels-0.0.7+rocm571-cp310-cp310-linux_x86_64.whl --no-deps + $python_exec -m pip install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.2.6/autoawq-0.2.6-cp310-cp310-linux_x86_64.whl --no-deps + ln -s webui/models models + fi + +} + +# Main function +main() { + prepare_env + install + clean + echo "$NAME installation/update complete. Use ./run.sh to start" +} + +# Run main function +main diff --git a/text-generation-rocm/run.sh b/text-generation-rocm/run.sh new file mode 100755 index 0000000..3c1972c --- /dev/null +++ b/text-generation-rocm/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash +source ../utils.sh +python_exec="$(pwd)/venv/bin/python3.10" + +# Main function +main() { + # Create virtual environment + use_venv + + # Prints ROCM info with available GPUs + rocm-smi + + # Start SD + TORCH_BLAS_PREFER_HIPBLASLT=0 $python_exec webui/server.py --listen +} + +main