Skip to content

compute output stat for atomic model#3642

Merged
wanghan-iapcm merged 13 commits intodeepmodeling:develfrom
wanghan-iapcm:atom-output-stat-1
Apr 7, 2024
Merged

compute output stat for atomic model#3642
wanghan-iapcm merged 13 commits intodeepmodeling:develfrom
wanghan-iapcm:atom-output-stat-1

Conversation

@wanghan-iapcm
Copy link
Copy Markdown
Collaborator

@wanghan-iapcm wanghan-iapcm commented Apr 4, 2024

This PR:

  • breaking change: the base atomic model is now a module.
    • reason: the out stat is a data attribute of the base atomic model.
  • implement the compute_or_load_output_stat for the base atomic model. the method computes both bias and std.
  • the derived atomic models call the compute_or_load_output_stat method for computing output stat.
  • atomic model provides the apply_out_stat, the derived class may override the method to define how the statistics is applied to an atomic model's output. @anyangml may need.
  • out_stat support statistics of output tensor of any shape.

@iProzd please check if i took it correctly in ce7ec1f

To be done:

  • atomic statistics of the bias and std. @anyangml
  • erialization and deserialization.


def setUp(self):
TestCaseSingleFrameWithNlist.setUp(self)
nf, nloc, nnei = self.nlist.shape

Check notice

Code scanning / CodeQL

Unused local variable

Variable nf is not used.

def setUp(self):
TestCaseSingleFrameWithNlist.setUp(self)
nf, nloc, nnei = self.nlist.shape

Check notice

Code scanning / CodeQL

Unused local variable

Variable nloc is not used.

def setUp(self):
TestCaseSingleFrameWithNlist.setUp(self)
nf, nloc, nnei = self.nlist.shape

Check notice

Code scanning / CodeQL

Unused local variable

Variable nnei is not used.
pair_exclude_types: List[Tuple[int, int]] = [],
):
super().__init__()
self.type_map = type_map

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class

Assignment overwrites attribute type_map, which was previously defined in subclass [DPAtomicModel](1). Assignment overwrites attribute type_map, which was previously defined in subclass [DPAtomicModel](2). Assignment overwrites attribute type_map, which was previously defined in subclass [LinearEnergyAtomicModel](3).
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 95.09202% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 81.80%. Comparing base (073f559) to head (2171e19).
Report is 2 commits behind head on devel.

Files Patch % Lines
deepmd/pt/model/atomic_model/base_atomic_model.py 92.59% 6 Missing ⚠️
deepmd/pt/utils/stat.py 96.22% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3642      +/-   ##
==========================================
+ Coverage   81.72%   81.80%   +0.07%     
==========================================
  Files         503      503              
  Lines       46007    46445     +438     
  Branches     2891     2952      +61     
==========================================
+ Hits        37601    37993     +392     
- Misses       7528     7559      +31     
- Partials      878      893      +15     

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

@njzjz njzjz linked an issue Apr 6, 2024 that may be closed by this pull request
Comment thread deepmd/pt/model/atomic_model/base_atomic_model.py
Comment thread source/tests/pt/test_multitask.py Outdated
wanghan-iapcm and others added 3 commits April 7, 2024 00:10
Co-authored-by: Duo <50307526+iProzd@users.noreply.github.com>
Signed-off-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
@wanghan-iapcm wanghan-iapcm requested a review from iProzd April 6, 2024 16:12
@wanghan-iapcm wanghan-iapcm enabled auto-merge April 6, 2024 16:15
@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Apr 6, 2024
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 6, 2024
@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Apr 7, 2024
Merged via the queue into deepmodeling:devel with commit 39d027e Apr 7, 2024
@wanghan-iapcm wanghan-iapcm deleted the atom-output-stat-1 branch April 7, 2024 02:29
atom_exclude_types: List[int] = [],
pair_exclude_types: List[Tuple[int, int]] = [],
rcond: Optional[float] = None,
preset_out_bias: Optional[Dict[str, torch.Tensor]] = None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

line 74 is different from line 60

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

[Feature Request] Move the model output bias to atomic model

5 participants