Model setup recipes

Install PyTorch ROCm on AMD Radeon and verify GPU operation

One torch.cuda.is_available() result cannot tell you whether ROCm is correctly installed or your model works.

Match a currently supported ROCm1 configuration, install the Radeon wheel path from AMD's official selector in a virtual environment2, and check torch.version.hip3 and a GPU4 operation. Finally, restart the app session and test whether a representative image task repeats reliably.

Requirements and key details
  • Check that the RX 9070 XT, Ubuntu, driver, ROCm, and PyTorch appear together in a currently supported configuration.
  • PyTorch ROCm retains the torch.cuda namespace, so use torch.version.hip to identify a HIP build.
  • A successful small GPU operation does not guarantee that your image app's model and extensions work. If something fails, check the virtual environment and logs, then reproduce it after restarting the session before reinstalling the whole system.

Start with the exact GPU and a supported configuration

PyTorch5 may report torch.cuda6.is_available() as False after installation—or return True while GPU work still fails. One line of output cannot settle either case. PyTorch for AMD Radeon keeps some CUDA-compatible API7 names, so a True result does not mean NVIDIA CUDA is in use. Using an Ubuntu Linux desktop with an RX 9070 XT as an example, this guide checks the currently supported configuration, follows AMD's installation path, and tests GPU discovery separately from a real model workload.

First identify the exact graphics-card model in your system information. Do not stop at “Radeon 9000 series”: distinguish an RX 9070 XT from an RX 9070 or an integrated GPU. As of September 27, 2026, AMD's ROCm Core SDK 10.0.0 release is dated August 26, and its current unified compatibility matrix is the place to check GPU-specific configurations. Verify that the RX 9070 XT, Ubuntu version and kernel, driver, ROCm, and PyTorch are listed in one supported path. Do not assemble a configuration by taking separate versions from an OS overview and an older Radeon-specific guide. If you cannot find your exact combination, choosing an OS and version that match the matrix is a safer starting point.

A graphics card sits beside a small plant, blank paper, and a magnifying glass.
Before installing, check that the GPU, OS, and driver appear together in a supported configuration.

Isolate Python packages in a virtual environment

The commands below show one way to keep Python packages in an isolated environment when using Python 3.12, rather than installing them system-wide. They do not install GPU drivers or system ROCm components.

A virtual environment keeps Python libraries such as torch in a project-specific location. It avoids replacing packages used by other projects, and you can leave or remove the environment to isolate the packages you tried. Creating the environment does not install the host GPU driver; follow AMD's OS-specific driver instructions. User-space ROCm libraries, however, may be supplied with the selected official package path or require separate setup. A separate installation of the full ROCm SDK is therefore not a prerequisite for every PyTorch installation.

Create a virtual environment for isolated Python packages
python3.12 -m venv ~/venvs/rocm-pytorch
source ~/venvs/rocm-pytorch/bin/activate
python -m pip install --upgrade pip wheel
This step isolates the Python package environment. Check the selected AMD installation path for host GPU driver and user-space library requirements.
A small lidded box and upright folders sit on a desk beside a closed desktop computer.
A separate virtual environment keeps test packages apart from your existing Python setup.

Choose a matching wheel from AMD's official Radeon selector

The following is the official installation form AMD's selector shows for an RX 9070 XT (gfx1201), Linux, ROCm 10.0, and PyTorch 2.13.0. It lists 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 stable.repo.amd.com/rocm/whl-next index. This is a specific version example from that selector, not a command to copy for another GPU or OS. Check the install URL and support status together in AMD's selector and current compatibility matrix. A generic pip install torch from PyPI does not guarantee an AMD build, so use the command generated by the official selector.

AMD PyTorch selector example 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"
This command is a pinned example. Before installing, select your GPU and OS and compare the generated command with the current supported configuration.

Check whether the installed PyTorch build uses HIP

After installation, first check which PyTorch build is present. This command prints information PyTorch detected about Python, the operating system, the GPU, and the runtime8.

Review the PyTorch, Python, OS, GPU, and HIP runtime information. torch.version.hip can show the HIP version string for a ROCm PyTorch build; distinguish it from torch.version.cuda. A version string tells you about the runtime included in the package, but does not prove that your GPU is officially supported or that every model operation will work. Before sharing collect_env output, redact private paths containing your username and any secrets such as tokens9 or API keys.

Inspect the environment detected by PyTorch
python -m torch.utils.collect_env
Redact secrets and private paths before sharing the output.

Test GPU discovery and computation separately

Next, run a small GPU operation from the same virtual environment.

Here, torch.cuda is the device API namespace PyTorch exposes across its CUDA and HIP backends. A ROCm build can have a value for torch.version.hip, usually None for torch.version.cuda, and still return True for torch.cuda.is_available(). The device name means the current Python process found a GPU. The small tensor addition at the end checks more than enumeration: it also runs a calculation on the GPU and reads the result back to the CPU10. This is only a basic check; it does not prove that a large model will fit in memory or that every operation in your application works.

Check the HIP version and a GPU operation
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")'
A ROCm build can retain the torch.cuda API namespace, so check torch.version.hip as well.

Device diagnostics do not prove that the app works

If the GPU is not detected, inspect the installation path before removing multiple packages. Check that the python executable and pip show torch point to the same virtual environment. Then compare your exact GPU, Linux distribution and kernel, AMD driver, ROCm components, and PyTorch wheel with an officially supported configuration. On native Windows, use the Windows-specific matrix and installation guide rather than Linux steps. WSL requires its own compatibility matrix and ROCDXG path, not the native Windows GPU list. Reinstalling the whole system before finding the mismatch can make the problem harder to isolate.

If rocminfo is installed on Linux, it can provide additional device details. Its absence alone does not mean the GPU is unsupported; it may not be part of the installation or may not be on PATH, so check AMD's current installation guidance. Conversely, seeing a GPU in rocminfo does not mean your AI model will run if PyTorch is a CPU build or the application lacks ROCm operations. Hardware enumeration and application behavior are separate checks.

If this step fails, do not begin by adding a device-identification override. Check that the selected OS, driver, ROCm and PyTorch match one supported combination. Correct any mismatch, then repeat the same check.

Optional: enumerate devices with rocminfo if installed on Linux
rocminfo
Do not judge support from a missing command or empty output alone.
A graphics card, closed green box, blank paper, and magnifying glass sit on a wooden desk.
After confirming the GPU is visible, test separately with the model and framework you plan to use.

Reproduce the task in a fresh app session

Finally, test with the model and application you actually plan to use. A small PyTorch tensor operation may work while a model fails because of its format, precision, kernels, memory needs, or extensions. Check the app's official ROCm support and installation notes for your GPU, then try loading and running a small input. Some programs block ROCm after checking only for CUDA; others run basic PyTorch operations but lack an AMD build of a required extension. If an error occurs, record whether it happened during model loading, computation, or memory allocation so you can find the relevant documentation and support path.

For an RX 9070 XT and Ubuntu, work in this order: check the support matrix, install the selected wheel, check torch.version.hip, GPU availability and device name, then run a small GPU operation. If these pass, process one representative image in the actual app, reopen the app to verify it again, and then increase to your usual size. Save collect_env, the full log and input from any failing step to isolate the configuration or operation; there is no need to erase and reinstall the whole environment.

Terminology notes

  1. 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
  2. Python virtual environment — An isolated space for installing Python packages per project. It helps reduce version conflicts and is not a virtual machine.

    Back to the text
  3. HIP — An API and runtime for writing portable GPU C++ code. It helps with CUDA porting but does not guarantee compatibility of every library or operation, or equivalent speed.

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

    Back to the text
  5. 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
  6. CUDA — A software platform for general-purpose computing on NVIDIA GPUs. Programs built for CUDA are not guaranteed to run unchanged on other GPUs.

    Back to the text
  7. API — A defined interface that lets other code call a program’s functions. The term API alone does not imply sending data to an external server.

    Back to the text
  8. Runtime — The software environment that provides facilities needed while a program runs. In local AI it can also refer to a model execution engine; a GPU runtime library and a complete serving app are different components.

    Back to the text
  9. Token — A unit into which a model divides input or output for processing. One token does not equal one character or a fixed duration.

    Back to the text
  10. CPU — The central processor that executes general-purpose program instructions. AI workloads may divide work between it and other processors such as GPUs.

    Back to the text