2929calypso_model_devi_name = "model_devi_results"
3030
3131
32+ def _get_calypso_models (path , jdata ):
33+ """Return CALYPSO model files for the configured training backend."""
34+ backend = jdata .get ("train_backend" , "tensorflow" )
35+ suffixes = {
36+ "tensorflow" : ".pb" ,
37+ "pytorch" : ".pth" ,
38+ "jax" : ".savedmodel" ,
39+ }
40+ try :
41+ suffix = suffixes [backend ]
42+ except KeyError as exc :
43+ supported = ", " .join (sorted (suffixes ))
44+ raise ValueError (
45+ f"CALYPSO does not support training backend { backend !r} ; "
46+ f"supported backends are: { supported } ."
47+ ) from exc
48+ return sorted (glob .glob (os .path .join (path , f"graph*{ suffix } " )))
49+
50+
3251def gen_structures (
3352 iter_index , jdata , mdata , caly_run_path , current_idx , length_of_caly_runopt_list
3453):
@@ -50,7 +69,7 @@ def gen_structures(
5069 calypso_path = mdata .get ("model_devi_calypso_path" )
5170 # calypso_input_path = jdata.get('calypso_input_path')
5271
53- all_models = glob . glob ( os . path . join ( calypso_run_opt_path , "graph*pb" ) )
72+ all_models = _get_calypso_models ( calypso_run_opt_path , jdata )
5473 model_names = [os .path .basename (ii ) for ii in all_models ]
5574
5675 deepmdkit_python = mdata .get ("model_devi_deepmdkit_python" )
@@ -492,7 +511,7 @@ def run_calypso_model_devi(iter_index, jdata, mdata):
492511 elif lines [- 1 ].strip ().strip ("\n " ) == "3" :
493512 # Model Devi
494513 _calypso_run_opt_path = os .path .abspath (caly_run_opt_list [0 ])
495- all_models = glob . glob ( os . path . join ( _calypso_run_opt_path , "graph*pb" ) )
514+ all_models = _get_calypso_models ( _calypso_run_opt_path , jdata )
496515 cwd = os .getcwd ()
497516 os .chdir (calypso_model_devi_path )
498517 args = " " .join (
0 commit comments