This repo provides a docker buildfile based on the original ROCm-Dockerimage to compile PyTorch and Torchvision for the AMD RX570/RX580/RX590 generation. PyTorch and Torchvision are not compiled to use the GPU-Polaris generation in the original PIP repository. And of course not compiled too in the official ROCm-PyTorch Dockerfile. However, if Polaris 20/21 GPU support is to be used in ComfyUI or A1111 StableDiffusion, there is no way around newly compiled pyTorch and Torvision whl/wheel python files. That what this Docker Buildfile will do for you.
OS | linux | Python | ROCm | PyTorch | Torchvision | GPU |
---|---|---|---|---|---|---|
Ubuntu-22.04.2 | 5.19 | 3.10.10 | 5.7.0 | 2.3.0 | 0.18.0 | RX570/580/590 aka Polaris 20/21 aka GCN 4 |
-
Used ROCm Docker Version: Ubuntu 22.04+ROCm5.7+Python3.10
-
PyTorch GIT: v2.3.0
-
Torchvison GIT: v0.18.0
- It is not necessary to install the entire ROCm-Stack on the host system. Unless you want to use something to optimize your GPU via rocm-smi. In my case, I need the rocm stuff to reduce the power consumption of my RX570 GPU to 145 watts with
rocm-smi --setpoweroverdrive 145 && watch -n2 rocm-smi
every time I restart the container.
- install the docker-subsystem / docker.io on your linux system
- download the latest file version of this github
- build your Docker image via
docker build . -t 'rocm57_pt23:v1'
- start the container via:
docker run -it --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host \ --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 8188:8188 rocm57_pt23:v1
- install ComfyUI and download a Model or map an Directory on your Host-Computer
- After installing ComfyUI reinstall pytorch and torchvision wheels into your ComfyUI-Python-Environment. you find the Polaris compiled Python-Wheel-Files into the "/pytorch/dist" and "/torchvision/dist" Directory