Compare commits

...

4 Commits

Author SHA1 Message Date
Nicolas Pereira 61969a2c7a
Merge 91c58b172c into 07c6c89edf 2024-06-01 06:43:02 +10:00
Manuel Schmid 07c6c89edf
fix: chown files directly at copy (#3066) 2024-05-31 22:41:36 +02:00
Manuel Schmid 7899261755
fix: turbo scheduler loading issue (#3065)
* fix: correctly load ModelPatcher

* feat: do not load model at all, not needed
2024-05-31 22:24:19 +02:00
Nicolas Pereira 91c58b172c
Add files via upload 2024-05-17 17:58:05 -03:00
7 changed files with 113 additions and 12 deletions

View File

@ -23,7 +23,7 @@ RUN chown -R user:user /content
WORKDIR /content
USER user
COPY . /content/app
COPY --chown=user:user . /content/app
RUN mv /content/app/models /content/app/models.org
CMD [ "sh", "-c", "/content/entrypoint.sh ${CMDARGS}" ]

44
amd/README.md Normal file
View File

@ -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
```

11
amd/amd_drivers.sh Normal file
View File

@ -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

View File

@ -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

View File

@ -107,8 +107,7 @@ class SDTurboScheduler:
def get_sigmas(self, model, steps, denoise):
start_step = 10 - int(10 * denoise)
timesteps = torch.flip(torch.arange(1, 11) * 100 - 1, (0,))[start_step:start_step + steps]
ldm_patched.modules.model_management.load_models_gpu([model])
sigmas = model.model.model_sampling.sigma(timesteps)
sigmas = model.model_sampling.sigma(timesteps)
sigmas = torch.cat([sigmas, sigmas.new_zeros([1])])
return (sigmas, )

View File

@ -175,7 +175,7 @@ def calculate_sigmas_scheduler_hacked(model, scheduler_name, steps):
elif scheduler_name == "sgm_uniform":
sigmas = normal_scheduler(model, steps, sgm=True)
elif scheduler_name == "turbo":
sigmas = SDTurboScheduler().get_sigmas(namedtuple('Patcher', ['model'])(model=model), steps=steps, denoise=1.0)[0]
sigmas = SDTurboScheduler().get_sigmas(model=model, steps=steps, denoise=1.0)[0]
elif scheduler_name == "align_your_steps":
model_type = 'SDXL' if isinstance(model.latent_format, ldm_patched.modules.latent_formats.SDXL) else 'SD1'
sigmas = AlignYourStepsScheduler().get_sigmas(model_type=model_type, steps=steps, denoise=1.0)[0]

View File

@ -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)