Skip to content

Commit b9bd9ed

Browse files
committed
Add input_torch_with_alias.json and update tests
Added a new example input file with model branch aliases for the water multi-task PyTorch example. Updated test_examples.py to include the new input file in multi-task input tests. Also fixed observed_type output in show.py to use the unsorted list.
1 parent e542798 commit b9bd9ed

3 files changed

Lines changed: 150 additions & 1 deletion

File tree

deepmd/entrypoints/show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def show(
9999
]
100100
observed_types = {
101101
"type_num": len(observed_type_list),
102-
"observed_type": sort_element_type(observed_type_list),
102+
"observed_type": observed_type_list,
103103
}
104104
else:
105105
tmp_model = DeepEval(INPUT, head=branch, no_jit=True)
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"_comment": "that's all",
3+
"model": {
4+
"shared_dict": {
5+
"type_map_all": [
6+
"O",
7+
"H"
8+
],
9+
"dpa3_descriptor": {
10+
"type": "dpa3",
11+
"repflow": {
12+
"n_dim": 128,
13+
"e_dim": 64,
14+
"a_dim": 32,
15+
"nlayers": 6,
16+
"e_rcut": 6.0,
17+
"e_rcut_smth": 5.3,
18+
"e_sel": 1200,
19+
"a_rcut": 4.0,
20+
"a_rcut_smth": 3.5,
21+
"a_sel": 300,
22+
"axis_neuron": 4,
23+
"fix_stat_std": 0.3,
24+
"a_compress_rate": 1,
25+
"a_compress_e_rate": 2,
26+
"a_compress_use_split": true,
27+
"update_angle": true,
28+
"smooth_edge_update": true,
29+
"edge_init_use_dist": true,
30+
"use_dynamic_sel": true,
31+
"sel_reduce_factor": 10.0,
32+
"use_exp_switch": true,
33+
"update_style": "res_residual",
34+
"update_residual": 0.1,
35+
"update_residual_init": "const"
36+
},
37+
"activation_function": "silut:10.0",
38+
"use_tebd_bias": false,
39+
"precision": "float32",
40+
"concat_output_tebd": false
41+
},
42+
"shared_fit_with_id": {
43+
"neuron": [
44+
240,
45+
240,
46+
240
47+
],
48+
"resnet_dt": true,
49+
"seed": 1,
50+
"dim_case_embd": 2,
51+
"_comment": " that's all"
52+
},
53+
"_comment": "that's all"
54+
},
55+
"model_dict": {
56+
"water_1": {
57+
"type_map": "type_map_all",
58+
"descriptor": "dpa3_descriptor",
59+
"fitting_net": "shared_fit_with_id",
60+
"model_branch_alias": ["Default","Water"],
61+
"info": {
62+
"description": "Water model with DPA3 descriptor and shared fitting net",
63+
"observed_type": ["H", "O"]
64+
}
65+
},
66+
"water_2": {
67+
"type_map": "type_map_all",
68+
"descriptor": "dpa3_descriptor",
69+
"fitting_net": "shared_fit_with_id",
70+
"model_branch_alias": ["Water2"],
71+
"info": {
72+
"description": "Water duplicated model with DPA3 descriptor and shared fitting net",
73+
"observed_type": ["H", "O"]
74+
}
75+
}
76+
}
77+
},
78+
"learning_rate": {
79+
"type": "exp",
80+
"decay_steps": 5000,
81+
"start_lr": 0.001,
82+
"stop_lr": 3.51e-08,
83+
"_comment": "that's all"
84+
},
85+
"loss_dict": {
86+
"water_1": {
87+
"type": "ener",
88+
"start_pref_e": 0.02,
89+
"limit_pref_e": 1,
90+
"start_pref_f": 1000,
91+
"limit_pref_f": 1,
92+
"start_pref_v": 0,
93+
"limit_pref_v": 0
94+
},
95+
"water_2": {
96+
"type": "ener",
97+
"start_pref_e": 0.02,
98+
"limit_pref_e": 1,
99+
"start_pref_f": 1000,
100+
"limit_pref_f": 1,
101+
"start_pref_v": 0,
102+
"limit_pref_v": 0
103+
}
104+
},
105+
"training": {
106+
"model_prob": {
107+
"water_1": 0.5,
108+
"water_2": 0.5
109+
},
110+
"data_dict": {
111+
"water_1": {
112+
"training_data": {
113+
"systems": [
114+
"../../water/data/data_0/",
115+
"../../water/data/data_1/",
116+
"../../water/data/data_2/"
117+
],
118+
"batch_size": 1,
119+
"_comment": "that's all"
120+
},
121+
"validation_data": {
122+
"systems": [
123+
"../../water/data/data_3/"
124+
],
125+
"batch_size": 1,
126+
"_comment": "that's all"
127+
}
128+
},
129+
"water_2": {
130+
"training_data": {
131+
"systems": [
132+
"../../water/data/data_0/",
133+
"../../water/data/data_1/",
134+
"../../water/data/data_2/"
135+
],
136+
"batch_size": 1,
137+
"_comment": "that's all"
138+
}
139+
}
140+
},
141+
"numb_steps": 100000,
142+
"seed": 10,
143+
"disp_file": "lcurve.out",
144+
"disp_freq": 100,
145+
"save_freq": 100,
146+
"_comment": "that's all"
147+
}
148+
}

source/tests/common/test_examples.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
input_files_multi = (
6969
p_examples / "water_multi_task" / "pytorch_example" / "input_torch.json",
7070
p_examples / "water_multi_task" / "pytorch_example" / "input_torch_sharefit.json",
71+
p_examples / "water_multi_task" / "pytorch_example" / "input_torch_with_alias.json",
7172
p_examples / "hessian" / "multi_task" / "input.json",
7273
)
7374

0 commit comments

Comments
 (0)