Skip to content

Commit 1c20a69

Browse files
author
Han Wang
committed
when the key systems is provided with a string, all possible systems will be recursively searched within the dir given by systems
1 parent f5835ef commit 1c20a69

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/train/train.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ def train (args) :
8585
# serial training
8686
_do_work(jdata, run_opt)
8787

88+
def expand_sys_str(root_dir):
89+
all_sys = []
90+
from pathlib import Path
91+
for filename in Path(root_dir).rglob('type.raw'):
92+
all_sys.append(os.path.dirname(filename))
93+
return all_sys
94+
8895
def _do_work(jdata, run_opt):
8996
# init the model
9097
model = NNPTrainer (jdata, run_opt = run_opt)
@@ -93,6 +100,8 @@ def _do_work(jdata, run_opt):
93100
# init params and run options
94101
assert('training' in jdata)
95102
systems = j_must_have(jdata['training'], 'systems')
103+
if type(systems) == str:
104+
systems = expand_sys_str(systems)
96105
set_pfx = j_must_have(jdata['training'], 'set_prefix')
97106
numb_sys = len(systems)
98107
seed = None

0 commit comments

Comments
 (0)