Skip to content

uncouple model precision and interface precision#2031

Merged
wanghan-iapcm merged 8 commits into
deepmodeling:develfrom
njzjz:model_type
Oct 30, 2022
Merged

uncouple model precision and interface precision#2031
wanghan-iapcm merged 8 commits into
deepmodeling:develfrom
njzjz:model_type

Conversation

@njzjz

@njzjz njzjz commented Oct 28, 2022

Copy link
Copy Markdown
Member

This commit allows loading float models using the double interface, or the other way around.
The model precision is perceived from the type of descrpt_attr/rcut. All run_model and session_input_tensors are rewritten as templates.
This is an essential step of #1948. Next, functions in the whole module can be migrated to templates.

This commit allows loading float models using double interface, or the other way around.
The model precision is perceived from the type of `descrpt_attr/rcut`. All `run_model` and `session_input_tensors` are rewritten as templates.
This is an important step of deepmodeling#1948. Next functions in the whole module can be migrated to templates.
@github-actions github-actions Bot added the C++ label Oct 28, 2022
@codecov-commenter

codecov-commenter commented Oct 28, 2022

Copy link
Copy Markdown

Codecov Report

Base: 73.85% // Head: 73.86% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (680f2ab) compared to base (4f10296).
Patch coverage: 69.69% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #2031   +/-   ##
=======================================
  Coverage   73.85%   73.86%           
=======================================
  Files         198      198           
  Lines       19908    19934   +26     
  Branches      865      865           
=======================================
+ Hits        14704    14724   +20     
- Misses       4813     4818    +5     
- Partials      391      392    +1     
Impacted Files Coverage Δ
source/api_cc/include/DeepPot.h 100.00% <ø> (ø)
source/api_cc/include/DeepTensor.h 20.00% <ø> (ø)
source/api_cc/include/common.h 0.00% <ø> (ø)
source/api_cc/src/DeepTensor.cc 79.58% <60.60%> (-0.42%) ⬇️
source/api_cc/src/DeepPot.cc 68.53% <64.58%> (+0.21%) ⬆️
source/api_cc/src/DataModifier.cc 79.87% <68.18%> (+0.65%) ⬆️
source/api_cc/src/common.cc 86.70% <89.65%> (+1.23%) ⬆️
source/lib/include/ComputeDescriptor.h 11.49% <0.00%> (-0.22%) ⬇️
deepmd/entrypoints/test.py 11.11% <0.00%> (-0.21%) ⬇️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@njzjz njzjz marked this pull request as ready for review October 28, 2022 06:51
@njzjz njzjz requested a review from wanghan-iapcm October 28, 2022 07:07
Comment thread source/api_cc/src/DataModifier.cc Outdated

@wanghan-iapcm wanghan-iapcm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR is great.

I have a question regarding the coverage of the UTs.
Ideally we should test all the four cases:
case 0: model_type == double interface_type == double
case 1: model_type == double interface_type == float
case 2: model_type == float interface_type == double
case 3: model_type == float interface_type == float
Do we currently only cover case 0? In this pr we may at least provide tests for the case 1

Comment thread source/api_cc/src/DeepPot.cc Outdated
Comment thread source/api_cc/src/DeepPot.cc Outdated
@njzjz

njzjz commented Oct 29, 2022

Copy link
Copy Markdown
Member Author

I added case 1. I found the accuracy of the float interface is not very high.

@wanghan-iapcm

Copy link
Copy Markdown
Collaborator

I added case 1. I found the accuracy of the float interface is not very high.

The precision (an epsilon of 1e-4 ) is expected.

@wanghan-iapcm wanghan-iapcm merged commit 1cded8e into deepmodeling:devel Oct 30, 2022
mingzhong15 pushed a commit to mingzhong15/deepmd-kit that referenced this pull request Jan 15, 2023
This commit allows loading float models using the double interface, or
the other way around.
The model precision is perceived from the type of `descrpt_attr/rcut`.
All `run_model` and `session_input_tensors` are rewritten as templates.
This is an essential step of deepmodeling#1948. Next, functions in the whole module
can be migrated to templates.
@njzjz njzjz deleted the model_type branch February 10, 2023 03:31
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.

3 participants