PyTorch is the go-to framework for deep learning, and on AMD hardware it runs
through ROCm. Once ROCm is installed, getting PyTorch working on
a Radeon GPU is just a pip install away.
I tested this on a Radeon RX 6800M (gfx1031, RDNA2) with ROCm 7.14 on Ubuntu 26.04 — the exact commands below are what worked. The same flow applies to other RDNA2/RDNA3 cards; just swap the gfx target in the install command.
Prerequisites
-
ROCm installed and verified — if you haven't done this yet, follow
our Installing ROCm on Ubuntu for Radeon GPUs
guide first, and confirm
rocminfoshows your GPU. - Python 3.11, 3.12, 3.13, or 3.14 installed.
- Your GPU's
gfxarchitecture (e.g. gfx1031 for RX 6800M).
Step 1 — Create a virtual environment
Always install PyTorch in a fresh virtual environment so it never conflicts with system packages or other Python projects:
python3.12 -m venv .venv
Use whichever Python version you have — python3.11,
python3.13, or python3.14 all work. This creates a
folder called .venv in your current directory.
Step 2 — Activate the environment
Activate it so python and pip point at the venv:
source .venv/bin/activate
You'll know it worked when the prompt shows (.venv) at the start.
Step 3 — Install PyTorch with ROCm support
Install the ROCm-enabled PyTorch, torchvision, and torchaudio from AMD's wheel
repository. Use your GPU's device-gfx target — for the RX 6800M that's
device-gfx1031:
python -m pip install --index-url https://repo.amd.com/rocm/whl-multi-arch/ \
"torch[device-gfx1031]==2.12.0+rocm7.14.0" \
"torchvision[device-gfx1031]==0.27.0+rocm7.14.0" \
"torchaudio==2.11.0+rocm7.14.0"
A few notes:
-
The
[device-gfx1031]extra pulls in the ROCm libraries tuned for your exact GPU architecture — don't skip it. -
For other cards, swap the target: gfx1030 (RX 6800/6700 XT), gfx1100 (RX 7900
XTX), and so on. Or use
[device-all]if you want support for every architecture at once (larger download). -
The
+rocm7.14.0version tag must match your installed ROCm release.
If pip complains about resolving dependencies, make sure the venv is active and
you're passing --index-url https://repo.amd.com/rocm/whl-multi-arch/ —
that repository is what AMD publishes the ROCm builds to.
Step 4 — Verify the GPU is detected
Run this one-liner to confirm PyTorch sees your AMD GPU:
python -c "import torch; print(torch.cuda.is_available())"
It prints True if PyTorch and ROCm are installed correctly and your
AMD GPU is detected. (Yes, it's cuda in the API — PyTorch keeps the
same interface for ROCm so code is portable.)
You can go further and check the device name:
python -c "import torch; print(torch.cuda.get_device_name(0))"
On the RX 6800M this reports something like AMD Radeon RX 6800M.
What's next?
With PyTorch running on ROCm you can:
- Train models and run inference with full GPU acceleration
- Run LLMs locally — Hugging Face Transformers, text-generation-webui, and similar tools work out of the box
- Use torchvision for image models and torchaudio for audio pipelines
The official guide has more detail if you need it: Install PyTorch for ROCm — AMD AI ecosystem docs.