Installing AMD ROCm, PyTorch, Stable Diffusion, and YOLO on Linux: A Step-by-Step Guide

Posted by

How To Install AMD ROCm, PyTorch, Stable Diffusion & YOLO on Linux

How To Install AMD ROCm, PyTorch, Stable Diffusion & YOLO on Linux

If you’re a Linux user looking to set up a deep learning environment with support for AMD GPUs, you’ll need to install AMD ROCm, PyTorch, Stable Diffusion, and YOLO. Here’s a step-by-step guide to help you get started.

Step 1: Install AMD ROCm

To install AMD ROCm, you’ll need to follow the installation instructions provided by AMD. These instructions typically involve adding a package repository to your system and installing the ROCm packages using a package manager like apt or yum.

Step 2: Install PyTorch

Once AMD ROCm is installed, you can move on to installing PyTorch with ROCm support. You’ll need to download the ROCm-specific PyTorch package from the PyTorch website and install it using the pip package manager.

Step 3: Install Stable Diffusion

Stable Diffusion is a library for efficient and stable deep learning with AMD GPUs. You can install it using pip as well.

Step 4: Install YOLO

Finally, you can install YOLO, a popular object detection framework, on your Linux system. You’ll need to follow the YOLO installation instructions, which typically involve cloning the YOLO repository and compiling the code.

Conclusion

By following these steps, you can set up a deep learning environment on Linux with support for AMD GPUs. With AMD ROCm, PyTorch, Stable Diffusion, and YOLO installed, you’ll be ready to start developing and running deep learning models on your AMD GPU-powered machine.

0 0 votes
Article Rating
42 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@PhazerTech
6 months ago

– AMD has changed the installation instructions for the drivers and ROCm packages so I created an updated guide with the new steps:
https://youtu.be/BZMZ3351KDs

– For 7000 series GPUs, see here (might be outdated):
https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/9591

– For RX 580/590 GPUs, see here:
https://github.com/tsl0922/pytorch-gfx803

– And finally, here's a list of which GPUs have had ROCm support (unfortunately some may require older ROCm versions): https://www.reddit.com/r/AMD_Stock/comments/136duk0/upcoming_rocm_linux_gpu_os_support/

@PanKrewetka
6 months ago

Is there any way to use ComfuUi with 6600 XT? I have problems with installed drivers on my PC , Linux stops seeing my LG C9 monitor (it's visible without drivers), I reinstalled my Linux 5 times amd tried many times.

@sebfouilloux
6 months ago

Thanks. For blender 3d, I need to follow the first part rocm? Not yolo and the next.

@funnychannel1888
6 months ago

On any devices whitch other video cards input False. Dont see my AMD.

@user-ny9ii7fz4o
6 months ago

ROCk module is NOT loaded, possibly no GPU devices

@user-ny9ii7fz4o
6 months ago

ROCk module is NOT loaded, possibly no GPU devices

@sanjaysarath3493
6 months ago

whenever i try to train a model in torch i get loss as nan but the same works fine in cpu or google colab.

@Rocketman1105Gaming
6 months ago

I am usning ubuntu. I am getting "modules.devices.NansException: A tensor with all NaNs was produced in Unet. Use –disable-nan-check commandline argument to disable this check." when I try to generate images. I have tried setting the upcast cross attention layer to float32 and added the "–no-half-vae –no-half" flags to the command line. If I add –disable-nan-check then I just keep getting black images. Has anyone one else into into this too? Thanks!

@AliOsman-uz1ff
6 months ago

First day with ubuntu. Some help from you smarty pantses would be lovely. cd Downloads code doesn't work for me. If it makes any difference, **I have my main desktop and downloads folder on a other drive. My c drive is mainly for windows! And I'm pretty sure that my Ubuntu version is down loaded to my c drive (got it from the Microsoft store). Additionally, since there's no right-click menu appearing for me, what's the shortcut for past? Lmao.

Thanks so much. Have patience with me hahah xD
You're all awesome!

@aeternus8059
6 months ago

As an Rx 590 user, is it enough for me to follow your guide and replace the pytorch part with the part in the link you gave? (copying and pasting the codes from the link). Also, do I need to install Yolo since I don't own a camera? I've never used linux before so I'm asking because I'm confused, thank you!

@dabeefcaketv
6 months ago

looking to install this on windows your tutorial helped a little bit not super used to amd gpus so this was still somewhat helpful.

@kowierczyk1635
6 months ago

FOR PEOPLE THAT HAVE PROBLEMS WITH AMD DRIVERS, OR ANYTHING AND NOTHING WORKS- for me using linux mint cinammon instad of basic ubuntu foxed everything… and it even looks better

@ansonchan5377
6 months ago

Will it work on a windows system?

@rubinglen
6 months ago

ok this is how i finally got things to work on my 6600xt https://youtu.be/SaNJAU-P2-s as a side comment i notice on stablediffusion xformers doesn't work, this is a known issue. also i get some kind of warning that NVLM doesn't initialize…don't know if that's of any importance, otherwise everything working now

@rubinglen
6 months ago

I am trying to follow this on ubuntu 22.04 with radeon rx 6600. the first error i get when running sudo apt-get install ./amdgpu-install_5.4.50402-1_all.deb, is N: Download is performed unsandboxed as root as file '/home/rubinglen/amd/amdgpu-install_5.4.50402-1_all.deb' couldn't be accessed by user '_apt'. – pkgAcquire::Run (13: Permission denied), then running the next command sudo amdgpu-install –usecase=dkms,graphics,multimedia,opencl,hip,hiplibsdk,rocm it fails with the following: Error! Bad return status for module build on kernel: 6.2.0-26-generic (x86_64)
Consult /var/lib/dkms/amdgpu/5.18.13-1528701.22.04/build/make.log for more information.
dpkg: error processing package amdgpu-dkms (–configure):
installed amdgpu-dkms package post-installation script subprocess returned error exit status 10
I think this means I have to use a different kernel? Any suggestions on which kernel to install and how to go about doing that? thanks!

@dercensed419
6 months ago

does it work with amd cpu too? (if i generate using amd cpu)

@fdshdsfdsqq
6 months ago

Dudeeee!! Thank you very much!😽😽😽😽😽

@capsized8603
6 months ago

I'd absolutely love if you revisited this on arch (and maybe with sdxl). I've tried several rentry guides, using rocm from the aur, arch4edu repo and the docker image, and both automatic1111 and comfyui but just can't seem to get it working no matter what nor can I find much discussion or anything recent related to specifically rdna1 cards like the 5700/xt. I'm just completely exhausted after a week of trying.

@fingerprint8479
6 months ago

Hi, just tried the same think with Ubuntu v22.04 on RX590.
The command line that generates the error is:
sudo amdgpu-install –usecase=dkms,graphics,multimedia,opencl,hip,hiplibsdk,rocm

update-alternatives: a usar /opt/rocm-5.4.2/bin/clang-ocl para disponibilizar /usr/bin/clang-ocl (clang-ocl) em modo auto
/opt/rocm-5.4.2/bin/hipcc.bin not found, but that is OK
/opt/rocm-5.4.2/bin/hipconfig.bin not found, but that is OK
update-alternatives: a usar /opt/rocm-5.4.2/bin/rocgdb para disponibilizar /usr/bin/rocgdb (rocgdb) em modo auto
update-alternatives: a usar /opt/rocm-5.4.2/bin/rocm-smi para disponibilizar /usr/bin/rocm-smi (rocm-smi) em modo auto
update-alternatives: a usar /opt/rocm-5.4.2/bin/rocprof para disponibilizar /usr/bin/rocprof (rocprof) em modo auto
A processar 'triggers' para libc-bin (2.35-0ubuntu3.1) …
Erros foram encontrados durante o processamento de:
amdgpu-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
Thanks

@fingerprint8479
6 months ago

Hi, during the installation of: sudo amdgpu-install –usecase=dkms,graphics,multimedia,opencl,hip,hiplibsdk,rocm
Got the following error:
update-alternatives: using /opt/rocm-5.4.2/bin/clang-ocl to make /usr/bin/clang-ocl (clang-ocl) available in auto mode
/opt/rocm-5.4.2/bin/hipcc.bin not found, but that is OK
/opt/rocm-5.4.2/bin/hipconfig.bin not found, but that is OK
update-alternatives: using /opt/rocm-5.4.2/bin/rocgdb to make /usr/bin/rocgdb (rocgdb) available in auto mode
update-alternatives: using /opt/rocm-5.4.2/bin/rocm-smi to make /usr/bin/rocm-smi (rocm-smi) available in auto mode
update-alternatives: using /opt/rocm-5.4.2/bin/rocprof to make /usr/bin/rocprof (rocprof) available in auto mode
Processing triggers for libc-bin (2.35-0ubuntu3.1) …
Errors were encountered while processing: amdgpu-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
Ubuntu v22.04 – following rocm.html from the website provided. RX 590
Thanks