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

feat: add has_message_passing API #3851

Merged
merged 6 commits into from
Jun 6, 2024

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Jun 4, 2024

Fix #3713. Fix #3733. This is a breaking change.

Summary by CodeRabbit

  • New Features
    • Introduced a new method has_message_passing across various descriptor classes. This method returns a boolean indicating whether the descriptor has message passing capability.

njzjz added 3 commits June 3, 2024 18:14
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Copy link
Contributor

coderabbitai bot commented Jun 4, 2024

Walkthrough

Walkthrough

The recent changes introduce a new method has_message_passing across various descriptor classes in the deepmd project. This method returns a boolean value indicating whether a descriptor or descriptor block has message passing capability. These additions are spread across multiple files and modules within deepmd/dpmodel/descriptor and deepmd/pt/model/descriptor.

Changes

Files/Modules Change Summary
deepmd/.../dpa1.py, deepmd/.../dpa2.py Added has_message_passing(self) -> bool method to indicate message passing capability.
deepmd/.../descriptor.py Introduced abstract method has_message_passing in DescriptorBlock class.
deepmd/.../repformers.py Added has_message_passing(self) -> bool method to DescriptorBlock class.
deepmd/.../se_a.py, deepmd/.../se_atten.py, deepmd/.../se_t.py Added has_message_passing(self) -> bool method to Descriptor class.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Replace string search with API call in freeze function (#3713) The changes add has_message_passing but do not directly address replacing string search.
Implement API to decide if message passing is needed (#3733)

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a87e3c2 and 6e441a5.

Files selected for processing (11)
  • deepmd/dpmodel/descriptor/descriptor.py (1 hunks)
  • deepmd/dpmodel/descriptor/dpa1.py (2 hunks)
  • deepmd/dpmodel/descriptor/dpa2.py (1 hunks)
  • deepmd/dpmodel/descriptor/repformers.py (1 hunks)
  • deepmd/pt/model/descriptor/descriptor.py (1 hunks)
  • deepmd/pt/model/descriptor/dpa1.py (1 hunks)
  • deepmd/pt/model/descriptor/dpa2.py (1 hunks)
  • deepmd/pt/model/descriptor/repformers.py (1 hunks)
  • deepmd/pt/model/descriptor/se_a.py (2 hunks)
  • deepmd/pt/model/descriptor/se_atten.py (1 hunks)
  • deepmd/pt/model/descriptor/se_t.py (2 hunks)
Files skipped from review as they are similar to previous changes (6)
  • deepmd/dpmodel/descriptor/dpa1.py
  • deepmd/dpmodel/descriptor/dpa2.py
  • deepmd/pt/model/descriptor/dpa1.py
  • deepmd/pt/model/descriptor/dpa2.py
  • deepmd/pt/model/descriptor/se_a.py
  • deepmd/pt/model/descriptor/se_t.py
Additional comments not posted (5)
deepmd/dpmodel/descriptor/descriptor.py (1)

129-131: The addition of the abstract method has_message_passing is correctly implemented and well-documented.

deepmd/pt/model/descriptor/descriptor.py (1)

172-174: The addition of the abstract method has_message_passing is correctly implemented and well-documented.

deepmd/pt/model/descriptor/repformers.py (1)

552-554: The implementation of the method has_message_passing in DescrptBlockRepformers correctly overrides the abstract method from the base class and is well-documented.

deepmd/pt/model/descriptor/se_atten.py (1)

584-587: The implementation of has_message_passing correctly returns False, aligning with the PR objectives and the AI-generated summary.

deepmd/dpmodel/descriptor/repformers.py (1)

390-393: Validate return type consistency for has_message_passing.

Please verify that all implementations of has_message_passing across different classes return a consistent type. This is crucial for maintaining type safety and expected behavior across the module.


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 Configration 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.

@njzjz njzjz changed the title add has_message_passing API feat: add has_message_passing API Jun 4, 2024
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: 1

deepmd/pt/model/descriptor/se_a.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

Attention: Patch coverage is 80.64516% with 12 lines in your changes missing coverage. Please review.

Project coverage is 82.67%. Comparing base (f23c77e) to head (6e441a5).
Report is 122 commits behind head on devel.

Files with missing lines Patch % Lines
deepmd/dpmodel/descriptor/dpa1.py 50.00% 2 Missing ⚠️
deepmd/pt/model/descriptor/se_t.py 50.00% 2 Missing ⚠️
deepmd/dpmodel/atomic_model/linear_atomic_model.py 50.00% 1 Missing ⚠️
...eepmd/dpmodel/atomic_model/pairtab_atomic_model.py 50.00% 1 Missing ⚠️
deepmd/dpmodel/descriptor/dpa2.py 50.00% 1 Missing ⚠️
deepmd/dpmodel/descriptor/hybrid.py 50.00% 1 Missing ⚠️
deepmd/dpmodel/descriptor/repformers.py 50.00% 1 Missing ⚠️
deepmd/dpmodel/descriptor/se_t.py 0.00% 1 Missing ⚠️
deepmd/pt/model/descriptor/se_r.py 50.00% 1 Missing ⚠️
deepmd/pt/model/model/frozen.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3851      +/-   ##
==========================================
+ Coverage   82.63%   82.67%   +0.03%     
==========================================
  Files         515      515              
  Lines       49533    49609      +76     
  Branches     2985     2985              
==========================================
+ Hits        40932    41013      +81     
+ Misses       7690     7686       -4     
+ Partials      911      910       -1     

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

Copy link
Collaborator

@CaRoLZhangxy CaRoLZhangxy left a comment

Choose a reason for hiding this comment

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

Maybe the return value of has_message_passing of dpa1 and dpa2 descriptor should be decided by the return value of the same method in se_atten and reformer descriptors. Then the definition of has_message_passing of these descriptors should be added

njzjz added 3 commits June 4, 2024 16:39
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
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: 2

Outside diff range and nitpick comments (1)
deepmd/dpmodel/descriptor/repformers.py (1)

390-393: Ensure consistency in method documentation.

The method documentation could be more descriptive. Consider explaining what "message passing" means in this context to help future developers understand its use.

deepmd/dpmodel/descriptor/repformers.py Show resolved Hide resolved
@njzjz njzjz requested a review from CaRoLZhangxy June 4, 2024 21:26
@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Jun 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 6, 2024
@njzjz njzjz added this pull request to the merge queue Jun 6, 2024
Merged via the queue into deepmodeling:devel with commit 1a02e56 Jun 6, 2024
60 checks passed
@njzjz njzjz deleted the has_message_passing branch June 6, 2024 04:25
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this pull request Sep 18, 2024
Fix deepmodeling#3713. Fix deepmodeling#3733. This is a breaking change.

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

- **New Features**
- Introduced a new method `has_message_passing` across various
descriptor classes. This method returns a boolean indicating whether the
descriptor has message passing capability.
<!-- 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
Projects
None yet
3 participants