@@ -56,13 +56,20 @@ def parse_arguments():
5656 help = "Choose to train a model between GP, NN, or ensemble_NN" ,
5757 required = True ,
5858 )
59+ parser .add_argument (
60+ "--test" ,
61+ help = "Skip writing trained model to database (test mode)" ,
62+ action = "store_true" ,
63+ default = False ,
64+ )
5965 args = parser .parse_args ()
6066 experiment = args .experiment
6167 model_type = args .model
62- print (f"Experiment: { experiment } , Model type: { model_type } " )
68+ test_mode = args .test
69+ print (f"Experiment: { experiment } , Model type: { model_type } , Test mode: { test_mode } " )
6370 if model_type not in ["NN" , "ensemble_NN" , "GP" ]:
6471 raise ValueError (f"Invalid model type: { model_type } " )
65- return experiment , model_type
72+ return experiment , model_type , test_mode
6673
6774
6875def load_config (experiment ):
@@ -422,7 +429,7 @@ def write_model(model, model_type, experiment, db):
422429# Main execution block
423430if __name__ == "__main__" :
424431 # Parse command line arguments and load config
425- experiment , model_type = parse_arguments ()
432+ experiment , model_type , test_mode = parse_arguments ()
426433 config_dict = load_config (experiment )
427434 # Extract input and output variables from the config file
428435 input_variables = config_dict ["inputs" ]
@@ -529,4 +536,7 @@ def write_model(model, model_type, experiment, db):
529536 device ,
530537 )
531538
532- write_model (model , model_type , experiment , db )
539+ if not test_mode :
540+ write_model (model , model_type , experiment , db )
541+ else :
542+ print ("Test mode enabled: Skipping writing trained model to database" )
0 commit comments