Skip to content
Open
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1896d9a
support init_frz_model in nvnmd_train
jiongwalai Apr 16, 2025
64e0feb
support for setting random seed of descriptor and fitting_net in nvnm…
jiongwalai Apr 16, 2025
24fcdb2
improve accuracy in nvnmd-v1; support vu13p device
jiongwalai Apr 21, 2025
0df4e9c
Merge branch 'deepmodeling:devel' into devel
jiongwalai Apr 21, 2025
34cfbdb
initial nvnmd
jiongwalai Apr 21, 2025
6d02bc2
Merge branch 'devel' of https://github.com/jiongwalai/deepmd-kit into…
jiongwalai Apr 21, 2025
60b57f7
change mode for v1 in nvnmd
qo0Alex0op May 27, 2025
31d1b4c
delete self.use_tebd in nvnmd v0
qo0Alex0op May 27, 2025
77d561c
test code modified in nvnmd
qo0Alex0op Jun 6, 2025
51cb3e3
test code modified in nvnmd
qo0Alex0op Jun 6, 2025
f54e5d6
final submit in test code of nvnmd
qo0Alex0op Jun 6, 2025
f0e231e
remove debug file and code
Jun 10, 2025
ae7e466
update test env
Jun 10, 2025
1ecf90a
Merge pull request #3 from jiongwalai/nvnmd_0611
jiongwalai Jun 11, 2025
065ed29
update encode.py
jiongwalai Jun 11, 2025
0e723bb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 11, 2025
dab9a2b
update code
Jun 11, 2025
e39c09e
Merge pull request #4 from jiongwalai/nvnmd_0612
jiongwalai Jun 12, 2025
6194477
Merge branch 'devel' into devel
jiongwalai Jun 13, 2025
c2d130a
fix pre-commit isue and train bug
qo0Alex0op Jun 26, 2025
5e93e03
fix(CI): clean up mpi4py index
njzjz Jun 26, 2025
70e2de5
install mpich
njzjz Jun 26, 2025
4f9dd29
fix LD_LIBRARY_PATH
njzjz Jun 26, 2025
f09406d
Merge branch 'deepmodeling:devel' into devel
jiongwalai Jun 27, 2025
0e05100
fix(CI): clean up mpi4py index
jiongwalai Jun 27, 2025
0c74386
fix(CI): remove ld in test_cc and update cibuildwheel
jiongwalai Jun 27, 2025
e659acf
Merge remote-tracking branch 'njzjz/cleanup-mpi4py-index' into devel_…
jiongwalai Jun 27, 2025
4bcec13
Merge remote-tracking branch 'deepmodeling/devel' into devel_0627
jiongwalai Jun 28, 2025
94054b2
Merge branch 'devel_0627' into devel
jiongwalai Jun 28, 2025
64d4c74
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 28, 2025
3c1236f
data type add for numpy
qo0Alex0op Jun 30, 2025
142bffb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 1, 2025
308952e
divide map file to parts
qo0Alex0op Jul 1, 2025
3be6dd2
test for fixing bug
qo0Alex0op Jul 1, 2025
3e198f2
global precision for nvnmd
qo0Alex0op Jul 2, 2025
048612e
Merge branch 'devel_0630' into devel
jiongwalai Jul 3, 2025
8215320
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 3, 2025
0f0575a
cancel tf warnings
qo0Alex0op Jul 4, 2025
cd27da9
Merge branch 'devel_0630' into devel
jiongwalai Jul 4, 2025
d6a1fe9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 4, 2025
51d6a92
point dtype for tf
qo0Alex0op Jul 4, 2025
bce8b7a
Merge branch 'devel_0630' into devel
jiongwalai Jul 4, 2025
8fdbee8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 4, 2025
0a30b57
fix tf dtype isue
qo0Alex0op Jul 4, 2025
453e1eb
Merge branch 'devel_0630' into devel
jiongwalai Jul 4, 2025
9a08ab7
Merge branch 'devel' of https://github.com/jiongwalai/deepmd-kit into…
jiongwalai Jul 4, 2025
9dfb1fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 4, 2025
e20b2d4
remove GLOBAL_TF_FLOAT_PRECISION
jiongwalai Jul 4, 2025
9e0e6a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 4, 2025
5584209
Merge branch 'devel' into devel
jiongwalai Jul 5, 2025
9f13087
Merge branch 'devel' into devel
jiongwalai Jul 17, 2025
fe86ad6
Update data.py
jiongwalai Jul 22, 2025
40691e3
Update data.py
jiongwalai Jul 22, 2025
f201af8
Merge branch 'devel' into devel
jiongwalai Jul 22, 2025
267bbbe
Merge branch 'deepmodeling:devel' into devel
jiongwalai Aug 14, 2025
559ef12
Merge branch 'devel' into devel
jiongwalai Aug 28, 2025
61e7f63
Merge branch 'deepmodeling:devel' into devel
jiongwalai Aug 31, 2025
0ffdb5c
Merge branch 'deepmodeling:devel' into devel
jiongwalai Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deepmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,13 @@ def main_parser() -> argparse.ArgumentParser:
default=None,
help="Restart the training from the provided prefix of checkpoint files.",
)
parser_train_nvnmd.add_argument(
"-f",
"--init-frz-model",
type=str,
default=None,
help="Initialize the training from the frozen model.",
)
parser_train_nvnmd.add_argument(
"-s",
"--step",
Expand Down
20 changes: 17 additions & 3 deletions deepmd/tf/descriptor/se_atten.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
from deepmd.tf.nvnmd.descriptor.se_atten import (
build_davg_dstd,
build_op_descriptor,
build_recovered,
check_switch_range,
descrpt2r4,
filter_GR2D,
filter_lower_R42GR,
)
Expand Down Expand Up @@ -715,6 +715,20 @@ def _pass_filter(
inputs_i = inputs
inputs_i = tf.reshape(inputs_i, [-1, self.ndescrpt])
type_i = -1

# descrpt and recovered_switch for nvnmd
if nvnmd_cfg.enable and nvnmd_cfg.quantize_descriptor:
inputs_i, self.recovered_switch = build_recovered(
inputs_i,
self.t_avg,
self.t_std,
self.atype_nloc,
natoms[0],
self.ntypes,
self.rcut_r_smth,
self.filter_precision,
)

if len(self.exclude_types):
mask = self.build_type_exclude_mask_mixed(
self.exclude_types,
Expand Down Expand Up @@ -753,8 +767,7 @@ def _pass_filter(
)
self.negative_mask = -(2 << 32) * (1.0 - self.nmask)
inputs_i *= mask
if nvnmd_cfg.enable and nvnmd_cfg.quantize_descriptor:
inputs_i = descrpt2r4(inputs_i, atype)

layer, qmat = self._filter(
inputs_i,
type_i,
Expand Down Expand Up @@ -1162,6 +1175,7 @@ def _filter_lower(
inputs_i,
atype,
self.nei_type_vec,
self.recovered_switch,
)
elif nvnmd_cfg.restore_descriptor:
self.embedding_net_variables = (
Expand Down
47 changes: 30 additions & 17 deletions deepmd/tf/nvnmd/data/data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import copy

# SPDX-License-Identifier: LGPL-3.0-or-later
jdata_sys = {"debug": False}

Expand All @@ -10,6 +12,7 @@
"neuron": [8, 16, 32],
"resnet_dt": False,
"axis_neuron": 4,
"seed": 1,
"type_one_side": True,
# rcut range
"rc_lim": 0.5,
Expand Down Expand Up @@ -39,6 +42,7 @@
# basic config from deepmd model
"neuron": [128, 128, 128],
"resnet_dt": False,
"seed": 1,
"NNODE_FITS": "(M1*M2, neuron, 1)",
"nlayer_fit": "len(neuron)+1",
"NLAYER": "nlayer_fit",
Expand Down Expand Up @@ -118,9 +122,9 @@
"end": "",
}

# change the configuration according to the max_nnei
jdata_config_v0_ni128 = jdata_config_v0.copy()
jdata_config_v0_ni256 = jdata_config_v0.copy()
# change the configuration accordng to the max_nnei
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be some meaningless changes like this

Copy link
Author

Choose a reason for hiding this comment

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

There may be differences between the parameters jdata_config_v0_ni128 and jdata_config_v0_ni256, which are used for different training configurations. I think they should be retained.

Copy link
Member

Choose a reason for hiding this comment

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

Why did you change according to accordng?

jdata_config_v0_ni128 = copy.deepcopy(jdata_config_v0)
jdata_config_v0_ni256 = copy.deepcopy(jdata_config_v0)
jdata_config_v0_ni256["ctrl"] = {
"MAX_NNEI": 256,
"NSTDM": 128,
Expand All @@ -142,6 +146,7 @@
"rcut_smth": 0.5,
"neuron": [8, 16, 32],
"resnet_dt": False,
"seed": 1,
"axis_neuron": 4,
"type_one_side": True,
# rcut range
Expand All @@ -150,6 +155,7 @@
# embedding net size
"M1": "neuron[-1]",
"M2": "axis_neuron",
"M3": 2,
"SEL": 128,
"NNODE_FEAS": "(1, neuron)",
"nlayer_fea": "len(neuron)",
Expand All @@ -170,6 +176,7 @@
# basic config from deepmd model
"neuron": [128, 128, 128],
"resnet_dt": False,
"seed": 1,
"NNODE_FITS": "(M1*M2, neuron, 1)",
"nlayer_fit": "len(neuron)+1",
"NLAYER": "nlayer_fit",
Expand Down Expand Up @@ -200,7 +207,7 @@
"NSEL": "NSTDM",
"NSADV": "NSTDM+1",
"VERSION": 1,
"SUB_VERSION": 1,
"SUB_VERSION": 2,
},
"nbit": {
# general
Expand Down Expand Up @@ -243,26 +250,27 @@
"NBIT_CFG": 64,
"NBIT_NET": 72,
"NBIT_MODEL_HEAD": 32,
"NBIT_NSTEP": 8,
# nbit for mapt-version
"NBIT_IDX_S2G": 9,
"NBIT_NEIB": 8,
},
"end": "",
}

# change the configuration according to the max_nnei
jdata_config_v1_ni128 = jdata_config_v1.copy()
jdata_config_v1_ni256 = jdata_config_v1.copy()
# change the configuration accordng to the max_nnei
jdata_config_v1_ni128 = copy.deepcopy(jdata_config_v1)
jdata_config_v1_ni256 = copy.deepcopy(jdata_config_v1)
jdata_config_v1_ni256["ctrl"] = {
"MAX_NNEI": 256,
"NSTDM": 128,
"NSTDM": 64,
"NSTDM_M1": 32,
"NSTDM_M2": 4,
"NSTDM_M2": 2,
"NSTDM_M1X": 8,
"NSEL": "NSTDM",
"NSADV": "NSTDM+1",
"VERSION": 1,
"SUB_VERSION": 1,
"SUB_VERSION": 2,
}
jdata_config_v1_ni256["nbit"]["NBIT_NEIB"] = 9

Expand All @@ -283,6 +291,7 @@
},
"nvnmd": {
"version": 0,
"device": "vu9p",
"max_nnei": 128, # 128 or 256
"net_size": 128,
"config_file": "none",
Expand Down Expand Up @@ -319,20 +328,22 @@
"disp_training": True,
"time_training": True,
"profiling": False,
"training_data": {"systems": "dataset", "batch_size": 1},
"training_data": {"systems": "dataset", "set_prefix": "set", "batch_size": 1},
},
}

jdata_deepmd_input_v0_ni128 = jdata_deepmd_input_v0.copy()
jdata_deepmd_input_v0_ni256 = jdata_deepmd_input_v0.copy()
jdata_deepmd_input_v0_ni128 = copy.deepcopy(jdata_deepmd_input_v0)
jdata_deepmd_input_v0_ni256 = copy.deepcopy(jdata_deepmd_input_v0)
jdata_deepmd_input_v0_ni256["nvnmd"]["max_nnei"] = 256

jdata_deepmd_input_v1 = {
"model": {
"descriptor": {
"seed": 1,
"type": "se_atten",
"tebd_input_mode": "strip",
"stripped_type_embedding": True,
"smooth_type_embdding": True,
"set_davg_zero": False,
"sel": 128,
"rcut": 7.0,
"rcut_smth": 0.5,
Expand All @@ -349,6 +360,7 @@
},
"nvnmd": {
"version": 1,
"device": "vu9p",
"max_nnei": 128, # 128 or 256
"net_size": 128,
"config_file": "none",
Expand Down Expand Up @@ -385,14 +397,15 @@
"disp_training": True,
"time_training": True,
"profiling": False,
"training_data": {"systems": "dataset", "batch_size": 1},
"training_data": {"systems": "dataset", "set_prefix": "set", "batch_size": 1},
},
}

jdata_deepmd_input_v1_ni128 = jdata_deepmd_input_v1.copy()
jdata_deepmd_input_v1_ni256 = jdata_deepmd_input_v1.copy()
jdata_deepmd_input_v1_ni128 = copy.deepcopy(jdata_deepmd_input_v1)
jdata_deepmd_input_v1_ni256 = copy.deepcopy(jdata_deepmd_input_v1)
jdata_deepmd_input_v1_ni256["nvnmd"]["max_nnei"] = 256


NVNMD_WELCOME = (
r" _ _ __ __ _ _ __ __ ____ ",
r"| \ | | \ \ / / | \ | | | \/ | | _ \ ",
Expand Down
Loading