!!! warning -> DO THIS <-
### -> Use the [Arch unofficial repository guide](#arch-unofficial-repository) (or Docker, if you're vehemently against Arch). The rest in this document are PITA and take a lot of time. <-
Using Docker seems to be the easiest solution, and it works on any OS.
1. Install Docker. https://docker.com
2. Go to https://hub.docker.com/r/rocm/pytorch/tags
3. Pull the latest image, and run "the master test".
4. If it works, great! Follow the tard guide inside the running image.
5. If it fails with hipErrorNoBinaryForGpu: You'll have to compile PyTorch for your GPU. See the corresponding section. If you're on Arch, try the unofficial repository method.
!!! info
This is much faster than compiling if you trust the repo maintainers. Recommended.
!!! warning
The [sd-nativeisekaitoo](/sd-nativeisekaitoo) guide is partly based on this, but it's more detailed and easier to follow. You should probably go with that.
Add the arch4edu repository as per https://wiki.archlinux.org/title/unofficial_user_repositories#arch4edu.
Now:
Add to .
Run .
It should work now. If it has very bad performance (About 1-1.5 it/s expected for RX580 8GB, newer cards will be faster), webui.sh might have installed its own pytorch and torchvision. Run these commands (bash or zsh):
!!! note
There *should* be instructions for installing Rocm on Fedora and Ubuntu somewhere on the internet. Possibly OpenSUSE as well.
!!! warning DO NOT DO THIS
This will be slow. You have to compile a lot of software from source.
1.) Install rocminfo so we can set AMDGPU_TARGETS, which will slightly speed up compile times.
run:
You are looking for gfx####, then followed by your gpu on the next line. Once you have it do:
2.) Install [Rocm on Arch](https://github.com/rocm-arch/rocm-arch) using this command:
I remember having issues with yay while running this, I would play it safe and use paru.
This will take a long time to compile, pray that it actually finishes. If you run out of ram during compiling, you will have to adjust Ninja flags.
!!! info
Some packages use Make instead of Ninja, which doesn't do parallel compilation by default. If you want massive build speedup in exchange for more RAM usage, either patch the PKGBUILDs to use Ninja (add to the CMake invocation and replace with in other places) or do before building.
!!! info
If pacman gives errors about file conflicts with uninstall that first (), then try again.
3.) Load in to the environment
!!! info
Create the environment first (follow other guides until the step). The GUItard guide replaces everything with one batch file in the repository, webui.cmd; peek the commands out of it, the environment name is in environment.yaml. Use the same environment name that was created, obviously. Some guides use or .
4.) [Go to torch's website](https://pytorch.org/)
Scroll down to the Install Torch prompt.
Choose for
for
Copy the command at the bottom.
Run the command, or edit the environment file if you know how. I don't know how to use links in them.
This should work for KoboldAI too.
I was having issues crashing randomly when running the optimized txt2img.py, but txt2img_gradio.py, (and I'm guessing the normal txt2img.py) seems to be stable, just can't generate 512x512. I do 384x384 and that doesn't give out of memory errors.
Takes around 40 seconds with the gradio script after the first gen, at 70 sampling steps.
If ROCm supports your GPU and everything is working fine, you should see the following output or similar:
Now, this can fail in multiple ways (perhaps even more, these are documented as of now):
- **Outputs False on the first line, throws an exception on the second**: Either ROCm or the ROCm-compatible PyTorch wasn't installed correctly.
- **hipErrorNoBinaryForGpu**: compile PyTorch from source. See below
- **Segmentation fault (core dumped)** - Uh oh. TODO documentation
6.) Running or any of the other scripts depending on your vram should now work and use the gpu.
. Take the value from the first step of the manual guide. This will install PyTorch globally, if you (most likely) want to put it in a local environment, follow the general guide.
1. Clone (or download)
1. Activate the environment.
2. Navigate to the pytorch repo. Check out whatever release/bleeding edge branch you want to install.
3.
4.
5. This step might fail on some errors. Google them and patch them, it depends on your distro and compiler version. For Arch users, [here is a github issue with a collection of common errors](https://github.com/rocm-arch/python-pytorch-rocm/issues/44).
6. You're done! Run the master test to ensure everything is working.
If you get a screenful of seemingly random HIP compilation errors once trying to generate an image (either in the webui or the bare scripts), .
- https://github.com/RadeonOpenCompute/ROCm_Documentation/blob/master/Deep_learning/Deep-learning.rst Has a guide about compiling PyTorch for a specific graphics architecture.
- https://github.com/rocm-arch/python-pytorch-rocm/issues/44