Skip to content

Comments

feat: Added cuda version selection to uv build.#433

Open
BlueCrescent wants to merge 5 commits intomainfrom
uv_support_for_different_cuda_versions
Open

feat: Added cuda version selection to uv build.#433
BlueCrescent wants to merge 5 commits intomainfrom
uv_support_for_different_cuda_versions

Conversation

@BlueCrescent
Copy link
Member

@BlueCrescent BlueCrescent commented Feb 18, 2026

What does this PR do?

Support different CUDA versions in uv installation.

General Changes

  • Added different optional dependency version for pytorch which use different index urls when used via uv.
  • Updated Readme.
  • Also added B200 to MFU calculator.

Checklist before submitting final PR

  • My PR is minimal and addresses one issue in isolation
  • I have merged the latest version of the target branch into this feature branch
  • I have reviewed my own code w.r.t. correct implementation, missing type hints, proper documentation, etc.
  • I have run a sample config for model training
  • I have checked that all tests run through (python tests/tests.py)
  • I have updated the internal changelog (CHANGELOG_DEV.md)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for different CUDA versions in uv installation by moving PyTorch from a required dependency to an optional dependency with multiple CUDA-specific variants (cpu, cu126, cu128, cu130). The PR configures uv to use different PyTorch index URLs based on the selected CUDA variant.

Changes:

  • Moved torch from required dependencies to optional dependencies with CUDA version variants
  • Added uv-specific configuration for CUDA version conflicts and PyTorch index sources
  • Updated README installation instructions to reflect the new CUDA version selection

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
pyproject.toml Removed torch from dependencies, added CUDA-specific torch extras (cpu, cu126, cu128, cu130), and configured uv for handling PyTorch installation from different index URLs
README.md Updated installation commands to include CUDA version selection syntax for uv

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

pyproject.toml Outdated
Comment on lines 46 to 49
cpu = ["torch>=2.10,<2.11.0"]
cu126 = ["torch>=2.10,<2.11.0"]
cu128 = ["torch>=2.10,<2.11.0"]
cu130 = ["torch>=2.10,<2.11.0"]
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The torch dependency has been moved from the main dependencies to optional dependencies, which means torch is no longer installed by default. Users who install the package without specifying one of the CUDA extras (cpu, cu126, cu128, cu130) will not get PyTorch installed. This is a breaking change that should be documented in the CHANGELOG_DEV.md (which the PR description indicates as incomplete).

Consider whether this is the intended behavior. If users must explicitly choose a CUDA version, this should be clearly communicated in the documentation and changelog.

Copilot uses AI. Check for mistakes.
curl -LsSf https://astral.sh/uv/install.sh | sh

uv sync
uv sync --extra [cpu|cu126|cu128|cu130] # Get CUDA version via nvidia-smi
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The README shows installation commands using bracket notation [cpu|cu126|cu128|cu130], but this is not valid shell syntax. Users cannot literally type this command and expect it to work. The command should be clarified to show that users need to choose ONE option, for example:

  • uv sync --extra cpu
  • uv sync --extra cu126
  • uv sync --extra cu128
  • uv sync --extra cu130

Consider using a different notation or providing explicit examples rather than shell pipe syntax inside brackets.

Copilot uses AI. Check for mistakes.

# For developers: use [tests,linting] and install pre-commit hooks
uv sync --extra tests --extra linting
uv sync --extra [cpu|cu126|cu128|cu130] --extra tests --extra linting
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The README shows installation commands using bracket notation [cpu|cu126|cu128|cu130], but this is not valid shell syntax. Users cannot literally type this command and expect it to work. The command should be clarified to show that users need to choose ONE option, for example:

  • uv sync --extra cpu --extra tests --extra linting
  • uv sync --extra cu126 --extra tests --extra linting

Consider using a different notation or providing explicit examples rather than shell pipe syntax inside brackets.

Copilot uses AI. Check for mistakes.
pyproject.toml Outdated
Comment on lines 46 to 49
cpu = ["torch>=2.10,<2.11.0"]
cu126 = ["torch>=2.10,<2.11.0"]
cu128 = ["torch>=2.10,<2.11.0"]
cu130 = ["torch>=2.10,<2.11.0"]
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The flash-attn dependency (line 27) requires torch to be installed, but torch has been moved to optional dependencies. This could cause installation failures for users who don't specify one of the CUDA extras, or for users installing via pip rather than uv.

Consider either:

  1. Moving flash-attn to the optional dependencies as well, with each CUDA extra including it
  2. Adding a note in the installation documentation that one of the CUDA extras must be specified
  3. Ensuring the package can't be installed without specifying a CUDA extra

Copilot uses AI. Check for mistakes.

# Install PyTorch, psutil, Ninja and Flash Attention
pip install "torch<2.11.0"
pip install "torch<2.11.0" # Or appropriate version for your CUDA setup.
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The comment suggests using "appropriate version for your CUDA setup" but the version constraint "torch<2.11.0" doesn't specify how to select the CUDA version. With the new changes, users should be directed to use the appropriate PyTorch index URL for their CUDA version when installing manually, or they should install with extras like in Option 1. Consider updating this comment to align with the new CUDA version selection approach.

Suggested change
pip install "torch<2.11.0" # Or appropriate version for your CUDA setup.
# For PyTorch, select the correct index URL for your CUDA/CPU setup from https://pytorch.org/get-started/locally/
pip install --index-url https://download.pytorch.org/whl/cu121 "torch<2.11.0"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant