@@ -47,35 +47,43 @@ def setUp(self) -> None:
4747
4848 def test_checkpoint (self ) -> None :
4949 INPUT = "model.pt"
50- ATTRIBUTES = "type-map descriptor fitting-net"
50+ ATTRIBUTES = "type-map descriptor fitting-net size "
5151 with redirect_stderr (io .StringIO ()) as f :
5252 run_dp (f"dp --pt show { INPUT } { ATTRIBUTES } " )
5353 results = f .getvalue ().split ("\n " )[:- 1 ]
54- assert "This is a singletask model" in results [- 4 ]
55- assert "The type_map is ['O', 'H', 'Au']" in results [- 3 ]
54+ assert "This is a singletask model" in results [- 8 ]
55+ assert "The type_map is ['O', 'H', 'Au']" in results [- 7 ]
5656 assert (
5757 "{'type': 'se_e2_a'" and "'sel': [46, 92, 4]" and "'rcut': 4.0"
58- ) in results [- 2 ]
58+ ) in results [- 6 ]
5959 assert (
6060 "The fitting_net parameter is {'neuron': [24, 24, 24], 'resnet_dt': True, 'seed': 1}"
61- in results [- 1 ]
61+ in results [- 5 ]
6262 )
63+ assert "Parameter counts:" in results [- 4 ]
64+ assert "Parameters in descriptor: 19,350" in results [- 3 ]
65+ assert "Parameters in fitting-net: 119,091" in results [- 2 ]
66+ assert "Parameters in total: 138,441" in results [- 1 ]
6367
6468 def test_frozen_model (self ) -> None :
6569 INPUT = "frozen_model.pth"
66- ATTRIBUTES = "type-map descriptor fitting-net"
70+ ATTRIBUTES = "type-map descriptor fitting-net size "
6771 with redirect_stderr (io .StringIO ()) as f :
6872 run_dp (f"dp --pt show { INPUT } { ATTRIBUTES } " )
6973 results = f .getvalue ().split ("\n " )[:- 1 ]
70- assert "This is a singletask model" in results [- 4 ]
71- assert "The type_map is ['O', 'H', 'Au']" in results [- 3 ]
74+ assert "This is a singletask model" in results [- 8 ]
75+ assert "The type_map is ['O', 'H', 'Au']" in results [- 7 ]
7276 assert (
7377 "{'type': 'se_e2_a'" and "'sel': [46, 92, 4]" and "'rcut': 4.0"
74- ) in results [- 2 ]
78+ ) in results [- 6 ]
7579 assert (
7680 "The fitting_net parameter is {'neuron': [24, 24, 24], 'resnet_dt': True, 'seed': 1}"
77- in results [- 1 ]
81+ in results [- 5 ]
7882 )
83+ assert "Parameter counts:" in results [- 4 ]
84+ assert "Parameters in descriptor: 19,350" in results [- 3 ]
85+ assert "Parameters in fitting-net: 119,091" in results [- 2 ]
86+ assert "Parameters in total: 138,441" in results [- 1 ]
7987
8088 def test_checkpoint_error (self ) -> None :
8189 INPUT = "model.pt"
@@ -144,54 +152,62 @@ def setUp(self) -> None:
144152
145153 def test_checkpoint (self ) -> None :
146154 INPUT = "model.ckpt.pt"
147- ATTRIBUTES = "model-branch type-map descriptor fitting-net"
155+ ATTRIBUTES = "model-branch type-map descriptor fitting-net size "
148156 with redirect_stderr (io .StringIO ()) as f :
149157 run_dp (f"dp --pt show { INPUT } { ATTRIBUTES } " )
150158 results = f .getvalue ().split ("\n " )[:- 1 ]
151- assert "This is a multitask model" in results [- 8 ]
159+ assert "This is a multitask model" in results [- 12 ]
152160 assert (
153161 "Available model branches are ['model_1', 'model_2', 'RANDOM'], "
154162 "where 'RANDOM' means using a randomly initialized fitting net."
155- in results [- 7 ]
163+ in results [- 11 ]
156164 )
157- assert "The type_map of branch model_1 is ['O', 'H', 'B']" in results [- 6 ]
158- assert "The type_map of branch model_2 is ['O', 'H', 'B']" in results [- 5 ]
165+ assert "The type_map of branch model_1 is ['O', 'H', 'B']" in results [- 10 ]
166+ assert "The type_map of branch model_2 is ['O', 'H', 'B']" in results [- 9 ]
159167 assert (
160168 "model_1"
161169 and "'type': 'se_e2_a'"
162170 and "'sel': [46, 92, 4]"
163171 and "'rcut_smth': 0.5"
164- ) in results [- 4 ]
172+ ) in results [- 8 ]
165173 assert (
166174 "model_2"
167175 and "'type': 'se_e2_a'"
168176 and "'sel': [46, 92, 4]"
169177 and "'rcut_smth': 0.5"
170- ) in results [- 3 ]
178+ ) in results [- 7 ]
171179 assert (
172180 "The fitting_net parameter of branch model_1 is {'neuron': [1, 2, 3], 'seed': 678}"
173- in results [- 2 ]
181+ in results [- 6 ]
174182 )
175183 assert (
176184 "The fitting_net parameter of branch model_2 is {'neuron': [9, 8, 7], 'seed': 1111}"
177- in results [- 1 ]
185+ in results [- 5 ]
178186 )
187+ assert "Parameter counts for a single branch model:" in results [- 4 ]
188+ assert "Parameters in descriptor: 19,350" in results [- 3 ]
189+ assert "Parameters in fitting-net: 4,860" in results [- 2 ]
190+ assert "Parameters in total: 24,210" in results [- 1 ]
179191
180192 def test_frozen_model (self ) -> None :
181193 INPUT = "frozen_model.pth"
182- ATTRIBUTES = "type-map descriptor fitting-net"
194+ ATTRIBUTES = "type-map descriptor fitting-net size "
183195 with redirect_stderr (io .StringIO ()) as f :
184196 run_dp (f"dp --pt show { INPUT } { ATTRIBUTES } " )
185197 results = f .getvalue ().split ("\n " )[:- 1 ]
186- assert "This is a singletask model" in results [- 4 ]
187- assert "The type_map is ['O', 'H', 'B']" in results [- 3 ]
198+ assert "This is a singletask model" in results [- 8 ]
199+ assert "The type_map is ['O', 'H', 'B']" in results [- 7 ]
188200 assert (
189201 "'type': 'se_e2_a'" and "'sel': [46, 92, 4]" and "'rcut_smth': 0.5"
190- ) in results [- 2 ]
202+ ) in results [- 6 ]
191203 assert (
192204 "The fitting_net parameter is {'neuron': [1, 2, 3], 'seed': 678}"
193- in results [- 1 ]
205+ in results [- 5 ]
194206 )
207+ assert "Parameter counts:" in results [- 4 ]
208+ assert "Parameters in descriptor: 19,350" in results [- 3 ]
209+ assert "Parameters in fitting-net: 4,860" in results [- 2 ]
210+ assert "Parameters in total: 24,210" in results [- 1 ]
195211
196212 def tearDown (self ) -> None :
197213 for f in os .listdir ("." ):
0 commit comments