mirror of https://github.com/astral-sh/uv
Add ROCm example to the PyTorch guide (#13200)
## Summary Closes https://github.com/astral-sh/uv/issues/13197#issuecomment-2839707240.
This commit is contained in:
parent
241b013600
commit
990c59ddb6
|
|
@ -197,6 +197,11 @@ Next, update the `pyproject.toml` to point `torch` and `torchvision` to the desi
|
||||||
torchvision = [
|
torchvision = [
|
||||||
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
|
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
|
||||||
]
|
]
|
||||||
|
# ROCm6 support relies on `pytorch-triton-rocm`, which should also be installed from the PyTorch index
|
||||||
|
# (and included in `project.dependencies`).
|
||||||
|
pytorch-triton-rocm = [
|
||||||
|
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
|
||||||
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "Intel GPUs"
|
=== "Intel GPUs"
|
||||||
|
|
@ -212,10 +217,10 @@ Next, update the `pyproject.toml` to point `torch` and `torchvision` to the desi
|
||||||
torchvision = [
|
torchvision = [
|
||||||
{ index = "pytorch-xpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
|
{ index = "pytorch-xpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
|
||||||
]
|
]
|
||||||
# Intel GPU support relies on `pytorch-triton-xpu` on Linux, which should also be installed from the PyTorch index
|
# Intel GPU support relies on `pytorch-triton-xpu`, which should also be installed from the PyTorch index
|
||||||
# (and included in `project.dependencies`).
|
# (and included in `project.dependencies`).
|
||||||
pytorch-triton-xpu = [
|
pytorch-triton-xpu = [
|
||||||
{ index = "pytorch-xpu", marker = "sys_platform == 'linux'" },
|
{ index = "pytorch-xpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -227,8 +232,8 @@ name = "project"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
requires-python = ">=3.12.0"
|
requires-python = ">=3.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"torch>=2.6.0",
|
"torch>=2.7.0",
|
||||||
"torchvision>=0.21.0",
|
"torchvision>=0.22.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
|
|
@ -285,8 +290,8 @@ url = "https://download.pytorch.org/whl/cu128"
|
||||||
explicit = true
|
explicit = true
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, the following configuration would use PyTorch's Intel GPU builds on Windows and Linux,
|
Similarly, the following configuration would use PyTorch's AMD GPU builds on Linux, and CPU-only
|
||||||
and CPU-only builds on macOS (by way of falling back to PyPI):
|
builds on Windows and macOS (by way of falling back to PyPI):
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[project]
|
[project]
|
||||||
|
|
@ -296,7 +301,37 @@ requires-python = ">=3.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"torch>=2.7.0",
|
"torch>=2.7.0",
|
||||||
"torchvision>=0.22.0",
|
"torchvision>=0.22.0",
|
||||||
"pytorch-triton-xpu>=3.3.0 ; sys_platform == 'linux'",
|
"pytorch-triton-rocm>=3.3.0 ; sys_platform == 'linux'",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
torch = [
|
||||||
|
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
|
||||||
|
]
|
||||||
|
torchvision = [
|
||||||
|
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
|
||||||
|
]
|
||||||
|
pytorch-triton-rocm = [
|
||||||
|
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[tool.uv.index]]
|
||||||
|
name = "pytorch-rocm"
|
||||||
|
url = "https://download.pytorch.org/whl/rocm6.3"
|
||||||
|
explicit = true
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, for Intel GPU builds:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[project]
|
||||||
|
name = "project"
|
||||||
|
version = "0.1.0"
|
||||||
|
requires-python = ">=3.12.0"
|
||||||
|
dependencies = [
|
||||||
|
"torch>=2.7.0",
|
||||||
|
"torchvision>=0.22.0",
|
||||||
|
"pytorch-triton-xpu>=3.3.0 ; sys_platform == 'win32' or sys_platform == 'linux'",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
|
|
@ -307,7 +342,7 @@ torchvision = [
|
||||||
{ index = "pytorch-xpu", marker = "sys_platform == 'win32' or sys_platform == 'linux'" },
|
{ index = "pytorch-xpu", marker = "sys_platform == 'win32' or sys_platform == 'linux'" },
|
||||||
]
|
]
|
||||||
pytorch-triton-xpu = [
|
pytorch-triton-xpu = [
|
||||||
{ index = "pytorch-xpu", marker = "sys_platform == 'linux'" },
|
{ index = "pytorch-xpu", marker = "sys_platform == 'win32' or sys_platform == 'linux'" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[tool.uv.index]]
|
[[tool.uv.index]]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue