Skip to content

Conversation

@iProzd
Copy link
Collaborator

@iProzd iProzd commented Jun 25, 2025

Summary by CodeRabbit

  • New Features
    • Added support for displaying "observed-type" information in the model reporting tool, showing element types observed during training for single-task and multi-task models.
  • Tests
    • Updated tests to verify correct reporting of observed types for both single-task and multi-task models.
  • Documentation
    • Updated documentation to include the new "observed-type" attribute in model information display, with examples and explanations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 25, 2025

📝 Walkthrough
## Walkthrough

Support for a new "observed-type" attribute was added to the `dp show` command, enabling detailed reporting of element types observed during model training. This includes CLI support, backend interface and PyTorch implementation, multi-task model handling, a utility to sort element types by atomic number, updated tests, and documentation enhancements.

## Changes

| File(s)                         | Change Summary                                                                                                                    |
|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| deepmd/entrypoints/show.py      | Added handling for "observed-type" attribute; logs observed element types for single- and multi-task models.                      |
| deepmd/infer/deep_eval.py       | Added abstract `get_observed_types` method to backend interface and concrete method in `DeepEval` class.                          |
| deepmd/main.py                  | Extended CLI "show" subcommand to include "observed-type" as a valid attribute choice.                                            |
| deepmd/pt/infer/deep_eval.py   | Added `no_jit` constructor parameter; implemented `get_observed_types` to identify observed element types from model buffers.    |
| deepmd/utils/econf_embd.py      | Added `sort_element_type` function to sort element symbols by atomic number.                                                      |
| deepmd/pt/model/model/ener_model.py | Added `get_observed_type_list` method to `EnergyModel` to retrieve observed element types from data statistics.                   |
| deepmd/pt/model/model/model.py | Added abstract `get_observed_type_list` method to `BaseModel`.                                                                     |
| source/tests/pt/test_dp_show.py | Updated tests to include assertions for "observed-type" output in both single- and multi-task model scenarios.                    |
| doc/model/show-model-info.md    | Updated documentation to describe the new "observed-type" attribute and provide example output.                                   |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant CLI
    participant ShowEntrypoint
    participant DeepEval
    participant Model

    User->>CLI: deepmd show model observed-type
    CLI->>ShowEntrypoint: call show("observed-type")
    ShowEntrypoint->>DeepEval: get_observed_types()
    DeepEval->>Model: Inspect model buffers for observed types
    Model-->>DeepEval: Return observed types info
    DeepEval-->>ShowEntrypoint: Return observed types dict
    ShowEntrypoint-->>CLI: Output observed types details
    CLI-->>User: Display observed types information

Suggested reviewers

  • wanghan-iapcm
  • njzjz
  • Chengqian-Zhang

</details>

<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between f87c3d35e869ad67308e1e9b5d1fa0a04aae344a and 5c7f1bf5ebf761f4857a2edc58bb9809749fbfb3.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `deepmd/pt/model/model/ener_model.py` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* deepmd/pt/model/model/ener_model.py

</details>

<details>
<summary>⏰ 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). (30)</summary>

* GitHub Check: Build wheels for cp310-manylinux_aarch64
* GitHub Check: Build wheels for cp311-win_amd64
* GitHub Check: Build wheels for cp311-manylinux_x86_64
* GitHub Check: Build wheels for cp311-manylinux_x86_64
* GitHub Check: Build wheels for cp311-macosx_arm64
* GitHub Check: Build wheels for cp311-macosx_x86_64
* GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
* GitHub Check: Build C library (2.14, >=2.5.0rc0,<2.15, libdeepmd_c_cu11.tar.gz)
* GitHub Check: Test Python (5, 3.12)
* GitHub Check: Test Python (2, 3.12)
* GitHub Check: Test Python (6, 3.12)
* GitHub Check: Test Python (5, 3.9)
* GitHub Check: Test Python (3, 3.12)
* GitHub Check: Test Python (6, 3.9)
* GitHub Check: Test Python (3, 3.9)
* GitHub Check: Test Python (4, 3.12)
* GitHub Check: Test Python (4, 3.9)
* GitHub Check: Test Python (2, 3.9)
* GitHub Check: Test Python (1, 3.9)
* GitHub Check: Test Python (1, 3.12)
* GitHub Check: Test C++ (true)
* GitHub Check: Test C++ (false)
* GitHub Check: Build C++ (clang, clang)
* GitHub Check: Build C++ (cuda120, cuda)
* GitHub Check: Build C++ (cuda, cuda)
* GitHub Check: Build C++ (rocm, rocm)
* GitHub Check: Build C++ (cpu, cpu)
* GitHub Check: Analyze (python)
* GitHub Check: Analyze (javascript-typescript)
* GitHub Check: Analyze (c-cpp)

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEejqANiS4AzEtQAU3XAEouaWvQAGgxJSm0YLiy3CRe/M7w+Fg2+Hy03JCIsPgA7gYActjMApRcACwAHABMAAwGAKp+FFzwAAoU+ABetEb6xuBQZPT4NjgExGTKNPRMrOxcvPzCouJSMvJMSlSq6lo67SZQcKiomP2EpORUIwrjGJyQVKlJ2cxoFPJyCssqapraumCGHaYGSiRuMxaAB6diPbj4eAXRAg5JpDTcWQcAwAInRBgAxJjIABBACSg2O1Dot1YD3kvUYsEwpEQZlgJGptKZHloyEQ2G4kIouEgsT4aEg5Bu1FwFHgAjwTK8qN8/joQRCJFR4WhkFwjMgXnhqXCNmwGDEUQwGkgAHVGVhNXtcOLJdKUMgKCQAI7YaQjAA0Gq1SyZFnwRGQSlw2is9GhAvu4mi6AE+DwvqZ8ooAQ1yuQvGk7BQ1q1zEUJAsZoAYnFIMxsBZxGHEABrStFiyIH3qFA0E7SfhSPj2BiwJtKCyQARUI2wH0MF0k5BCrwAERIgIAohI0BY1RhEGGjUyBb7qKPxwPIKl1CkkwApfHQM7ceAWagmn0u+0kebJ6bVdPBUKtyBA2DL8mENPlMHoCwkD5KlU1/TMeEoY9MAHH0IPQBgGGyatZ3QSBDXgd0A2g/g+g3Ec4NJP9uzQad8EQGQT0ZRAzXxPlNTIQCg2QDiNXwMMRwwbJckFDB6CFRA4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WqWvabAQW5nXnKW+mBAvbfa/m2mBn1XRwBntXGnihfaGAlXGKbBjXAX1nSg0AJmihDWBmiW2nBmVcoXCgva3XHXVALWMXfWTWGB1naA+nShRnHW1mSBrmWm+nCgMWGXig0AvbSg3W/nih7WSWBnigBBG3I2QXG2Jm7BGK0AkWnWA4Fn8hfXpnShig3WenTnznaA2nSg7nmX1mmWShFmbA+nGXG35WVXZmSAZnIWKW3XRWpWBnaBUWSBChCWPBfbBnShChzmSA2mBBrnLXtXtWVmlnjmVm3XZnjXGmaX12aWkXLXw2+m/m6AM3bm7m4Xo38giWaWBBXX2gDACmjl1AdISmynPlKnaA9IAp9AgA= -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=deepmodeling/deepmd-kit&utm_content=4820):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `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 explain this code block.`
  -	`@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 explain its main purpose.`
  - `@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.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

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 generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@github-actions github-actions bot added the Docs label Jun 25, 2025
@njzjz njzjz closed this Jun 27, 2025
@njzjz njzjz reopened this Jun 27, 2025
@codecov
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.57%. Comparing base (205f924) to head (5c7f1bf).
⚠️ Report is 87 commits behind head on devel.

Files with missing lines Patch % Lines
deepmd/utils/econf_embd.py 75.00% 2 Missing ⚠️
deepmd/infer/deep_eval.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #4820   +/-   ##
=======================================
  Coverage   84.57%   84.57%           
=======================================
  Files         699      699           
  Lines       68039    68120   +81     
  Branches     3541     3541           
=======================================
+ Hits        57542    57614   +72     
- Misses       9363     9372    +9     
  Partials     1134     1134           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

🧹 Nitpick comments (2)
doc/model/show-model-info.md (2)

20-21: Attribute list: consider alphabetical ordering + tighten wording

The new bullet is very welcome, but the list is now neither alphabetically sorted (descriptor, fitting-net, model-branch, …) nor grouped by backend support, which makes scanning harder.
While you are touching this section, consider:

-  - `observed-type`: (Supported Backends: PyTorch) Shows the type (element) coverage for this model.
+  - `observed-type`: (PyTorch only) Shows the element types observed during training.

Shorter parenthesis and moving the bullet to keep alphabetical order (descriptor, fitting-net, model-branch, observed-type, size, type-map) will improve readability.


64-69: Clarify “coverage” vs. “type-map” & fix double-space grammar glitch

  1. The previous review raised confusion around type map vs type coverage.
    Line 68 gives a note, but it still might read as “may differ” without saying why.
    A one-liner such as “Coverage reports elements actually present in the training set, whereas the type-map is the full embedding index.” would prevent recurring support questions.

  2. There is a double space before the next header (map.␠␠## Example Output) which trips spelling/grammar checkers. Remove the extra space.

-  - Note: Type coverage reflects the types observed during training data statistics, which may differ from the type map.
+  - Note: *Coverage* lists elements present in the training data, whereas *type-map* is the full embedding index; they can therefore differ.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 205a0d4 and b3a0f12.

📒 Files selected for processing (6)
  • deepmd/entrypoints/show.py (2 hunks)
  • deepmd/infer/deep_eval.py (2 hunks)
  • deepmd/main.py (1 hunks)
  • deepmd/pt/infer/deep_eval.py (4 hunks)
  • doc/model/show-model-info.md (3 hunks)
  • source/tests/pt/test_dp_show.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • deepmd/main.py
  • deepmd/infer/deep_eval.py
  • deepmd/entrypoints/show.py
  • deepmd/pt/infer/deep_eval.py
  • source/tests/pt/test_dp_show.py
🧰 Additional context used
🪛 LanguageTool
doc/model/show-model-info.md

[grammar] ~20-~20: Use correct spacing
Context: ...ws the type (element) coverage for this model. ## Example Usage ```bash # For a multi-ta...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~68-~68: Use correct spacing
Context: ...tistics, which may differ from the type map. ## Example Output For a singletask model,...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

⏰ 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: Test Python (6, 3.12)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build C library (2.14, >=2.5.0rc0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
🔇 Additional comments (1)
doc/model/show-model-info.md (1)

83-85: Example output: keep order consistent with bullet description

In the earlier bullet list you present number then list; the example output shows them reversed (Number after the header line). For quick copy-paste comparison and to reduce cognitive load, swap to match the documented order or update the bullet list accordingly.

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

🧹 Nitpick comments (2)
doc/model/show-model-info.md (2)

64-69: Tighten wording & fix double-space artefacts

Minor copy-editing for clarity and to silence grammar linters.

-**observed-type**
+**type-coverage**

-  - Displays the count and list of element types of the model during data statistics.
+  - Displays the number and list of element types observed in the training data.

-  - Note: This info shows the types observed during training data statistics, which may differ from the type map.
+  - Note: Coverage is computed from training-data statistics and may therefore differ from the static type map.

83-85: Example output may confuse readers

The example shows type_map = ['O', 'H', 'Au'] but the observed set lists only ['H', 'O'].
Consider adding a one-line explanation right after the example to stress that elements absent from the training data (here: Au) are intentionally missing from the coverage list.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3a0f12 and 16bb461.

📒 Files selected for processing (3)
  • deepmd/infer/deep_eval.py (2 hunks)
  • deepmd/pt/infer/deep_eval.py (4 hunks)
  • doc/model/show-model-info.md (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • deepmd/infer/deep_eval.py
  • deepmd/pt/infer/deep_eval.py
🧰 Additional context used
🪛 LanguageTool
doc/model/show-model-info.md

[grammar] ~20-~20: Use correct spacing
Context: ...pes (elements) of the model during data statistics. ## Example Usage ```bash # For a multi-ta...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~68-~68: Use correct spacing
Context: ...tistics, which may differ from the type map. ## Example Output For a singletask model,...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

⏰ 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). (30)
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Build C library (2.14, >=2.5.0rc0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (cpu, cpu)

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

♻️ Duplicate comments (1)
doc/model/show-model-info.md (1)

20-21: Attribute name still conflicts with PR title & commit message

The docs keep observed-type, while the PR title / description say type-coverage. This mismatch has already been raised and is still unresolved – please settle on one spelling and align code, docs, tests, and commit messages accordingly.

🧹 Nitpick comments (1)
doc/model/show-model-info.md (1)

64-69: Minor phrasing / style nitpick for “observed-type” section

Shorten the wording and avoid the repeated “data statistics” phrase.

-  - Displays the count and list of observed element types of the model during data statistics.
+  - Displays the count and list of element types observed during training-data statistics.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16bb461 and a227b40.

📒 Files selected for processing (1)
  • doc/model/show-model-info.md (3 hunks)
🧰 Additional context used
🪛 LanguageTool
doc/model/show-model-info.md

[grammar] ~20-~20: Use correct spacing
Context: ...pes (elements) of the model during data statistics. ## Example Usage ```bash # For a multi-ta...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~68-~68: Use correct spacing
Context: ...tistics, which may differ from the type map. ## Example Output For a singletask model,...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

⏰ 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). (31)
  • GitHub Check: CodeQL
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
  • 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: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build C library (2.14, >=2.5.0rc0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (rocm, rocm)

@iProzd iProzd changed the title feat(pt): add type-coverage option for dp show feat(pt): add observed-types option for dp show Jul 9, 2025
@iProzd iProzd changed the title feat(pt): add observed-types option for dp show feat(pt): add observed-type option for dp show Jul 9, 2025
@iProzd iProzd requested review from Chengqian-Zhang and njzjz July 9, 2025 12:10
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

🧹 Nitpick comments (2)
doc/model/show-model-info.md (2)

20-21: Fix spacing issue after period.

Static analysis flagged a spacing issue that should be corrected for consistency.

-  - `observed-type`: (Supported Backends: PyTorch) Shows the observed types (elements) of the model during data statistics. Only energy models are supported now.
+  - `observed-type`: (Supported Backends: PyTorch) Shows the observed types (elements) of the model during data statistics. Only energy models are supported now.

64-69: Fix spacing issue and approve documentation.

The documentation clearly explains the new feature. There's a minor spacing issue that should be corrected.

-  - Note: This info shows the types observed during training data statistics, which may differ from the type map.
+  - Note: This info shows the types observed during training data statistics, which may differ from the type map.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a227b40 and 6077e1d.

📒 Files selected for processing (4)
  • deepmd/pt/infer/deep_eval.py (4 hunks)
  • deepmd/pt/model/model/ener_model.py (1 hunks)
  • deepmd/pt/model/model/model.py (1 hunks)
  • doc/model/show-model-info.md (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • deepmd/pt/infer/deep_eval.py
🧰 Additional context used
🧠 Learnings (1)
deepmd/pt/model/model/model.py (2)
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4002
File: deepmd/dpmodel/model/model.py:106-106
Timestamp: 2024-10-08T15:32:11.479Z
Learning: The `get_class_by_type` method in `deepmd/utils/plugin.py` includes error handling for unsupported model types by raising a `RuntimeError` and providing a "Did you mean" message if there are close matches.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4002
File: deepmd/dpmodel/model/model.py:106-106
Timestamp: 2024-07-22T21:18:12.787Z
Learning: The `get_class_by_type` method in `deepmd/utils/plugin.py` includes error handling for unsupported model types by raising a `RuntimeError` and providing a "Did you mean" message if there are close matches.
🧬 Code Graph Analysis (2)
deepmd/pt/model/model/model.py (1)
deepmd/pt/model/model/ener_model.py (1)
  • get_observed_type_list (48-71)
deepmd/pt/model/model/ener_model.py (4)
deepmd/pt/model/model/model.py (1)
  • get_observed_type_list (52-59)
deepmd/pt/model/atomic_model/base_atomic_model.py (1)
  • get_type_map (126-128)
deepmd/pt/model/model/make_model.py (2)
  • get_type_map (554-556)
  • get_out_bias (201-202)
deepmd/pt/model/atomic_model/dp_atomic_model.py (1)
  • get_out_bias (260-261)
🪛 LanguageTool
doc/model/show-model-info.md

[grammar] ~20-~20: Use correct spacing
Context: ...stics. Only energy models are supported now. ## Example Usage ```bash # For a multi-ta...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~68-~68: Use correct spacing
Context: ...tistics, which may differ from the type map. ## Example Output For a singletask model,...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

⏰ 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: Test Python (5, 3.12)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Analyze (python)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Build C library (2.14, >=2.5.0rc0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (cuda120, cuda)
🔇 Additional comments (5)
deepmd/pt/model/model/model.py (1)

51-59: LGTM! Abstract method properly defined.

The abstract method is correctly implemented with appropriate @torch.jit.export decorator, clear docstring, and proper NotImplementedError for subclasses to override.

doc/model/show-model-info.md (1)

83-86: Well-documented example output.

The example output clearly demonstrates how the observed types information is presented to users.

deepmd/pt/model/model/ener_model.py (3)

58-62: Proper validation with clear error messages.

The assertions provide good validation with descriptive error messages that will help developers debug issues.


63-65: Appropriate threshold for numerical stability.

The 1e-6 threshold is a reasonable choice for determining significant bias values while maintaining numerical stability.


47-71: Confirmed: get_out_bias()[0] correctly extracts the first bias slice

I checked the implementation of get_out_bias and its initialization in BaseAtomicModel.init_out_stat. It registers out_bias with shape (n_out, ntypes, odims), so indexing [0] yields a 2D tensor of shape (ntypes, odims) as expected. No changes needed.

iProzd and others added 2 commits July 10, 2025 16:12
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Duo <50307526+iProzd@users.noreply.github.com>
@iProzd iProzd added this pull request to the merge queue Jul 11, 2025
Merged via the queue into deepmodeling:devel with commit 4ad67d5 Jul 11, 2025
60 checks passed
@iProzd iProzd deleted the D0624_show_type branch July 11, 2025 09:06
ChiahsinChu pushed a commit to ChiahsinChu/deepmd-kit that referenced this pull request Dec 17, 2025
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added support for displaying "observed-type" information in the model
reporting tool, showing element types observed during training for
single-task and multi-task models.
- **Tests**
- Updated tests to verify correct reporting of observed types for both
single-task and multi-task models.
- **Documentation**
- Updated documentation to include the new "observed-type" attribute in
model information display, with examples and explanations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Duo <50307526+iProzd@users.noreply.github.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants