-
Notifications
You must be signed in to change notification settings - Fork 584
chore(CI): bump PyTorch from 2.7 to 2.8 #4884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 PR updates PyTorch from version 2.7 to 2.8 across the entire codebase, including both runtime configuration and CI/CD workflows.
- Updates PyTorch version references from 2.7 to 2.8 in Python configuration files
- Updates PyTorch installation commands in GitHub Actions workflows
- Updates libtorch download URL for development containers
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| backend/find_pytorch.py | Updates default PyTorch version for CUDA 12.2+ environments |
| .github/workflows/test_cuda.yml | Updates PyTorch installation command in CUDA testing workflow |
| .github/workflows/test_cc.yml | Updates PyTorch CPU installation command in C++ testing workflow |
| .github/workflows/codeql.yml | Updates PyTorch CPU installation command in CodeQL analysis workflow |
| .github/workflows/build_cc.yml | Updates PyTorch CPU installation command in C++ build workflow |
| .devcontainer/download_libtorch.sh | Updates libtorch download URL to version 2.8.0 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📝 WalkthroughWalkthroughBumps PyTorch-related versions across scripts and CI: updates libtorch CPU download to 2.8.0, workflow installations to torch 2.8/2.8.0, and backend get_pt_requirement to select torch 2.8.* for Linux x86_64 with CUDA 12.x. No control-flow changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (6)
.devcontainer/download_libtorch.sh (1)
7-7: Make libtorch version configurable to reduce future churnHard-coding the version forces PRs for every bump. Allow overriding via env var while defaulting to 2.8.0+cpu.
Apply this diff to the download line:
-wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.8.0%2Bcpu.zip -O ~/libtorch.zip +wget "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION:-2.8.0+cpu}.zip" -O ~/libtorch.zipAnd add this near the top (outside the changed hunk) to document usage:
# Optional: export LIBTORCH_VERSION=2.8.0+cpu to override the defaultbackend/find_pytorch.py (5)
118-120: Update the comment to match the SpecifierSet (12.x, not just 12.2).The code accepts any CUDA in [12,13), but the comment says “CUDA 12.2”. Recommend broadening the comment for accuracy.
- if cuda_version == "" or cuda_version in SpecifierSet(">=12,<13"): - # CUDA 12.2, cudnn 9 + if cuda_version == "" or cuda_version in SpecifierSet(">=12,<13"): + # CUDA 12.x (cudnn 9) pt_version = "2.8.0"
109-128: Respect explicit pt_version/env override; only default when unset.Currently, the CIBUILDWHEEL branch unconditionally sets pt_version even if the caller passed an explicit pt_version or set PYTORCH_VERSION. Suggest reading the env override first and only defaulting when still empty. This preserves caller intent and reduces surprise.
if pt_version is None: return {"torch": []} - if ( - os.environ.get("CIBUILDWHEEL", "0") == "1" - and platform.system() == "Linux" - and platform.machine() == "x86_64" - ): - cuda_version = os.environ.get("CUDA_VERSION", "12.2") - if cuda_version == "" or cuda_version in SpecifierSet(">=12,<13"): - # CUDA 12.2, cudnn 9 - pt_version = "2.8.0" - elif cuda_version in SpecifierSet(">=11,<12"): - # CUDA 11.8, cudnn 8 - pt_version = "2.3.1" - else: - raise RuntimeError("Unsupported CUDA version") from None if pt_version == "": pt_version = os.environ.get("PYTORCH_VERSION", "") + if ( + os.environ.get("CIBUILDWHEEL", "0") == "1" + and platform.system() == "Linux" + and platform.machine() == "x86_64" + and (pt_version == "" or pt_version.lower() == "auto") + ): + cuda_version = os.environ.get("CUDA_VERSION", "12.2") + if cuda_version == "" or cuda_version in SpecifierSet(">=12,<13"): + # CUDA 12.x (cudnn 9) + pt_version = "2.8.0" + elif cuda_version in SpecifierSet(">=11,<12"): + # CUDA 11.8, cudnn 8 + pt_version = "2.3.1" + else: + raise RuntimeError("Unsupported CUDA version") from None
48-54: Fix docstring: “TensorFlow requirement” → “PyTorch requirement”.Minor copy/paste oversight.
Returns ------- str, optional PyTorch library path if found. list of str - TensorFlow requirement if not found. Empty if found. + PyTorch requirement if not found. Empty if found.
149-151: Fix docstring: “TF” → “PyTorch”.Clarify the function description to match the implementation.
-def get_pt_version(pt_path: Optional[Union[str, Path]]) -> str: - """Get TF version from a TF Python library path. +def get_pt_version(pt_path: Optional[Union[str, Path]]) -> str: + """Get PyTorch version from a PyTorch Python library path.
164-168: Avoid executing arbitrary module code when reading version; add safe fallback.Importing and exec’ing version.py executes code from an arbitrary path. Add a safe fallback that parses version without execution.
- spec = importlib.util.spec_from_file_location("torch.version", version_file) - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - return module.__version__ + try: + spec = importlib.util.spec_from_file_location("torch.version", version_file) + module = importlib.util.module_from_spec(spec) # type: ignore[arg-type] + if spec is None or spec.loader is None: + raise ImportError("Failed to load spec") + spec.loader.exec_module(module) # type: ignore[union-attr] + return module.__version__ # type: ignore[attr-defined] + except Exception: + import re + text = version_file.read_text(encoding="utf-8") + m = re.search(r'__version__\s*=\s*[\'"]([^\'"]+)[\'"]', text) + return m.group(1) if m else ""
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.devcontainer/download_libtorch.sh(1 hunks).github/workflows/build_cc.yml(1 hunks).github/workflows/codeql.yml(1 hunks).github/workflows/test_cc.yml(1 hunks).github/workflows/test_cuda.yml(1 hunks)backend/find_pytorch.py(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
- GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
- GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
- GitHub Check: Build wheels for cp311-manylinux_x86_64
- GitHub Check: Build wheels for cp311-win_amd64
- GitHub Check: Build wheels for cp311-macosx_x86_64
- GitHub Check: Build wheels for cp311-macosx_arm64
- GitHub Check: Build wheels for cp311-manylinux_x86_64
- GitHub Check: Build wheels for cp310-manylinux_aarch64
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (c-cpp)
- GitHub Check: Build C++ (cuda, cuda)
- GitHub Check: Build C++ (rocm, rocm)
- GitHub Check: Build C++ (cuda120, cuda)
- GitHub Check: Build C++ (cpu, cpu)
- GitHub Check: Build C++ (clang, clang)
- GitHub Check: Test C++ (false)
- GitHub Check: Test Python (1, 3.12)
- GitHub Check: Test C++ (true)
- GitHub Check: Test Python (6, 3.12)
- GitHub Check: Test Python (5, 3.9)
- GitHub Check: Test Python (6, 3.9)
- GitHub Check: Test Python (1, 3.9)
- GitHub Check: Test Python (2, 3.9)
- GitHub Check: Test Python (5, 3.12)
- GitHub Check: Test Python (2, 3.12)
- GitHub Check: Test Python (4, 3.9)
- GitHub Check: Test Python (3, 3.12)
- GitHub Check: Test Python (4, 3.12)
- GitHub Check: Test Python (3, 3.9)
🔇 Additional comments (1)
backend/find_pytorch.py (1)
117-121: Confirmed PyTorch 2.8.0 CUDA 12.x wheel availability & no stale 2.7 refs
- No
torch==2.7.0orlibtorch…2.7pins were found in the repo.- Official 2.8.0 pip wheels on Linux x86_64 are published for:
• CUDA 12.6 (cu126)
• CUDA 12.8 (cu128)
• CUDA 12.9 (cu129)
• CPU-only- Index URLs for installation:
• cu126: https://download.pytorch.org/whl/cu126
• cu128: https://download.pytorch.org/whl/cu128
• cu129: https://download.pytorch.org/whl/cu129
• cpu: https://download.pytorch.org/whl/cpuLGTM – bump to 2.8.0 for CUDA 12.x is safe.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Jinzhe Zeng <njzjz@qq.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #4884 +/- ##
==========================================
- Coverage 84.29% 84.29% -0.01%
==========================================
Files 702 703 +1
Lines 68665 68728 +63
Branches 3572 3572
==========================================
+ Hits 57884 57935 +51
- Misses 9642 9653 +11
- Partials 1139 1140 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
64e108f
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Upgraded PyTorch to 2.8 across CPU and CUDA 12.x environments for improved compatibility and stability. * Updated development container to download the matching LibTorch 2.8 CPU bundle. * Refreshed CI pipelines (build, test, analysis) to install and validate against PyTorch 2.8. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <njzjz@qq.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit