File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed
Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 11import plasma .global_vars as g
22g .init_MPI ()
3+
4+ import os .path
5+
6+
7+ # TODO(KGF): replace this workaround for the "from plasma.conf import conf"
8+ def is_valid_file (parser , arg ):
9+ if not (os .path .exists (arg ) and os .path .isfile (arg )):
10+ parser .error ("The file %s does not exist!" % arg )
11+ else :
12+ return arg
13+
14+ import argparse
15+ parser = argparse .ArgumentParser (prog = 'mpi_learn' , description = 'FusionDL TensorFlow 1.x + mpi4py' )
16+ parser .add_argument ("--input_file" , "-i" , # type=str,
17+ required = False , dest = "conf_file" ,
18+ help = "input YAML file for configuration" , metavar = "YAML_FILE" ,
19+ type = lambda x : is_valid_file (parser , x ))
20+ args = parser .parse_args ()
21+
22+ g .conf_file = args .conf_file
23+
24+
25+ from plasma .conf import conf
26+
327from plasma .models .mpi_runner import (
428 mpi_train , mpi_make_predictions_and_evaluate
529 )
30+
631from plasma .preprocessor .preprocess import guarantee_preprocessed
732from plasma .models .loader import Loader
8- from plasma . conf import conf
33+
934'''
1035#########################################################
1136This file trains a deep learning model to predict
Original file line number Diff line number Diff line change 11from plasma .conf_parser import parameters
22import os
33import errno
4+ import plasma .global_vars as g
5+
46
57# TODO(KGF): this conf.py feels like an unnecessary level of indirection
6- if os .path .exists (os .path .join (os .path .abspath (os .path .dirname (__file__ )),
8+ if g .conf_file is not None :
9+ g .print_unique (f"Loading configuration from { g .conf_file } " )
10+ conf = parameters (g .conf_file )
11+ elif os .path .exists (os .path .join (os .path .abspath (os .path .dirname (__file__ )),
712 '../examples/conf.yaml' )):
813 conf = parameters (os .path .join (os .path .abspath (os .path .dirname (__file__ )),
914 '../examples/conf.yaml' ))
Original file line number Diff line number Diff line change 1010# TODO(KGF): remove this (and all?) references to Keras backend
1111backend = ''
1212tf_ver = None
13+ conf_file = None
1314
1415
1516def init_MPI ():
You can’t perform that action at this time.
0 commit comments