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

pd: support paddle backend and water/se_e2_a #4302

Open
wants to merge 17 commits into
base: devel
Choose a base branch
from

Conversation

HydrogenSulfate
Copy link
Contributor

@HydrogenSulfate HydrogenSulfate commented Nov 3, 2024

Split #4157 into several pull requests.

  1. Add core modules of paddle backend(deepmd.pd.*) and related backend module unitests.
  2. Support training/testing/freeze(C++ inference will be supported in subsequent pull request) for example water/se_e2_a.
  3. Add se_e2_a related uinttests

Related PR to be merged:

Accuracy test

pytorch

image

paddle:

deepmd.utils.batch_size                       Adjust batch size from 1024 to 2048
deepmd.utils.batch_size                       Adjust batch size from 2048 to 4096
deepmd.entrypoints.test                       # number of test data : 30 ,
deepmd.entrypoints.test                       Energy MAE         : 7.467160e-02 eV
deepmd.entrypoints.test                       Energy RMSE        : 8.981154e-02 eV
deepmd.entrypoints.test                       Energy MAE/Natoms  : 3.889146e-04 eV
deepmd.entrypoints.test                       Energy RMSE/Natoms : 4.677685e-04 eV
deepmd.entrypoints.test                       Force  MAE         : 4.495974e-02 eV/A
deepmd.entrypoints.test                       Force  RMSE        : 5.883696e-02 eV/A
deepmd.entrypoints.test                       Virial MAE         : 4.683873e+00 eV
deepmd.entrypoints.test                       Virial RMSE        : 6.298489e+00 eV
deepmd.entrypoints.test                       Virial MAE/Natoms  : 2.439517e-02 eV
deepmd.entrypoints.test                       Virial RMSE/Natoms : 3.280463e-02 eV

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced Paddle backend support, enhancing model training and evaluation capabilities.
    • Added new classes and methods for handling Paddle-specific functionalities, including descriptors and fitting networks.
    • Expanded testing framework to include Paddle, ensuring consistency with existing backends like TensorFlow and PyTorch.
  • Bug Fixes

    • Improved error handling and compatibility checks for Paddle operations.
  • Documentation

    • Updated documentation to reflect new Paddle features and usage instructions.
  • Tests

    • Added comprehensive tests for Paddle integration, ensuring functionality across various model components.

@github-actions github-actions bot added the Python label Nov 3, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

coderabbitai bot commented Nov 3, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces significant enhancements to the DeePMD framework, primarily by integrating PaddlePaddle as a new backend. Key changes include updates to the CI workflow for testing, the addition of new classes and methods for managing PaddlePaddle functionalities, and improvements to existing components to support this integration. The modifications also ensure that the testing framework accommodates Paddle alongside TensorFlow and PyTorch, enhancing the overall testing capabilities of the framework.

Changes

File Change Summary
.github/workflows/test_python.yml Updated workflow to ignore pushes to branches matching "gh-readonly-queue/**", added concurrency management, and included installation of PaddlePaddle.
backend/find_paddle.py Introduced functions to locate PaddlePaddle library and manage its version requirements.
deepmd/backend/paddle.py Added PaddleBackend class to integrate Paddle as a backend with various properties and methods.
deepmd/main.py Updated command-line interface to include a new backend option for PaddlePaddle.
deepmd/pd/cxx_op.py Introduced load_library function and ENABLE_CUSTOMIZED_OP variable for library management.
deepmd/pd/entrypoints/main.py Added command-line interface for managing DeePMD functionalities, including training and freezing models.
deepmd/pd/infer/deep_eval.py Introduced DeepEval class for evaluating models using PaddlePaddle.
deepmd/pd/model Multiple files added for various model components, including atomic models, fitting networks, and utilities for managing model interactions with PaddlePaddle.
deepmd/pd/utils New utility files added for data handling, tensor operations, and environment configurations, supporting PaddlePaddle integration.
pyproject.toml Updated dependencies to include PaddlePaddle for testing and modified build configurations.
source/tests/consistent Enhanced test files to support PaddlePaddle, including conditional imports and new evaluation methods for Paddle models.

Possibly related PRs

Suggested labels

Python

Suggested reviewers

  • wanghan-iapcm

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@njzjz njzjz added this to the v3.1.0 milestone Nov 3, 2024
@HydrogenSulfate
Copy link
Contributor Author

Hello @njzjz , I have a question about the naming of the functions serialize_from_file and deserialize_to_file. According to the docstring explanations for these two functions and the general meaning of "serialize," why can't these functions be named serialize_to_file and deserialize_from_file instead? I was confused when I first saw these two functions.

@HydrogenSulfate HydrogenSulfate changed the title Add paddle backend core and water se e2 a pd: support paddle backend and water/se_e2_a Nov 4, 2024
@njzjz
Copy link
Member

njzjz commented Nov 4, 2024

Hello @njzjz , I have a question about the naming of the functions serialize_from_file and deserialize_to_file. According to the docstring explanations for these two functions and the general meaning of "serialize," why can't these functions be named serialize_to_file and deserialize_from_file instead? I was confused when I first saw these two functions.

Do you mean serialize_hook and deserialize_hook?

@property
@abstractmethod
def serialize_hook(self) -> Callable[[str], dict]:
"""The serialize hook to convert the model file to a dictionary.
Returns
-------
Callable[[str], dict]
The serialize hook of the backend.
"""
pass
@property
@abstractmethod
def deserialize_hook(self) -> Callable[[str, dict], None]:
"""The deserialize hook to convert the dictionary to a model file.
Returns
-------
Callable[[str, dict], None]
The deserialize hook of the backend.
"""
pass

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 55.19308% with 2019 lines in your changes missing coverage. Please review.

Project coverage is 81.12%. Comparing base (dabedd2) to head (39842ff).

Files with missing lines Patch % Lines
deepmd/pd/train/training.py 6.51% 531 Missing ⚠️
deepmd/pd/entrypoints/main.py 17.69% 214 Missing ⚠️
deepmd/pd/utils/stat.py 22.47% 169 Missing ⚠️
deepmd/pd/model/network/network.py 37.83% 138 Missing ⚠️
deepmd/pd/utils/preprocess.py 21.76% 133 Missing ⚠️
deepmd/pd/model/network/init.py 23.85% 83 Missing ⚠️
deepmd/pd/utils/finetune.py 10.60% 59 Missing ⚠️
deepmd/pd/model/task/ener.py 41.66% 56 Missing ⚠️
deepmd/pd/utils/env_mat_stat.py 25.67% 55 Missing ⚠️
deepmd/pd/train/wrapper.py 49.03% 53 Missing ⚠️
... and 29 more
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4302      +/-   ##
==========================================
- Coverage   84.40%   81.12%   -3.29%     
==========================================
  Files         570      624      +54     
  Lines       53071    57577    +4506     
  Branches     3054     3054              
==========================================
+ Hits        44794    46708    +1914     
- Misses       7318     9909    +2591     
- Partials      959      960       +1     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants