Skip to content
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

ci: pin PT to 2.3.1 when using CUDA #4009

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Jul 23, 2024

PT 2.4.0 requires cudnn 9, incompatible with the latest TF with cudnn 8.

Summary by CodeRabbit

  • New Features

    • Updated the build process to optimize resource usage by removing unnecessary files.
    • Specified a fixed version for PyTorch to ensure consistent functionality across environments.
  • Documentation

    • Added configuration settings to manage library dependencies and ensure compatibility.

Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

Walkthrough

The recent changes enhance the GitHub Actions workflows and dependency management for building and testing a Python package. Key updates include optimizing the wheel building process by removing an unnecessary tools folder, locking the PyTorch version to 2.3.1 to ensure compatibility, and specifying this version in the pyproject.toml file. These adjustments aim to improve build efficiency and maintain consistency across different environments.

Changes

File Summary
.github/workflows/build_wheel.yml Added a step to delete the /opt/hostedtoolcache tools folder before checkout and artifact download to optimize build efficiency.
.github/workflows/test_cuda.yml Updated the installation command to fix PyTorch version at 2.3.1, ensuring specific compatibility while retaining existing conditions.
pyproject.toml Introduced a requirement for PyTorch version 2.3.1 and noted compatibility issues with cuDNN versions, impacting Windows build configuration.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a6ea2c1 and 06df084.

Files selected for processing (3)
  • .github/workflows/build_wheel.yml (1 hunks)
  • .github/workflows/test_cuda.yml (1 hunks)
  • pyproject.toml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/build_wheel.yml
Additional comments not posted (1)
.github/workflows/test_cuda.yml (1)

50-50: LGTM! Verify the impact of version pinning on the codebase.

The change to pin PyTorch to version 2.3.1 is approved.

However, ensure that this version pinning does not affect other parts of the codebase that might rely on newer PyTorch features.

Verification successful

No issues found with PyTorch version pinning.

The search did not reveal any usage of features introduced after PyTorch 2.3.1. The match for torch_func is a false positive as it refers to torch.nn.functional.

  • The version pinning to PyTorch 2.3.1 can be safely applied.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of PyTorch version pinning on the codebase.

# Test: Search for PyTorch usage. Expect: No usage of features introduced after version 2.3.1.
rg --type python -A 5 $'import torch'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify the impact of PyTorch version pinning on the codebase.

# Test: Search for PyTorch usage. Expect: No usage of features introduced after version 2.3.1.
rg --type py -A 5 $'import torch'

Length of output: 52668


Script:

#!/bin/bash
# Description: Extract and review the context around `import torch` statements to identify any usage of features introduced after PyTorch 2.3.1.

# Extract lines around `import torch` statements for further review.
rg --type py -A 10 -B 10 $'import torch' > torch_usage_context.txt

# Display the collected context for manual inspection.
cat torch_usage_context.txt

Length of output: 147285


Script:

#!/bin/bash
# Description: Search for usage of features introduced after PyTorch 2.3.1 in the extracted context.

# List of features introduced after PyTorch 2.3.1 (example features, this list should be updated with actual features introduced after 2.3.1)
features=(
    "torch.compile"
    "torch.func"
    "torch.special"
    "torch.ao"
)

# Search for these features in the extracted context
for feature in "${features[@]}"; do
    echo "Searching for feature: $feature"
    rg --type py -A 10 -B 10 $feature torch_usage_context.txt
done

Length of output: 1943


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
pyproject.toml (1)

268-269: Compatibility Issues Found with PyTorch Version Pinning

The codebase uses features introduced in PyTorch 2.4.0 and later, such as torch._dynamo, torch_func, and torch.compiled_with_cxx11_abi. Pinning PyTorch to version 2.3.1 will likely cause compatibility issues.

  • Files with incompatible features:
    • deepmd/pt/train/training.py
    • deepmd/pt/train/wrapper.py
    • deepmd/pt/model/network/init.py
    • deepmd/pt/model/descriptor/se_atten.py
    • deepmd/pt/infer/inference.py
    • deepmd/pt/cxx_op.py

Please review and address these compatibility concerns to ensure the codebase functions correctly with the specified PyTorch version.

Analysis chain

LGTM! Verify the impact of version pinning on the codebase.

The change to specify the PyTorch version as 2.3.1 is approved.

However, ensure that this version pinning does not affect other parts of the codebase that might rely on newer PyTorch features.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of PyTorch version pinning on the codebase.

# Test: Search for PyTorch usage. Expect: No usage of features introduced after version 2.3.1.
rg --type python -A 5 $'import torch'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify the impact of PyTorch version pinning on the codebase.

# Test: Search for PyTorch usage. Expect: No usage of features introduced after version 2.3.1.
rg --glob '*.py' -A 5 'import torch'

Length of output: 52672


Script:

#!/bin/bash
# Description: Verify the impact of PyTorch version pinning on the codebase by checking for usage of features introduced after version 2.3.1.

# Test: Search for usage of features introduced in PyTorch 2.4.0 and later.
rg --glob '*.py' -e 'torch.compile' -e 'torch.func' -e 'torch._dynamo' -e 'torch._inductor' -e 'torch._functorch' -e 'torch._export'

Length of output: 1348

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.84%. Comparing base (399646e) to head (06df084).
Report is 118 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4009      +/-   ##
==========================================
+ Coverage   82.83%   82.84%   +0.01%     
==========================================
  Files         522      522              
  Lines       50872    50920      +48     
  Branches     3015     3011       -4     
==========================================
+ Hits        42142    42187      +45     
- Misses       7795     7798       +3     
  Partials      935      935              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Jul 24, 2024
Merged via the queue into deepmodeling:devel with commit 9e14d45 Jul 24, 2024
60 checks passed
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this pull request Sep 18, 2024
PT 2.4.0 requires cudnn 9, incompatible with the latest TF with cudnn 8.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Updated the build process to optimize resource usage by removing
unnecessary files.
- Specified a fixed version for PyTorch to ensure consistent
functionality across environments.
	
- **Documentation**
- Added configuration settings to manage library dependencies and ensure
compatibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
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.

2 participants