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

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 support for PaddlePaddle in the DeePMD framework, enhancing model training and evaluation capabilities.
    • Added new backend options and configuration files for multitask models.
    • Implemented new classes and methods for handling Paddle-specific functionalities, including descriptor calculations and model evaluations.
    • Enhanced the command-line interface to include Paddle as a backend option.
    • Expanded the functionality for managing Paddle dependencies and configurations in the testing framework.
  • Bug Fixes

    • Improved error handling and robustness in various components across the framework.
  • Tests

    • Expanded the test suite to include Paddle-specific tests, ensuring consistency and reliability across different backends.
    • Introduced unit tests for new functionalities related to Paddle, including model evaluations and descriptor calculations.
    • Added tests to validate force gradient calculations and smoothness properties in models.
    • Implemented tests for neighbor statistics and region transformations, ensuring accuracy in calculations.
  • Documentation

    • Updated documentation across multiple modules to reflect new features and usage instructions.

@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

The pull request introduces significant updates across multiple files to enhance the integration of PaddlePaddle within the DeepMD framework. Key changes include updates to workflow configurations for testing, the addition of new classes and methods for Paddle-specific functionalities, and enhancements to existing tests to accommodate Paddle. The updates also include new JSON configuration files for models, improvements in error handling, and the introduction of new utility functions, all aimed at expanding the framework's capabilities and ensuring compatibility with PaddlePaddle.

Changes

File Path Change Summary
.github/workflows/test_python.yml Added branches-ignore for certain branches and a merge_group for job concurrency management. A new installation step for PaddlePaddle added in testpython job.
backend/find_paddle.py Introduced functions for locating PaddlePaddle library and managing its version requirements.
deepmd/backend/paddle.py Added PaddleBackend class with methods for backend availability and model serialization.
deepmd/main.py Enhanced command-line interface to include a new backend option for Paddle.
deepmd/pd/entrypoints/__init__.py Added SPDX license identifier.
deepmd/pd/entrypoints/main.py Implemented command-line functionalities for managing model training and evaluation.
deepmd/pd/infer/deep_eval.py Introduced DeepEval class for evaluating models in Paddle.
deepmd/pd/infer/inference.py Added Tester class for testing DeePMD models.
deepmd/pd/loss/__init__.py New module for loss functions initialized with imports.
deepmd/pd/loss/ener.py Introduced EnergyStdLoss class for computing energy-related losses.
deepmd/pd/loss/loss.py Added TaskLoss class for defining loss function interfaces.
deepmd/pd/model/__init__.py Added SPDX license identifier.
deepmd/pd/model/atomic_model/__init__.py New module documentation added for atomic models.
deepmd/pd/model/atomic_model/base_atomic_model.py Introduced BaseAtomicModel class for managing atomic contributions.
deepmd/pd/model/atomic_model/dp_atomic_model.py Added DPAtomicModel class for atomic predictions.
deepmd/pd/model/atomic_model/energy_atomic_model.py Introduced DPEnergyAtomicModel for energy atomic modeling.
deepmd/pd/model/descriptor/__init__.py New module for descriptor initialization.
deepmd/pd/model/descriptor/base_descriptor.py Added BaseDescriptor for descriptor functionalities.
deepmd/pd/model/descriptor/descriptor.py Introduced DescriptorBlock class for descriptor implementations.
deepmd/pd/model/descriptor/env_mat.py Added functions for constructing environment matrices.
deepmd/pd/model/descriptor/se_a.py Introduced DescrptSeA class for specific descriptor calculations.
deepmd/pd/model/model/__init__.py Updated model framework with detailed docstring and internal functions.
deepmd/pd/model/model/dp_model.py Added DPModelCommon class for common model methods.
deepmd/pd/model/model/ener_model.py Introduced EnergyModel class for energy-related predictions.
deepmd/pd/model/model/frozen.py Added FrozenModel class for loading models from frozen states.
deepmd/pd/model/model/make_model.py Introduced make_model function for model creation.
deepmd/pd/model/model/model.py Added BaseModel class for foundational model functionalities.
deepmd/pd/model/model/transform_output.py Introduced functions for transforming model outputs.
deepmd/pd/model/network/__init__.py Added SPDX license identifier.
deepmd/pd/model/network/init.py Introduced tensor initialization functions for Paddle.
deepmd/pd/model/network/mlp.py Implemented MLP architecture with various layer classes.
deepmd/pd/model/network/network.py Enhanced type embedding network functionalities.
deepmd/pd/model/task/__init__.py New module initialization for task-related classes.
deepmd/pd/model/task/base_fitting.py Introduced BaseFitting class for fitting networks.
deepmd/pd/model/task/ener.py Added EnergyFittingNet class for energy fitting networks.
deepmd/pd/model/task/fitting.py Introduced Fitting class for multitask fitting networks.
deepmd/pd/model/task/invar_fitting.py Added InvarFitting class for invariant fitting networks.
deepmd/pd/model/task/task.py Added SPDX license identifier.
deepmd/pd/train/__init__.py Introduced SPDX license identifier.
deepmd/pd/train/training.py Added Trainer class for managing the training process.
deepmd/pd/train/wrapper.py Introduced ModelWrapper class for encapsulating models.
deepmd/pd/utils/__init__.py Added SPDX license identifier.
deepmd/pd/utils/auto_batch_size.py Introduced AutoBatchSize class for managing batch sizes.
deepmd/pd/utils/dataloader.py Added DpLoaderSet class for parallelized data loading.
deepmd/pd/utils/dataset.py Introduced DeepmdDataSetForLoader class for managing datasets.
deepmd/pd/utils/decomp.py Added functions for high-order differentiation.
deepmd/pd/utils/dp_random.py Introduced dp_random.py for random number generation utilities.
deepmd/pd/utils/env.py Enhanced environment configuration functionalities.
deepmd/pd/utils/env_mat_stat.py Added EnvMatStat classes for environmental matrix statistics.
deepmd/pd/utils/exclude_mask.py Introduced AtomExcludeMask and PairExcludeMask classes for handling exclusion masks.
deepmd/pd/utils/finetune.py Added functions for fine-tuning models.
deepmd/pd/utils/multi_task.py Introduced functions for preprocessing shared parameters in multitask models.
deepmd/pd/utils/neighbor_stat.py Added NeighborStatOP and NeighborStat classes for neighbor statistics.
deepmd/pd/utils/nlist.py Introduced functions for managing neighbor lists.
deepmd/pd/utils/preprocess.py Added compute_smooth_weight function for calculating smooth weights.
deepmd/pd/utils/region.py Introduced functions for coordinate transformations.
deepmd/pd/utils/serialization.py Added serialization and deserialization functions for models.
deepmd/pd/utils/stat.py Introduced functions for computing and managing statistical data.
deepmd/pd/utils/update_sel.py Added UpdateSel class for managing selection updates.
deepmd/pd/utils/utils.py Enhanced ActivationFn class and utility functions for tensor operations.
deepmd/utils/batch_size.py Updated AutoBatchSize class for handling batch operations.
deepmd/utils/data.py Introduced get_item_paddle method for Paddle data retrieval.
pyproject.toml Updated dependency management and testing configurations for Paddle.
source/tests/consistent/common.py Added support for Paddle in the testing framework.
source/tests/consistent/descriptor/common.py Introduced Paddle evaluation methods in descriptor tests.
source/tests/consistent/descriptor/test_se_e2_a.py Enhanced descriptor tests to include Paddle functionality.
source/tests/consistent/fitting/common.py Added Paddle conditional checks in fitting tests.
source/tests/consistent/fitting/test_ener.py Enhanced energy fitting tests to support Paddle.
source/tests/consistent/model/common.py Introduced Paddle utilities in model tests.
source/tests/consistent/model/test_ener.py Integrated Paddle into energy model tests.
source/tests/consistent/test_activation.py Added Paddle activation function tests.
source/tests/consistent/test_type_embedding.py Enhanced type embedding tests to support Paddle.
source/tests/pd/__init__.py Added license identifier and initialization for Paddle.
source/tests/pd/model/test_force_grad.py Introduced unit tests for force gradient calculations.
source/tests/pd/model/test_jit.py Added unit tests for JIT compilation functionality.
source/tests/pd/model/test_null_input.py Established tests for null input scenarios.
source/tests/pd/model/test_smooth.py Introduced tests for model smoothness properties.
source/tests/pd/test_change_bias.py Added tests for changing model output bias.
deepmd/dpmodel/model/make_model.py Enhanced model creation functions with additional methods.
source/tests/consistent/test_neighbor_stat.py Added Paddle support in neighbor statistics tests.
source/tests/pd/model/test_descriptor.py Established tests for descriptor functionality.
source/tests/pd/model/test_embedding_net.py Introduced tests for embedding networks.
source/tests/pd/model/test_model.py Added tests for model behavior and consistency across frameworks.
source/tests/pd/model/water/se_atten.json New JSON configuration for model parameters.
source/tests/pd/model/water/multitask.json New JSON configuration for multitask model parameters.

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Workflow
    participant Test as Test Runner
    participant Paddle as Paddle Backend
    participant Model as DeepMD Model

    CI->>Test: Trigger Tests
    Test->>Paddle: Check Paddle Installation
    alt Paddle Installed
        Test->>Model: Load Model
        Model->>Paddle: Run Model Evaluation
        Paddle-->>Model: Return Results
        Test-->>CI: Report Success
    else Paddle Not Installed
        Test-->>CI: Report Skipped Tests
    end
Loading

Possibly related PRs

  • ci: install GPU JAX in GPU CI #4293: The changes in the main PR regarding the workflow configuration for testing Python and the addition of PaddlePaddle are related to the installation of GPU JAX in the CI, as both involve enhancing the testing framework to accommodate new dependencies.
  • fix: consistent DPA-1 model #4320: The modifications to the DescrptHybrid class in the retrieved PR enhance the configurability of descriptors, which aligns with the main PR's focus on expanding the testing framework to include PaddlePaddle, indicating a broader effort to improve model handling across different frameworks.
  • fix(dp/pt): support auto sel for dpa2 #4323: The updates to the DescrptDPA2 class in this PR, which enhance the selection update process, are relevant as they reflect ongoing improvements in model descriptors that may be tested or utilized in the updated testing workflows introduced in the main PR.

Suggested labels

Docs

Suggested reviewers

  • njzjz
  • iProzd
  • 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 79.67517% with 876 lines in your changes missing coverage. Please review.

Project coverage is 83.19%. Comparing base (0ad4289) to head (7e05c35).
Report is 36 commits behind head on devel.

Files with missing lines Patch % Lines
deepmd/pd/train/training.py 76.48% 139 Missing ⚠️
deepmd/pd/infer/deep_eval.py 44.00% 98 Missing ⚠️
deepmd/pd/model/network/init.py 23.85% 83 Missing ⚠️
deepmd/pd/entrypoints/main.py 66.82% 71 Missing ⚠️
deepmd/pd/utils/stat.py 75.68% 53 Missing ⚠️
deepmd/pd/model/network/network.py 57.14% 45 Missing ⚠️
deepmd/pd/model/network/mlp.py 73.91% 36 Missing ⚠️
deepmd/pd/model/task/fitting.py 84.28% 33 Missing ⚠️
deepmd/pd/utils/dataloader.py 82.24% 30 Missing ⚠️
deepmd/pd/model/model/frozen.py 53.33% 28 Missing ⚠️
... and 30 more
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4302      +/-   ##
==========================================
- Coverage   84.50%   83.19%   -1.31%     
==========================================
  Files         596      649      +53     
  Lines       56665    60967    +4302     
  Branches     3459     3461       +2     
==========================================
+ Hits        47884    50721    +2837     
- Misses       7654     9118    +1464     
- Partials     1127     1128       +1     

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

@njzjz
Copy link
Member

njzjz commented Nov 6, 2024

Attention: Patch coverage is 55.25965% with 2016 lines in your changes missing coverage. Please review.

About 2000+ lines have yet to be tested in the CI. Could you take a look at the coverage report?

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

🧹 Outside diff range and nitpick comments (4)
source/tests/pd/model/test_model.py (4)

65-85: Add input validation and improve documentation for paddle2tf

The function would benefit from:

  1. Input validation for paddle_name
  2. Type hints
  3. Docstring explaining the name conversion logic
-def paddle2tf(paddle_name, last_layer_id=None):
+def paddle2tf(paddle_name: str, last_layer_id: int | None = None) -> str | None:
+    """Convert PaddlePaddle parameter names to TensorFlow format.
+    
+    Args:
+        paddle_name: Parameter name in PaddlePaddle format
+        last_layer_id: ID of the last layer for fitting net conversion
+    
+    Returns:
+        Converted name in TensorFlow format, or None if name should be skipped
+        
+    Raises:
+        ValueError: If paddle_name is invalid
+    """
+    if not isinstance(paddle_name, str):
+        raise ValueError(f"paddle_name must be a string, got {type(paddle_name)}")

89-91: Consider making the configuration file path configurable

Hard-coding the configuration file path makes the code less flexible and harder to test with different configurations.

Consider accepting the config file path as a parameter:

-    def __init__(self) -> None:
+    def __init__(self, config_path: str | None = None) -> None:
+        config_path = config_path or str(Path(__file__).parent / "water/se_e2_a.json")
-        with open(str(Path(__file__).parent / "water/se_e2_a.json")) as fin:
+        with open(config_path) as fin:

236-239: Simplify dictionary key iteration

The dictionary key iteration can be simplified by directly iterating over the dictionary.

-        for kk in data_dict.keys():
+        for kk in data_dict:
             if kk == "type":
                 continue

-        for kk in batch.keys():
+        for kk in batch:
             if kk == "find_type" or kk == "type":
                 continue

Also applies to: 254-257

🧰 Tools
🪛 Ruff

236-236: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


386-390: Extract magic numbers into named constants

The tolerance values used in assertions should be defined as class constants for better maintainability.

+    # Tolerance values for numerical comparisons
+    RELATIVE_TOLERANCE = 1e-5
+    ABSOLUTE_TOLERANCE = 1e-8
+
     def test_consistency(self) -> None:
-        rtol = 1e-5
-        atol = 1e-8
         np.testing.assert_allclose(
             head_dict["loss"], 
             loss.cpu().detach().numpy(), 
-            rtol=rtol, 
-            atol=atol
+            rtol=self.RELATIVE_TOLERANCE, 
+            atol=self.ABSOLUTE_TOLERANCE
         )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f272cd9 and 7e05c35.

📒 Files selected for processing (2)
  • pyproject.toml (6 hunks)
  • source/tests/pd/model/test_model.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
🧰 Additional context used
🪛 Ruff
source/tests/pd/model/test_model.py

236-236: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


254-254: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


415-415: Local variable bdata is assigned to but never used

Remove assignment to unused variable bdata

(F841)

source/tests/pd/model/test_model.py Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (2)
source/tests/pd/model/test_model.py (2)

65-84: Add docstring and improve error handling in paddle2tf

The function would benefit from:

  1. A docstring explaining the purpose, parameters, and return value
  2. More descriptive error message including examples of expected format

Apply this diff:

 def paddle2tf(paddle_name, last_layer_id=None):
+    """Convert PaddlePaddle parameter names to TensorFlow format.
+    
+    Args:
+        paddle_name: Parameter name in PaddlePaddle format (e.g., "descriptor.networks.0.compress_1")
+        last_layer_id: ID of the last layer for special handling
+    
+    Returns:
+        Equivalent parameter name in TensorFlow format or None if name should be skipped
+    """
     fields = paddle_name.split(".")
     offset = int(fields[3] == "networks") + 1
     element_id = int(fields[2 + offset])
     if fields[1] == "descriptor":
         if fields[2].startswith("compress_"):
             return None
         layer_id = int(fields[4 + offset]) + 1
         weight_type = fields[5 + offset]
         ret = "filter_type_all/%s_%d_%d:0" % (weight_type, layer_id, element_id)
     elif fields[1] == "fitting_net":
         layer_id = int(fields[4 + offset])
         weight_type = fields[5 + offset]
         if layer_id != last_layer_id:
             ret = "layer_%d_type_%d/%s:0" % (layer_id, element_id, weight_type)
         else:
             ret = "final_layer_type_%d/%s:0" % (element_id, weight_type)
     else:
-        raise RuntimeError(f"Unexpected parameter name: {paddle_name}")
+        raise ValueError(
+            f"Unexpected parameter name: {paddle_name}. "
+            "Expected format: 'descriptor.<...>' or 'fitting_net.<...>'"
+        )
     return ret

236-237: Optimize dictionary iteration performance

Using .keys() in dictionary iteration is unnecessary and less efficient.

Apply this diff:

-        for kk in data_dict.keys():
+        for kk in data_dict:
             if kk == "type":
                 continue
-        for kk in batch.keys():
+        for kk in batch:
             if kk == "find_type" or kk == "type":
                 continue

Also applies to: 254-255

🧰 Tools
🪛 Ruff

236-236: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f272cd9 and 7e05c35.

📒 Files selected for processing (2)
  • pyproject.toml (6 hunks)
  • source/tests/pd/model/test_model.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
🧰 Additional context used
🪛 Ruff
source/tests/pd/model/test_model.py

236-236: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


254-254: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


415-415: Local variable bdata is assigned to but never used

Remove assignment to unused variable bdata

(F841)

source/tests/pd/model/test_model.py Show resolved Hide resolved
@HydrogenSulfate
Copy link
Contributor Author

I have some additional comments. We can merge this PR after v3.0.0 is released and the r3.0 branch is checked out.

Thanks for the comments, redundant files&codes were removed.

@njzjz njzjz requested a review from Copilot November 15, 2024 19:38

Choose a reason for hiding this comment

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

Copilot reviewed 121 out of 136 changed files in this pull request and generated no suggestions.

Files not reviewed (15)
  • deepmd/pd/infer/init.py: Evaluated as low risk
  • deepmd/pd/entrypoints/init.py: Evaluated as low risk
  • deepmd/dpmodel/model/make_model.py: Evaluated as low risk
  • deepmd/main.py: Evaluated as low risk
  • .github/workflows/test_python.yml: Evaluated as low risk
  • deepmd/pd/model/init.py: Evaluated as low risk
  • .github/workflows/test_cuda.yml: Evaluated as low risk
  • deepmd/pd/model/atomic_model/dp_atomic_model.py: Evaluated as low risk
  • deepmd/pd/model/atomic_model/energy_atomic_model.py: Evaluated as low risk
  • deepmd/pd/model/descriptor/env_mat.py: Evaluated as low risk
  • deepmd/pd/model/descriptor/base_descriptor.py: Evaluated as low risk
  • deepmd/pd/loss/loss.py: Evaluated as low risk
  • deepmd/pd/model/descriptor/descriptor.py: Evaluated as low risk
  • deepmd/pd/model/descriptor/init.py: Evaluated as low risk
  • deepmd/pd/model/atomic_model/init.py: Evaluated as low risk
@njzjz
Copy link
Member

njzjz commented Nov 25, 2024

@coderabbitai resolve

@njzjz
Copy link
Member

njzjz commented Nov 25, 2024

@coderabbitai resolve

@njzjz
Copy link
Member

njzjz commented Nov 25, 2024

@coderabbitai resolve

... It seems to be not working. The comments may be required to be manually resolved

Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

@njzjz: Sorry that the resolve command didn't work earlier. I have now resolved the comments for you.

✅ Actions performed

Comments resolved.

@njzjz njzjz added this pull request to the merge queue Nov 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 25, 2024
@njzjz
Copy link
Member

njzjz commented Nov 25, 2024

@HydrogenSulfate
Copy link
Contributor Author

@HydrogenSulfate A segfault appears in the GPU test. https://github.com/deepmodeling/deepmd-kit/actions/runs/12005580706/job/33462440790

Thanks for report, I will check it out

@HydrogenSulfate
Copy link
Contributor Author

HydrogenSulfate commented Nov 27, 2024

@HydrogenSulfate A segfault appears in the GPU test. https://github.com/deepmodeling/deepmd-kit/actions/runs/12005580706/job/33462440790

I have make a new environment with cuda11.8 and installed the nightly build paddle(3.0.0.dev20241126), but all paddle tests running successfully as below.

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

image

It seems a weird issue and is there any way to get the detailed error log from Test CUDA?

@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label Nov 27, 2024
@njzjz
Copy link
Member

njzjz commented Nov 27, 2024

It seems a weird issue and is there any way to get the detailed error log from Test CUDA?

It's run in a docker container, so I think it may be reproducible.

Btw, the image is nvidia/cuda:12.6.2-cudnn-devel-ubuntu22.04

@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label Nov 27, 2024
@njzjz
Copy link
Member

njzjz commented Nov 27, 2024

A bit strange, but the segfault disappeared.

@njzjz njzjz enabled auto-merge November 27, 2024 06:46
@njzjz njzjz added this pull request to the merge queue Nov 27, 2024
@HydrogenSulfate
Copy link
Contributor Author

HydrogenSulfate commented Nov 27, 2024

It seems a weird issue and is there any way to get the detailed error log from Test CUDA?

It's run in a docker container, so I think it may be reproducible.

Btw, the image is nvidia/cuda:12.6.2-cudnn-devel-ubuntu22.04

If we can add -v or -vv to pytest's argument(e.g. pytest -vv source/test/) so the test log can be a bit more detailed(but might not clear enough...)

Merged via the queue into deepmodeling:devel with commit 4a45fe5 Nov 27, 2024
63 checks passed
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.

4 participants