Skip to content

[WIP][CI][build] Move torch deps into requirements/torch.txt and torchlib.txt#32721

Draft
orionr wants to merge 1 commit intovllm-project:mainfrom
orionr:central-torch-reqs
Draft

[WIP][CI][build] Move torch deps into requirements/torch.txt and torchlib.txt#32721
orionr wants to merge 1 commit intovllm-project:mainfrom
orionr:central-torch-reqs

Conversation

@orionr
Copy link
Copy Markdown
Contributor

@orionr orionr commented Jan 20, 2026

This PR will demonstrate (not working yet) a set of changes to centralize PyTorch dependencies (torch, torchaudio, torchvision) into requirements/torch.txt and requirements/torchlib.txt across all build types and targets. This is a continuation to #30443

Here is the list of todo items:

  • Confirm pyproject.toml still works without torch references
  • Confirm non-GPU builds can find correct torch versions without extra hints. Greatly simplifies requirements/dependencies if we can do it.
  • Update docker/Dockerfile to eliminate torch nightly conditionals and write to requirements/torch.txt plus requirements/torchlib.txt instead. Flags for pip can be stored in a separate variable in base dockers.
  • Have use_existing_torch.py just empty out requirements/torch.txt plus requirements/torchlib.txt and skip all other rewrites
  • Move XPU builds to latest PyTorch and match to other builds

Purpose

Simplify torch requirements so they can be more easily changed for:

  1. PyTorch version upgrade
  2. Using pre-installed PyTorch versions
  3. Using nightly PyTorch builds and wheels

Test Plan

Run through Buildkite and confirm all tests pass

Test Result

N/A - still early

Signed-off-by: Orion Reblitz-Richardson <orionr@meta.com>
@mergify mergify bot added ci/build nvidia rocm Related to AMD ROCm cpu Related to CPU backends labels Jan 20, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to centralize PyTorch dependencies, which is a valuable goal for simplifying maintenance. The changes successfully move torch, torchaudio, and torchvision into new requirements/torch.txt and requirements/torchlibs.txt files. However, this refactoring introduces a critical issue for ROCm builds by removing the necessary package index URL. Additionally, the new approach for CPU dependencies relies on external configuration that complicates local development setups. My review provides feedback on these points to help ensure the new dependency management strategy is robust across all platforms.

I am having trouble creating individual review comments. Click here to see my feedback.

requirements/rocm-build.txt (4-7)

critical

Removing --extra-index-url https://download.pytorch.org/whl/rocm6.4 from this file will break ROCm builds. PyTorch for ROCm must be installed from this specific index to get the ROCm-compatible wheels. Without this, pip will likely default to PyPI and fetch the CUDA-enabled wheels, causing the build to fail. This index URL needs to be provided to the pip install command, for example in docker/Dockerfile.rocm, to ensure the correct packages are installed.

requirements/torch.txt (5-10)

high

Using a generic torch==2.9.1 dependency requires the build environment to provide the correct --extra-index-url for different platforms (e.g., CPU). This makes local development setup more complex and error-prone, as developers must manually provide these flags. The previous approach using platform markers within the requirements files was self-contained. To support builds without 'extra hints', as mentioned in the PR description, you would need to use markers. Given the complexity of managing all platforms in one file, consider creating platform-specific torch requirement files (e.g., torch-cpu.txt, torch-cuda.txt, torch-rocm.txt) and including the appropriate one in higher-level requirements files.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 23, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @orionr.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build cpu Related to CPU backends needs-rebase nvidia rocm Related to AMD ROCm

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant