Model setup recipes

Install PyTorch ROCm on AMD Radeon and verify GPU operation

Verify step by step that PyTorch uses a ROCm GPU on Radeon

PyTorch1 takes image or text data, performs training or inference2 computations on a GPU3, and returns result tensors or model output. ROCm4 builds on Radeon also retain the torch.cuda5 device API6 name, so verify the AMD-supported combination, install in an isolated Python environment, check the HIP7 build, and then test the actual app.

Using an RX 9070 XT Ubuntu desktop as an example, this guide checks device discovery separately from real computation. If the setup is outside a supported combination, align it first and repeat the checks.

Requirements and key details
  • Check that the exact GPU, distribution, kernel, driver, ROCm, and PyTorch share a supported matrix row.
  • Inspect torch.cuda.is_available() together with torch.version.hip.
  • After a basic tensor calculation, test the workload in the actual model and app.

Match the exact GPU and supported combination first

Identify whether the device is an RX 9070 XT, RX 9070, or integrated GPU. In AMD's unified compatibility matrix, match the GPU, Ubuntu version and kernel, driver, ROCm, and PyTorch along one supported path. As of September 27, 2026, ROCm Core SDK 10.0.0 had been released on August 26. Do not assemble versions from separate guides; if no matching row exists, start with a supported OS and version.

A plant, paper, and magnifying glass sit beside a graphics card.
Before installation, match the GPU, OS, and driver in one support row.

Install test Python packages in a virtual environment

A virtual environment8 installs Python packages such as PyTorch in a project-specific space, separate from other work. This manages Python libraries; it does not install the host GPU driver. Follow AMD's OS-specific driver procedure, and check whether the selected package path includes user-space ROCm libraries or requires separate setup.

Virtual environment for isolating Python packages
python3.12 -m venv ~/venvs/rocm-pytorch
source ~/venvs/rocm-pytorch/bin/activate
python -m pip install --upgrade pip wheel
This isolates Python packages only. Follow the host installation guide for the GPU driver.
A small box and file organizer sit on a desk beside a closed desktop computer.
A virtual environment keeps test packages separate from existing Python setups.

Select the official PyTorch wheel for your GPU

This versioned example comes from AMD's selector with RX 9070 XT (gfx1201), Linux, ROCm 10.0, and PyTorch 2.13.0 selected. It uses torch 2.13.0+rocm10.0.0, torchvision 0.28.0+rocm10.0.0, torchaudio 2.11.0.2+rocm10.0.0, and AMD's wheel index. Do not copy it unchanged to another GPU or OS; select those again in the selector. A generic pip install torch from PyPI does not guarantee an AMD build.

Example PyTorch installation for RX 9070 XT on Linux
python -m pip install --index-url https://stable.repo.amd.com/rocm/whl-next/ \
  "torch[device-gfx1201]==2.13.0+rocm10.0.0" \
  "torchvision[device-gfx1201]==0.28.0+rocm10.0.0" \
  "torchaudio==2.11.0.2+rocm10.0.0"
These are example versions. Check your combination in the selector and matrix before installing.

Check the installed build and HIP runtime

collect_env gathers the Python, OS, GPU, and runtime9 information detected by PyTorch. A HIP version shown in torch.version.hip is an indicator of a ROCm build. Redact personal paths, tokens10, API keys, and other secrets before sharing the output.

Print PyTorch environment information
python -m torch.utils.collect_env
Redact personal paths and secrets before sharing.

Run a basic GPU calculation after device discovery

In a ROCm build, torch.version.hip may have a value while torch.version.cuda is usually None. Even if torch.cuda.is_available() is True, it means PyTorch found a GPU through its shared device API. The tensor sum below checks a GPU calculation and transfers the result back to the CPU11, but does not guarantee a large model or every operation will work.

Check HIP and a GPU tensor calculation
python -c 'import torch; print("PyTorch:", torch.__version__); print("HIP:", torch.version.hip); print("CUDA build:", torch.version.cuda); print("GPU available:", torch.cuda.is_available()); print("Device:", torch.cuda.get_device_name(0) if torch.cuda.is_available() else "not detected"); print("2x2 sum:", torch.ones((2,2), device="cuda").sum().item() if torch.cuda.is_available() else "skipped")'
Check torch.version.hip alongside the torch.cuda API.

Reproduce the workload in the actual model and app

If the GPU is not detected, first check whether python and pip point to the same virtual environment and whether the GPU, Linux kernel, driver, ROCm, and PyTorch match the matrix. Use Windows-specific documentation for native Windows and the WSL compatibility matrix and ROCDXG path for WSL. If installed, rocminfo can provide more device detail, but its absence does not by itself mean unsupported; seeing a GPU there also does not guarantee PyTorch or the app can compute with it.

Finally, open the model and program you plan to use, run a small input, restart the app session, and reproduce the same task. Model format, precision, kernels, memory, and extensions can change actual behavior. If it fails, record whether it stopped during model loading, GPU computation, or memory allocation, then inspect the documentation and logs for that stage.

Optional: check rocminfo on an installed Linux system
rocminfo
Do not determine support from the absence of this command alone.
A graphics card, green box, paper, and magnifying glass sit on a wooden desk.
After GPU discovery, test computation in the actual model and framework.

Verify a representative task in a fresh session

For the RX 9070 XT Ubuntu example, proceed from checking the supported combination to installing the selected wheel, verifying HIP and GPU discovery, running a small tensor calculation, and processing a representative image in the actual image tool. Reopen the app to confirm the same input works, then increase to normal size. Saving the failed stage and full logs helps narrow the configuration or operation involved.

Terminology notes

  1. PyTorch — A software framework for building and running AI models. Check the compatible PyTorch version and hardware support along with the model.

    Back to the text
  2. Inference — The process of using a trained model to compute an output for an input. Here, local inference means running the model on the user’s device.

    Back to the text
  3. GPU — A processor designed to handle many calculations in parallel. It performs model computations during AI inference.

    Back to the text
  4. ROCm — AMD’s software platform for AI and high-performance computing on GPUs. Support depends on the combination of GPU, operating system, driver, and framework versions.

    Back to the text
  5. CUDA — A software platform for general-purpose computing on NVIDIA GPUs.

    Back to the text
  6. API — A defined interface that lets other code call a program’s functions.

    Back to the text
  7. HIP — An API and runtime for portable GPU C++ code. It helps with porting CUDA code.

    Back to the text
  8. Python virtual environment — An isolated space for installing Python packages per project, helping reduce package-version conflicts.

    Back to the text
  9. Runtime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.

    Back to the text
  10. Token — A unit into which a model divides input or output for processing.

    Back to the text
  11. CPU — The central processor that runs the operating system and general-purpose instructions; in AI workloads it also handles tasks such as preprocessing and data movement.

    Back to the text

Frequently asked questions

What should you check first in this article?
PyTorch takes image or text data, performs training or inference computations on a GPU, and returns result tensors or model output. ROCm builds on Radeon also retain the torch.cuda device API name, so verify the AMD-supported combination, install in an isolated Python environment, check the HIP build, and then test the actual app.
How much memory does it need?
Finally, open the model and program you plan to use, run a small input, restart the app session, and reproduce the same task. Model format, precision, kernels, memory, and extensions can change actual behavior. If it fails, record whether it stopped during model loading, GPU computation, or memory allocation, then inspect the documentation and logs for that stage.