Install PyTorch on ROCm 7.12.0

Install PyTorch on ROCm 7.12.0#

This topic guides you through installing PyTorch with ROCm support on AMD hardware. It applies to supported AMD GPUs and platforms.

AMD device family
Instinct GPU
Radeon PRO GPU
Radeon GPU
Ryzen APU
Operating system
Operating system
Operating system
Operating system

Prerequisites#

Ensure your system has a supported Python version installed and accessible: 3.11, 3.12, or 3.13.

Review the ROCm 7.12.0 compatibility matrix for more details.

Install PyTorch#

For prerequisite steps and post-installation recommendations, see the ROCm installation instructions.

  1. Set up your Python virtual environment. If you already have a successful ROCm 7.12.0 installation using pip, skip this step.

    For example, run the following command to create a virtual environment:

  2. Activate your Python virtual environment. For example:

  3. Install the appropriate ROCm-enabled PyTorch build for your operating system and AMD hardware architecture.

  4. Check your PyTorch installation.

    python -c "import torch; print(torch.cuda.is_available())"
    

    This prints True if PyTorch and ROCm are installed properly.

Optionally, for a demonstration of ROCm-powered image generation, try ComfyUI.