Skip to content

Instantly share code, notes, and snippets.

@frzb
Last active August 23, 2024 06:01
Show Gist options
  • Save frzb/8df38c6fad74fc640c386562ba227f67 to your computer and use it in GitHub Desktop.
Save frzb/8df38c6fad74fc640c386562ba227f67 to your computer and use it in GitHub Desktop.
PyTorch with GPU-acceleration on Framework 13 AMD Ryzen 5 7640U

PyTorch with GPU-acceleration on Framework 13 AMD Ryzen 5 7640U

$ wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
$ echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.1 jammy main" | sudo tee --append /etc/apt/sources.list.d/rocm.list
$ echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
$ sudo apt update
$ sudo apt install rocm
$ sudo usermod -a -G render $USER
$ rocminfo
$ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2
$ export HSA_OVERRIDE_GFX_VERSION=11.0.0
import torch
print("Is ROCm (HIP) available:", torch.cuda.is_available())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment