Skip to content

PyTorch

This section covers PyTorch configuration for ML and AI projects.

  • Note: Will be installed before others, to avoid using a platform default in the dependencies. Pip should skip ok, unless you specify x.y.z==flavor, which overrides it.

  • Warn: Version 2.7.0+ with cu128 or newer is required for RTX 5000+ series! [1]

Version

An optional version of PyTorch to be installed at runtime.

project.torch.version = "2.8.0"
pyaket torch --version 2.8.0
export PYAKET_TORCH_VERSION="2.8.0"

Torchaudio and torchvision will also be installed under any compatible version.


Backend

The hardware acceleration backend to use.

project.torch.backend = "auto"
pyaket torch --backend auto
export PYAKET_TORCH_BACKEND="auto"
  • When set to auto, uv will decide the best one (experimental)
  • Other values will be passed to the --extra-index-url as:
uv pip install torch==${VERSION}$+${BACKEND}
    --extra-index-url https://download.pytorch.org/whl/${BACKEND}

The allowed values depends on the PyTorch version. You can check this page for the latest values, and this other page for older ones. ROCm is for AMD GPUs. Use empty for default.