diff --git a/amd/README.md b/amd/README.md new file mode 100644 index 00000000..d45c24cd --- /dev/null +++ b/amd/README.md @@ -0,0 +1,44 @@ +# 💬 [lllyasviel Fooocus](https://github.com/lllyasviel/Fooocus) on AMD ROCm 📷 +- Make sure that your system was fresh (ubuntu 22.04) +- Computer will restart during the AMD driver install. +- Prepare AMD ROCm Driver install +``` +sudo usermod -a -G render,video $LOGNAME +wget https://raw.githubusercontent.com/lllyasviel/Fooocus/main/AMD/amd_drivers.sh +sudo chmod 777 amd_drivers.sh +sudo ./amd_drivers.sh +``` +- For RDNA and RDNA 2 cards RX5000 RX6000: +``` +export HSA_OVERRIDE_GFX_VERSION=10.3.0 +``` +- For RDNA 3 cards RX7000: +``` +export HSA_OVERRIDE_GFX_VERSION=11.0.0 +``` +- install Python +``` +wget https://raw.githubusercontent.com/lllyasviel/Fooocus/main/AMD/install_python_conda.sh +sudo chmod 777 install_python_conda.sh +sudo ./install_python_conda.sh +``` +- Install and Start lllyasviel/Fooocus +``` +git clone --branch 2.3.1 https://github.com/lllyasviel/Fooocus.git +cd Fooocus +source fooocus_env/bin/activate +pip3 install -r requirements_versions.txt +pip3 install torch==2.1.2+rocm5.6 torchvision==0.16.2+rocm5.6 --extra-index-url https://download.pytorch.org/whl/rocm5.6 +python entry_with_update.py --listen --attention-split +``` +- Restart Fooocus +``` +cd Fooocus +export HSA_OVERRIDE_GFX_VERSION=11.0.0 +source fooocus_env/bin/activate +python entry_with_update.py --listen --attention-split +``` +To see a prompt from your GPU usage. +``` +watch /opt/rocm-6.0.2/bin/rocm-smi +``` diff --git a/amd/amd_drivers.sh b/amd/amd_drivers.sh new file mode 100644 index 00000000..23099649 --- /dev/null +++ b/amd/amd_drivers.sh @@ -0,0 +1,11 @@ +#!/bin/bash +sudo apt update -y && sudo apt full-upgrade -y +sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)" +sudo usermod -a -G render,video $LOGNAME +wget https://repo.radeon.com/amdgpu-install/6.0.2/ubuntu/jammy/amdgpu-install_6.0.60002-1_all.deb +# to Ubuntu 20.04: wget https://repo.radeon.com/amdgpu-install/6.0.2/ubuntu/focal/amdgpu-install_6.0.60002-1_all.deb +sudo apt install ./amdgpu-install_6.0.60002-1_all.deb +sudo apt update +sudo apt install amdgpu-dkms -y +sudo apt install rocm -y +sudo reboot now diff --git a/amd/install_python_conda.sh b/amd/install_python_conda.sh new file mode 100644 index 00000000..d433dcc5 --- /dev/null +++ b/amd/install_python_conda.sh @@ -0,0 +1,11 @@ +#!/bin/bash +mkdir -p ~/miniconda3 +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh +bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 +rm -rf ~/miniconda3/miniconda.sh +~/miniconda3/bin/conda init bash +sudo apt install python3 -y +sudo apt-get install python-is-python3 -y +sudo apt install python3.11-venv -y +sudo apt-get install git -y +sudo apt-get install wget -y diff --git a/readme.md b/readme.md index 5f66e02a..76e8a7a7 100644 --- a/readme.md +++ b/readme.md @@ -201,14 +201,50 @@ Use `python entry_with_update.py --preset anime` or `python entry_with_update.py Note that the [minimal requirement](#minimal-requirement) for different platforms is different. -Same with the above instructions. You need to change torch to the AMD version - - pip uninstall torch torchvision torchaudio torchtext functorch xformers - pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6 - -AMD is not intensively tested, however. The AMD support is in beta. - -Use `python entry_with_update.py --preset anime` or `python entry_with_update.py --preset realistic` for Fooocus Anime/Realistic Edition. +[AMD GPU's Tutorial](https://github.com/lllyasviel/Fooocus/tree/main/amd) Debian and Ubuntu +- Make sure that your system was fresh (ubuntu 22.04) +- Computer will restart during the AMD driver install. +- Prepare AMD ROCm Driver install +``` +sudo usermod -a -G render,video $LOGNAME +wget https://raw.githubusercontent.com/lllyasviel/Fooocus/main/AMD/amd_drivers.sh +sudo chmod 777 amd_drivers.sh +sudo ./amd_drivers.sh +``` +- For RDNA and RDNA 2 cards RX5000 RX6000: +``` +export HSA_OVERRIDE_GFX_VERSION=10.3.0 +``` +- For RDNA 3 cards RX7000: +``` +export HSA_OVERRIDE_GFX_VERSION=11.0.0 +``` +- install Python +``` +wget https://raw.githubusercontent.com/lllyasviel/Fooocus/main/AMD/install_python_conda.sh +sudo chmod 777 install_python_conda.sh +sudo ./install_python_conda.sh +``` +- Install and Start lllyasviel/Fooocus +``` +git clone --branch 2.3.1 https://github.com/lllyasviel/Fooocus.git +cd Fooocus +source fooocus_env/bin/activate +pip3 install -r requirements_versions.txt +pip3 install torch==2.1.2+rocm5.6 torchvision==0.16.2+rocm5.6 --extra-index-url https://download.pytorch.org/whl/rocm5.6 +python entry_with_update.py --listen --attention-split +``` +- Restart Fooocus +``` +cd Fooocus +export HSA_OVERRIDE_GFX_VERSION=11.0.0 +source fooocus_env/bin/activate +python entry_with_update.py --listen --attention-split +``` +To see a prompt from your GPU usage. +``` +watch /opt/rocm-6.0.2/bin/rocm-smi +``` ### Windows (AMD GPUs)