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

compute output stat for atomic model #3642

Merged
merged 13 commits into from
Apr 7, 2024

Conversation

wanghan-iapcm
Copy link
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 Note test

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 Note test

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 Note test

Variable nnei is not used.
atom_exclude_types: List[int] = [],
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 Warning

Assignment overwrites attribute type_map, which was previously defined in subclass
DPAtomicModel
.
Assignment overwrites attribute type_map, which was previously defined in subclass
DPAtomicModel
.
Assignment overwrites attribute type_map, which was previously defined in subclass
LinearEnergyAtomicModel
.
Copy link

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
source/tests/pt/test_multitask.py Outdated Show resolved Hide resolved
@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
48 checks passed
@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
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
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
4 participants