Skip to content

Installing correct CUDA versions for PyTorch #201

Description

@cedriclim1

Problem

Some systems will have different CUDA versions and for the newest release PyTorch=2.11.0 they are straight defaulting to CUDA 13.0: https://github.com/pytorch/pytorch/releases/tag/v2.11.0.

Solution

To allow some flexibility on what CUDA version someone can install on quantem, Claude gave some suggestions using uv sync --group. For example:

[[tool.uv.index]]
name = "pytorch-cu130"
url = "https://download.pytorch.org/whl/cu130"
explicit = true

[[tool.uv.index]]
name = "pytorch-cu128"
url = "https://download.pytorch.org/whl/cu128"
explicit = true

[dependency-groups]
cu130 = ["torch>=2.7.0", "torchvision>=0.22.1"]
cu128 = ["torch>=2.7.0", "torchvision>=0.22.1"]
cpu = ["torch>=2.7.0", "torchvision>=0.22.1"]

[tool.uv.sources]
torch = [
  { index = "pytorch-cu130", group = "cu130" },
  { index = "pytorch-cu128", group = "cu128" },
]
torchvision = [
  { index = "pytorch-cu130", group = "cu130" },
  { index = "pytorch-cu128", group = "cu128" },
]

and one would run:

uv sync --group cu130
uv sync --group cu128
uv sync --group cpu  # falls back to PyPI CPU wheels

Maybe we should think about doing this just in case if someone would want more flexibility, but we will default to the latest CUDA version?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions