remove all shell scripts from before

This commit is contained in:
Mathieu Broillet 2024-08-28 10:38:05 +02:00
parent ec9517c0c9
commit 7daec372c7
Signed by: mathieu
GPG Key ID: A08E484FE95074C1
30 changed files with 4 additions and 619 deletions

View File

@ -2,6 +2,10 @@
This is a simple project to make hosting multiple AI tools easily on Linux with AMD GPUs using ROCM locally (without docker).
> [!WARNING]
> Currently rewriting this project to be more modular and easier to use. This is a work in progress.
> Instructions below outdated !
To use you have to clone the repo run the install script for the service you want to use.
```bash

View File

@ -1,2 +0,0 @@
venv/
webui/

View File

@ -1,42 +0,0 @@
#!/bin/bash
source ../utils.sh
python_exec="$(pwd)/venv/bin/python3.10"
# Function to install StableDiffusion
install_background_remover() {
# As no data is stored in the webui folder, we can re-run the installation process for updates
rm -R webui -f
echo "Cloning webui..."
# original repo (hf): https://huggingface.co/spaces/ECCV2022/dis-background-removal/tree/main
git clone ssh://git@git.broillet.ch:222/Clone/dis-background-removal.git webui
echo "Installing requirements..."
$python_exec -m pip install -r webui/requirements.txt
echo "Cloning DIS repo"
git clone ssh://git@git.broillet.ch:222/Clone/DIS.git tmp-dis
mv tmp-dis/IS-Net/* webui/
sudo rm -R tmp-dis
echo "Finalizing..."
mkdir webui/saved_models -p
mv webui/isnet.pth webui/saved_models
sudo rm -R webui/.git
}
# Main function
main() {
prepare_env
# Set it up
install_background_remover
clean
echo "BackgroundRemover installation complete."
}
# Run main function
main

View File

@ -1,19 +0,0 @@
#!/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 BG-remover
cd webui/
TORCH_BLAS_PREFER_HIPBLASLT=0 $python_exec app.py
}
main

View File

@ -1 +0,0 @@
build_output/

View File

@ -1,39 +0,0 @@
FROM rocm/dev-ubuntu-22.04:6.1.2
ENV ROCM_ARCH="gfx1030" \
TORCH_VERSION="rocm6.1" \
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8
WORKDIR /tmp
RUN apt-get update -y
RUN apt-get install -y wget git cron cmake make software-properties-common
# Install python3.10
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-get update -y
RUN apt-get install -y python3.10 python3.10-dev python3.10-venv
ENV VIRTUAL_ENV=/opt/venv
RUN python3.10 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip3 install --upgrade pip wheel setuptools
# Install pytorch for rocm
RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/${TORCH_VERSION}
# ROCM bitsandbytes
RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev
## Clone repo and install python requirements
RUN git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git
WORKDIR /tmp/bitsandbytes
RUN pip3 install -r requirements-dev.txt
## Build
RUN cmake -DCOMPUTE_BACKEND=hip -S . -DBNB_ROCM_ARCH=${ROCM_ARCH}
RUN make
RUN python3.10 setup.py bdist_wheel --universal
# Cleanup
RUN apt-get clean && pip3 cache purge

View File

@ -1,15 +0,0 @@
# bitsandbytes-rocm-build-pip
This is a simple script to help you build the latest bitsandbytes for rocm.
The official build process requires a lot of ROCM-related packages and can mess up your computer easily if you install the wrong packages.
This creates a Docker image that builds the package and extract the built wheel file that you can then easily install using pip.
```bash
./build.sh
./extract_build.sh
```
The wheel file will be in a folder named ``build_output/``
*You might also find one of my already built wheel in this folder or on the github releases page (may not be up to date)*

View File

@ -1 +0,0 @@
docker build . -t 'bitsandbytes-rocm-build:6.1.2' -f Dockerfile

View File

@ -1,31 +0,0 @@
#!/bin/bash
# Set variables
IMAGE_NAME="bitsandbytes-rocm-build:6.1.2"
CONTAINER_NAME="bitsandbytes-rocm-build"
FILE_IN_CONTAINER="/tmp/bitsandbytes/dist/"
FILE_ON_HOST="./build_output/"
# Run the Docker container
docker run -d --name $CONTAINER_NAME $IMAGE_NAME
# Check if the container is running
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "Container $CONTAINER_NAME is running."
# Copy the file from the container to the host
docker cp $CONTAINER_NAME:$FILE_IN_CONTAINER $FILE_ON_HOST
if [ $? -eq 0 ]; then
echo "File copied successfully to $FILE_ON_HOST"
else
echo "Failed to copy file."
fi
else
echo "Failed to start container $CONTAINER_NAME."
fi
docker stop $CONTAINER_NAME
docker rm $CONTAINER_NAME
echo "Now you can install bitsandbytes locally using \"pip install\" with the file in the build_output/ folder"

View File

@ -1,4 +0,0 @@
venv/
webui/
models/
*.log

View File

@ -1,52 +0,0 @@
#!/bin/bash
source ../utils.sh
python_exec="$(pwd)/venv/bin/python3.10"
NAME="ComfyUI"
# 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
echo "Cloning $NAME repository..."
git clone https://github.com/comfyanonymous/ComfyUI.git webui
echo "Running $NAME setup..."
$python_exec -m pip install -r webui/requirements.txt
cd webui/custom_nodes
# Install manager
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
# Add GGUF support
git clone https://github.com/city96/ComfyUI-GGUF
$python_exec -m pip install --upgrade gguf numpy==1.26.4
# Add NF4 support
git clone https://github.com/comfyanonymous/ComfyUI_bitsandbytes_NF4.git
$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
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

View File

@ -1,18 +0,0 @@
#!/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
TORCH_BLAS_PREFER_HIPBLASLT=0 $python_exec webui/main.py
}
main

View File

@ -1 +0,0 @@
build_output/

View File

@ -1,39 +0,0 @@
FROM rocm/dev-ubuntu-22.04:6.1.2
ENV TORCH_VERSION="rocm6.1" \
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \
# for llama
CMAKE_ARGS="-DGGML_HIPBLAS=on" \
FORCE_CMAKE=1
WORKDIR /tmp
RUN apt-get update -y
RUN apt-get install -y wget git cron cmake make software-properties-common
# Install python3.10
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-get update -y
RUN apt-get install -y python3.10 python3.10-dev python3.10-venv
ENV VIRTUAL_ENV=/opt/venv
RUN python3.10 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip3 install --upgrade pip wheel setuptools build
# Install pytorch for rocm
RUN pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/${TORCH_VERSION}
# ROCM llama-cpp-python
RUN apt-get install -y hipblas hipblaslt hiprand hipsparse hipcub rocthrust-dev
## Clone repo and install python requirements
RUN git clone --recurse-submodules https://github.com/abetlen/llama-cpp-python.git
WORKDIR /tmp/llama-cpp-python
## Build
RUN python3.10 -m build --wheel
# Cleanup
RUN apt-get clean && pip3 cache purge

View File

@ -1,16 +0,0 @@
# llama-cpp-python-rocm-build-pip
This is a simple script to help you build the latest llama-cpp-python for rocm.
The official build process requires a lot of ROCM-related packages and can mess up your computer easily if you install the wrong packages.
This creates a Docker image that builds the package and extract the built wheel file that you can then easily install using pip.
```bash
./build.sh
./extract_build.sh
```
The wheel file will be in a folder named ``build_output/``
*You might also find one of my already built wheel in this folder or on the github releases page (may not be up to date)*

View File

@ -1 +0,0 @@
docker build . -t 'llama-cpp-python-rocm-build:6.1.2' -f Dockerfile

View File

@ -1,31 +0,0 @@
#!/bin/bash
# Set variables
IMAGE_NAME="llama-cpp-python-rocm-build:6.1.2"
CONTAINER_NAME="llama-cpp-python-rocm-build"
FILE_IN_CONTAINER="/tmp/llama-cpp-python/dist/"
FILE_ON_HOST="./build_output/"
# Run the Docker container
docker run -d --name $CONTAINER_NAME $IMAGE_NAME
# Check if the container is running
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "Container $CONTAINER_NAME is running."
# Copy the file from the container to the host
docker cp $CONTAINER_NAME:$FILE_IN_CONTAINER $FILE_ON_HOST
if [ $? -eq 0 ]; then
echo "File copied successfully to $FILE_ON_HOST"
else
echo "Failed to copy file."
fi
else
echo "Failed to start container $CONTAINER_NAME."
fi
docker stop $CONTAINER_NAME
docker rm $CONTAINER_NAME
echo "Now you can install llama-cpp-python locally using \"pip install\" with the file in the build_output/ folder"

View File

@ -1,4 +0,0 @@
venv/
webui/
models/
outputs/

View File

@ -1,43 +0,0 @@
#!/bin/bash
source ../utils.sh
python_exec="$(pwd)/venv/bin/python3.10"
# Function to install/update StableDiffusion
install_stablediffusionforge() {
if [ -d "webui" ]; then
echo "StableDiffusionForge repository already exists."
yes_or_no "Do you want to update StableDiffusionForge WebUI ?" && {
cd webui
git pull
echo "StableDiffusionForge WebUI successfully updated."
}
else
echo "Cloning StableDiffusionForge repository..."
git clone https://github.com/lllyasviel/stable-diffusion-webui-forge webui
echo "Running StableDiffusionForge setup..."
$python_exec webui/launch.py --skip-torch-cuda-test --exit
echo "Adding Flux NF4 support for ROCM"
$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
ln -s webui/models models
ln -s webui/outputs outputs
fi
}
# Main function
main() {
prepare_env
# Install StableDiffusionForge
install_stablediffusionforge
clean
echo "StableDiffusion installation/update complete. Use ./run.sh to start"
}
# Run main function
main

View File

@ -1,18 +0,0 @@
#!/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/launch.py --listen --enable-insecure-extension-access # --opt-split-attention
}
main

View File

@ -1,4 +0,0 @@
venv/
webui/
models/
outputs/

View File

@ -1,40 +0,0 @@
#!/bin/bash
source ../utils.sh
python_exec="$(pwd)/venv/bin/python3.10"
# Function to install/update StableDiffusion
install_stablediffusion() {
if [ -d "webui" ]; then
echo "StableDiffusion repository already exists."
yes_or_no "Do you want to update StableDiffusion WebUI (dev branch) ?" && {
cd webui
git pull
echo "StableDiffusion WebUI successfully updated."
}
else
echo "Cloning StableDiffusion repository..."
git clone -b dev https://github.com/AUTOMATIC1111/stable-diffusion-webui webui
echo "Running StableDiffusion setup..."
$python_exec webui/launch.py --skip-torch-cuda-test --exit
ln -s webui/models models
ln -s webui/outputs outputs
fi
}
# Main function
main() {
prepare_env
# Install StableDiffusion
install_stablediffusion
clean
echo "StableDiffusion installation/update complete. Use ./run.sh to start"
}
# Run main function
main

View File

@ -1,18 +0,0 @@
#!/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/launch.py --listen --enable-insecure-extension-access --opt-split-attention
}
main

View File

@ -1,4 +0,0 @@
venv/
webui/
models/
outputs/

View File

@ -1,90 +0,0 @@
#!/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 https://github.com/M4TH1EU/ai-suite-rocm-local/releases/download/prebuilt-wheels-for-rocm/bitsandbytes-0.43.3-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 --no-build-isolation --extra-index-url https://huggingface.github.io/autogptq-index/whl/rocm573/
# Add ExLlamav2
$python_exec -m pip install https://github.com/turboderp/exllamav2/releases/download/v0.1.9/exllamav2-0.1.9+rocm6.1.torch2.4.0-cp310-cp310-linux_x86_64.whl
# Add LlamaCPP
CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python # cpu
# CMAKE_ARGS="-DGGML_HIPBLAS=on" FORCE_CMAKE=1 $python_exec -m pip install llama-cpp-python # gpu
# llama cpp built with hipblas doesn't work unless the whole rocm stack is installed locally
# so for now, use llama with openblas (cpu)
# main_venv_path=$(dirname $(python -c "import torch; print(torch.__file__)"))"/lib/"
# llama_lib_path="$(pwd)/venv/lib64/python3.10/site-packages/llama_cpp/lib"
#
# for file in "$main_venv_path"/*.so; do
# ln -s "$file" "$llama_lib_path/$(basename "$file")"
# done
# ln -s "$llama_lib_path/libhipblas.so" "$llama_lib_path/libhipblas.so.1"
# ln -s "$llama_lib_path/libhipblas.so" "$llama_lib_path/libhipblas.so.2"
# ln -s "$llama_lib_path/librocblas.so" "$llama_lib_path/librocblas.so.3"
# ln -s "$llama_lib_path/librocblas.so" "$llama_lib_path/librocblas.so.4"
# ln -s "$llama_lib_path/libamdhip64.so" "$llama_lib_path/libamdhip64.so.5"
# ln -s "$llama_lib_path/libamdhip64.so" "$llama_lib_path/libamdhip64.so.6"
# Add Triton
# $python_exec -m pip install https://github.com/M4TH1EU/ai-suite-rocm-local/releases/download/prebuilt-wheels-for-rocm/llama_cpp_python-0.2.89-cp310-cp310-linux_x86_64.whl
# 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
sed -i '/llama_cpp_python/d' webui/requirements_amd.txt
$python_exec -m pip install -r webui/requirements_amd.txt
# only works after requirements_amd.txt is installed ??!
$python_exec -m pip install accelerate optimum
$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
$python_exec -m pip install lm_eval
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

View File

@ -1,18 +0,0 @@
#!/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
cd webui
TORCH_BLAS_PREFER_HIPBLASLT=0 $python_exec server.py --listen
}
main

View File

@ -1,2 +0,0 @@
venv/
webui/

View File

@ -1,48 +0,0 @@
#!/bin/bash
source ../utils.sh
python_exec=venv/bin/python3.10
# Function to install/update StableDiffusion
install_xtts() {
if [ -d "webui" ]; then
echo "XTTS repository already exists. Skipping clone."
yes_or_no "Do you want to update XTTS WebUI ?" && {
cd webui
rm requirements_without_torch.txt
git pull
echo "XTTS WebUI successfully updated."
cd ..
}
else
echo "Cloning XTTS repository..."
git clone https://github.com/daswer123/xtts-webui webui
fi
iconv -f UTF-16 -t UTF-8 webui/requirements.txt | grep -v 'torch' > webui/requirements_without_torch.txt
$python_exec -m pip install -r webui/requirements_without_torch.txt
# Disable gpu for faster-whipser as ROCM isn't supported yet
sed -i 's/device = "cuda" if torch.cuda.is_available() else "cpu"/device = "cpu"/' webui/scripts/utils/formatter.py
sed -i 's/asr_model = WhisperModel(whisper_model, device=device, compute_type="float16")/asr_model = WhisperModel(whisper_model, device=device, compute_type="int8")/' webui/scripts/utils/formatter.py
# Deepspeed and ninja (not working)
$python_exec -m pip install ninja deepspeed
# apt-get install -y ninja-build
ln -S webui/models models
}
# Main function
main() {
prepare_env
# Install XTTS
install_xtts
clean
echo "XTTS installation/update complete."
}
# Run main function
main

View File

@ -1,18 +0,0 @@
#!/bin/bash
source ../utils.sh
python_exec=venv/bin/python3.10
# Main function
main() {
# Create virtual environment
use_venv
# Prints ROCM info with available GPUs
rocm-smi
# Start XTTS
cd webui/
TORCH_BLAS_PREFER_HIPBLASLT=0 ../$python_exec app.py --host 0.0.0.0 -v v2.0.3
}
main