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

nvnmd #1707

Merged
merged 23 commits into from
Jun 28, 2022
Merged

nvnmd #1707

merged 23 commits into from
Jun 28, 2022

Conversation

LiuGroupHNU
Copy link
Collaborator

Our training procedure consists of not only the continuous neural network (CNN) training, but also the quantized neural network (QNN) training which uses the results of CNN as inputs, to help users train machine-learning models that are compatible with the unique non von Neumann computer.

LiuGroupHNU added 3 commits May 13, 2022 19:40
@codecov-commenter
Copy link

codecov-commenter commented May 13, 2022

Codecov Report

Merging #1707 (019c325) into devel (40ef0e0) will increase coverage by 1.01%.
The diff coverage is 82.59%.

@@            Coverage Diff             @@
##            devel    #1707      +/-   ##
==========================================
+ Coverage   76.08%   77.10%   +1.01%     
==========================================
  Files          96      118      +22     
  Lines        7927     9411    +1484     
==========================================
+ Hits         6031     7256    +1225     
- Misses       1896     2155     +259     
Impacted Files Coverage Δ
source/op/_tanh4_nvnmd_grad.py 21.73% <21.73%> (ø)
source/op/_map_nvnmd_grad.py 23.80% <23.80%> (ø)
source/op/_tanh2_nvnmd_grad.py 23.80% <23.80%> (ø)
source/op/_matmul_nvnmd_grad.py 35.71% <35.71%> (ø)
source/op/_quantize_nvnmd_grad.py 45.45% <45.45%> (ø)
deepmd/nvnmd/entrypoints/train.py 53.33% <53.33%> (ø)
deepmd/utils/argcheck.py 89.52% <60.00%> (-0.51%) ⬇️
deepmd/entrypoints/freeze.py 72.83% <66.66%> (-0.24%) ⬇️
deepmd/nvnmd/utils/fio.py 71.11% <71.11%> (ø)
deepmd/entrypoints/main.py 86.95% <71.42%> (-1.01%) ⬇️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 40ef0e0...019c325. Read the comment docs.

Copy link
Member

@njzjz njzjz left a comment

Choose a reason for hiding this comment

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

Before further review, I have the following general comments:
(1) Translate all Chinese comments into English;
(2) Format codes under deepmd/nvnmd with pep8;
(3) Add doc to each new class and methods to explain the role of them;
(4) Reduce data in the examples diretory. As an example, one data set is enough.
(5) Add unit tests for new codes;
(6) Use os.path.join to combine paths instead of /.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
deepmd/__init__.py Outdated Show resolved Hide resolved
examples/nvnmd/data/GeTe/data.037/energy.raw Outdated Show resolved Hide resolved
deepmd/entrypoints/freeze.py Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/format_string.py Outdated Show resolved Hide resolved
examples/nvnmd/data/GeTe/data-train-gete/raw_to_set.sh Outdated Show resolved Hide resolved
source/op/env_mat_nvnmd.cc Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/atoms.py Outdated Show resolved Hide resolved
source/op/tanh2_nvnmd.cc Outdated Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
deepmd/train/trainer.py Outdated Show resolved Hide resolved
source/op/env_mat_nvnmd.cc Outdated Show resolved Hide resolved
LiuGroupHNU added 2 commits May 14, 2022 22:22
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
source/op/prod_env_mat_multi_device_nvnmd.cc Outdated Show resolved Hide resolved
deepmd/nvnmd/entrypoints/map.py Outdated Show resolved Hide resolved
deepmd/nvnmd/entrypoints/map.py Outdated Show resolved Hide resolved
deepmd/nvnmd/entrypoints/freeze.py Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/fio.py Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/fio.py Outdated Show resolved Hide resolved
deepmd/nvnmd/entrypoints/train.py Outdated Show resolved Hide resolved
deepmd/nvnmd/entrypoints/train.py Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/network.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@wanghan-iapcm wanghan-iapcm left a comment

Choose a reason for hiding this comment

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

I notice that all examples are removed. What is the reason?
Please follow @njzjz 's comment :
(4) Reduce data in the examples diretory. As an example, one data set is enough.

deepmd/fit/ener.py Outdated Show resolved Hide resolved
deepmd/nvnmd/entrypoints/freeze.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@wanghan-iapcm wanghan-iapcm left a comment

Choose a reason for hiding this comment

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

All C++ code implementing an OP (can be tested without TF C++ interface), should be moved from source/op to source/lib/src.
UTs of the OP implementation should be added.

deepmd/nvnmd/utils/fio.py Outdated Show resolved Hide resolved
@njzjz

This comment was marked as resolved.

deepmd/entrypoints/freeze.py Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
source/op/map_nvnmd.cc Outdated Show resolved Hide resolved
deepmd/entrypoints/main.py Outdated Show resolved Hide resolved
doc/nvnmd/nvnmd.md Outdated Show resolved Hide resolved
@wanghan-iapcm wanghan-iapcm requested a review from njzjz May 18, 2022 01:53
@njzjz

This comment was marked as resolved.

doc/nvnmd/nvnmd.md Outdated Show resolved Hide resolved
.Input("dv: T")
.Input("grad_v: T")
.Input("grad_dv: T")
.Attr("prec: float")
Copy link
Member

Choose a reason for hiding this comment

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

Here prec is float but x may be either double or float. I think this cannot improve accuracy to double when you multiply x by prec.

source/op/matmul_nvnmd.cc Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/fio.py Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/fio.py Outdated Show resolved Hide resolved
deepmd/utils/argcheck.py Show resolved Hide resolved
self.quantize_descriptor = True
self.quantize_fitting_net = True
else:
pass
Copy link
Member

Choose a reason for hiding this comment

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

raise RuntimeError if it's not expected behavior

source/tests/test_nvnmd_op.py Show resolved Hide resolved
@njzjz

This comment was marked as resolved.

@github-actions github-actions bot added the Core label Jun 13, 2022
.github/workflows/lint_python.yml Outdated Show resolved Hide resolved
deepmd/nvnmd/data/data.py Show resolved Hide resolved
doc/nvnmd/nvnmd.md Outdated Show resolved Hide resolved
deepmd/nvnmd/utils/argcheck.py Show resolved Hide resolved
deepmd/nvnmd/entrypoints/mapt.py Outdated Show resolved Hide resolved
log = logging.getLogger(__name__)


class Encode():
Copy link
Member

Choose a reason for hiding this comment

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

A lot of codes don't have the unit test, for example this class. See details of converge:

https://app.codecov.io/gh/deepmodeling/deepmd-kit/compare/1707/tree/deepmd/nvnmd

@njzjz njzjz requested a review from wanghan-iapcm June 14, 2022 20:14
@LiuGroupHNU LiuGroupHNU requested a review from njzjz June 15, 2022 01:25
@njzjz
Copy link
Member

njzjz commented Jun 20, 2022

Code quality is acceptable. ping @wanghan-iapcm for more comments

@LiuGroupHNU LiuGroupHNU requested review from njzjz June 20, 2022 11:02
Copy link
Collaborator

@wanghan-iapcm wanghan-iapcm left a comment

Choose a reason for hiding this comment

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

The size of the data files coord.npy and force.npy are 1M. Could you please reduce the number of frames to make the files as small as possible? I would say 0.1M would be ideal. They present only for the purpose of showing the code is working.



def descrpt2r4(inputs, natoms):
""" replace :math:`r_{ji} \rightarrow r'_{ji}`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
""" replace :math:`r_{ji} \rightarrow r'_{ji}`
r""" replace :math:`r_{ji} \rightarrow r'_{ji}`

otherwise \r will be recognized as the line separator.

Copy link
Collaborator

@wanghan-iapcm wanghan-iapcm left a comment

Choose a reason for hiding this comment

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

LGTM

@wanghan-iapcm wanghan-iapcm merged commit 32967cf into deepmodeling:devel Jun 28, 2022
mingzhong15 pushed a commit to mingzhong15/deepmd-kit that referenced this pull request Jan 15, 2023
Co-authored-by: LiuGroupHNU <liujie123@HNU>
Co-authored-by: MoPinghui <mopinghui1020@gmail.com>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@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.

5 participants