Skip to content

Commit f97b4f2

Browse files
authored
enable check_json hook (#2760)
Number `_comment` keys so there will be no duplicated keys. ```py from glob import glob for ii in glob("**/*.json", recursive=True): with open(ii) as f: content = f.read() count = 1 while True: if r'"_comment"' not in content: break content = content.replace('"_comment"', '"_comment%d"' % count, 1) count += 1 with open(ii, "w") as f: f.write(content) ``` Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent 282c2a0 commit f97b4f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+425
-425
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: end-of-file-fixer
1010
exclude: "^.+\\.pbtxt$"
1111
- id: check-yaml
12-
#- id: check-json
12+
- id: check-json
1313
- id: check-added-large-files
1414
args: ['--maxkb=1024', '--enforce-all']
1515
# TODO: remove the following after resolved

examples/dos/train/input.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
"batch_size": 1
7070
}
7171
},
72-
"_comment": "that's all"
72+
"_comment1": "that's all"
7373
}

examples/dprc/generalized_force/input.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"type_map": [
55
"C",
@@ -185,7 +185,7 @@
185185
"decay_steps": 5000,
186186
"start_lr": 0.001,
187187
"stop_lr": 3.51e-8,
188-
"_comment": "that's all"
188+
"_comment2": "that's all"
189189
},
190190

191191
"loss": {
@@ -199,7 +199,7 @@
199199
"start_pref_gf": 10,
200200
"limit_pref_gf": 100,
201201
"numb_generalized_coord": 1,
202-
"_comment": " that's all"
202+
"_comment3": " that's all"
203203
},
204204

205205
"training": {
@@ -208,15 +208,15 @@
208208
"../data"
209209
],
210210
"batch_size": "auto",
211-
"_comment": "that's all"
211+
"_comment4": "that's all"
212212
},
213213
"numb_steps": 10000,
214214
"seed": 10,
215215
"disp_file": "lcurve.out",
216216
"disp_freq": 100,
217217
"save_freq": 1000,
218-
"_comment": "that's all"
218+
"_comment5": "that's all"
219219
},
220220

221-
"_comment": "that's all"
221+
"_comment6": "that's all"
222222
}

examples/dprc/normal/input.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"type_map": [
55
"C",
@@ -185,7 +185,7 @@
185185
"decay_steps": 5000,
186186
"start_lr": 0.001,
187187
"stop_lr": 3.51e-8,
188-
"_comment": "that's all"
188+
"_comment2": "that's all"
189189
},
190190

191191
"loss": {
@@ -196,7 +196,7 @@
196196
"limit_pref_f": 1,
197197
"start_pref_v": 0,
198198
"limit_pref_v": 0,
199-
"_comment": " that's all"
199+
"_comment3": " that's all"
200200
},
201201

202202
"training": {
@@ -205,15 +205,15 @@
205205
"../data"
206206
],
207207
"batch_size": "auto",
208-
"_comment": "that's all"
208+
"_comment4": "that's all"
209209
},
210210
"numb_steps": 1000,
211211
"seed": 10,
212212
"disp_file": "lcurve.out",
213213
"disp_freq": 100,
214214
"save_freq": 1000,
215-
"_comment": "that's all"
215+
"_comment5": "that's all"
216216
},
217217

218-
"_comment": "that's all"
218+
"_comment6": "that's all"
219219
}

examples/dprc/pairwise/input.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"type": "pairwise_dprc",
55
"type_map": [
@@ -153,7 +153,7 @@
153153
"decay_steps": 5000,
154154
"start_lr": 0.001,
155155
"stop_lr": 3.51e-8,
156-
"_comment": "that's all"
156+
"_comment2": "that's all"
157157
},
158158

159159
"loss": {
@@ -164,7 +164,7 @@
164164
"limit_pref_f": 1,
165165
"start_pref_v": 0,
166166
"limit_pref_v": 0,
167-
"_comment": " that's all"
167+
"_comment3": " that's all"
168168
},
169169

170170
"training": {
@@ -173,15 +173,15 @@
173173
"../data"
174174
],
175175
"batch_size": "auto",
176-
"_comment": "that's all"
176+
"_comment4": "that's all"
177177
},
178178
"numb_steps": 1000,
179179
"seed": 10,
180180
"disp_file": "lcurve.out",
181181
"disp_freq": 100,
182182
"save_freq": 1000,
183-
"_comment": "that's all"
183+
"_comment5": "that's all"
184184
},
185185

186-
"_comment": "that's all"
186+
"_comment6": "that's all"
187187
}

examples/fparam/train/input.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"data_stat_nbatch": 1,
55
"descriptor": {
@@ -47,7 +47,7 @@
4747
"decay_steps": 5000
4848
},
4949

50-
"_comment": " traing controls",
50+
"_comment2": " traing controls",
5151
"training": {
5252
"training_data": {
5353
"systems": [
@@ -61,8 +61,8 @@
6161

6262
"seed": 1,
6363

64-
"_comment": " display and restart",
65-
"_comment": " frequencies counted in batch",
64+
"_comment3": " display and restart",
65+
"_comment4": " frequencies counted in batch",
6666
"disp_file": "lcurve.out",
6767
"disp_freq": 100,
6868
"save_freq": 1000,
@@ -73,5 +73,5 @@
7373
"profiling_file": "timeline.json"
7474
},
7575

76-
"_comment": "that's all"
76+
"_comment5": "that's all"
7777
}

examples/fparam/train/input_aparam.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"data_stat_nbatch": 1,
55
"descriptor": {
@@ -47,7 +47,7 @@
4747
"decay_steps": 5000
4848
},
4949

50-
"_comment": " traing controls",
50+
"_comment2": " traing controls",
5151
"training": {
5252
"training_data": {
5353
"systems": [
@@ -61,8 +61,8 @@
6161

6262
"seed": 1,
6363

64-
"_comment": " display and restart",
65-
"_comment": " frequencies counted in batch",
64+
"_comment3": " display and restart",
65+
"_comment4": " frequencies counted in batch",
6666
"disp_file": "lcurve.out",
6767
"disp_freq": 100,
6868
"save_freq": 1000,
@@ -73,5 +73,5 @@
7373
"profiling_file": "timeline.json"
7474
},
7575

76-
"_comment": "that's all"
76+
"_comment5": "that's all"
7777
}

examples/nopbc/mixed/input.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"type_map": [
55
"C",
@@ -20,7 +20,7 @@
2020
"axis_neuron": 12,
2121
"precision": "float64",
2222
"seed": 1,
23-
"_comment": " that's all"
23+
"_comment2": " that's all"
2424
},
2525
"fitting_net": {
2626
"neuron": [
@@ -31,17 +31,17 @@
3131
"resnet_dt": true,
3232
"precision": "float64",
3333
"seed": 1,
34-
"_comment": " that's all"
34+
"_comment3": " that's all"
3535
},
36-
"_comment": " that's all"
36+
"_comment4": " that's all"
3737
},
3838

3939
"learning_rate": {
4040
"type": "exp",
4141
"decay_steps": 4000,
4242
"start_lr": 0.001,
4343
"stop_lr": 3.51e-8,
44-
"_comment": "that's all"
44+
"_comment5": "that's all"
4545
},
4646

4747
"loss": {
@@ -52,22 +52,22 @@
5252
"limit_pref_f": 1,
5353
"start_pref_v": 0,
5454
"limit_pref_v": 0,
55-
"_comment": " that's all"
55+
"_comment6": " that's all"
5656
},
5757

5858
"training": {
5959
"training_data": {
6060
"systems": "../data/",
6161
"batch_size": "mixed:4",
62-
"_comment": "that's all"
62+
"_comment7": "that's all"
6363
},
6464
"numb_steps": 4000000,
6565
"seed": 10,
6666
"disp_file": "lcurve.out",
6767
"disp_freq": 100,
6868
"save_freq": 1000,
69-
"_comment": "that's all"
69+
"_comment8": "that's all"
7070
},
7171

72-
"_comment": "that's all"
72+
"_comment9": "that's all"
7373
}

examples/nopbc/train/input.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_comment": " model parameters",
2+
"_comment1": " model parameters",
33
"model": {
44
"type_map": [
55
"C",
@@ -23,7 +23,7 @@
2323
"resnet_dt": false,
2424
"axis_neuron": 12,
2525
"seed": 1,
26-
"_comment": " that's all"
26+
"_comment2": " that's all"
2727
},
2828
"fitting_net": {
2929
"neuron": [
@@ -33,17 +33,17 @@
3333
],
3434
"resnet_dt": true,
3535
"seed": 1,
36-
"_comment": " that's all"
36+
"_comment3": " that's all"
3737
},
38-
"_comment": " that's all"
38+
"_comment4": " that's all"
3939
},
4040

4141
"learning_rate": {
4242
"type": "exp",
4343
"decay_steps": 4000,
4444
"start_lr": 0.001,
4545
"stop_lr": 3.51e-8,
46-
"_comment": "that's all"
46+
"_comment5": "that's all"
4747
},
4848

4949
"loss": {
@@ -54,22 +54,22 @@
5454
"limit_pref_f": 1,
5555
"start_pref_v": 0,
5656
"limit_pref_v": 0,
57-
"_comment": " that's all"
57+
"_comment6": " that's all"
5858
},
5959

6060
"training": {
6161
"training_data": {
6262
"systems": "../data/",
6363
"batch_size": "auto",
64-
"_comment": "that's all"
64+
"_comment7": "that's all"
6565
},
6666
"numb_steps": 4000000,
6767
"seed": 10,
6868
"disp_file": "lcurve.out",
6969
"disp_freq": 100,
7070
"save_freq": 1000,
71-
"_comment": "that's all"
71+
"_comment8": "that's all"
7272
},
7373

74-
"_comment": "that's all"
74+
"_comment9": "that's all"
7575
}

0 commit comments

Comments
 (0)