@@ -91,12 +91,6 @@ def run_wosac_eval_in_subprocess(config, logger, global_step):
9191 model_dir = os .path .join (config ["data_dir" ], f"{ config ['env' ]} _{ run_id } " )
9292 model_files = glob .glob (os .path .join (model_dir , "model_*.pt" ))
9393
94- if not model_files :
95- print ("No model files found for WOSAC evaluation" )
96- return
97-
98- latest_cpt = max (model_files , key = os .path .getctime )
99-
10094 # Prepare evaluation command
10195 eval_config = config .get ("eval" , {})
10296 cmd = [
@@ -105,12 +99,10 @@ def run_wosac_eval_in_subprocess(config, logger, global_step):
10599 "pufferlib.pufferl" ,
106100 "eval" ,
107101 config ["env" ],
108- "--load-model-path" ,
109- latest_cpt ,
110102 "--eval.wosac-realism-eval" ,
111103 "True" ,
112- "--eval.wosac-num-agents " ,
113- str (eval_config .get ("wosac_num_agents " , 256 )),
104+ "--eval.wosac-num-maps " ,
105+ str (eval_config .get ("wosac_num_maps " , 256 )),
114106 "--eval.wosac-init-mode" ,
115107 str (eval_config .get ("wosac_init_mode" , "create_all_valid" )),
116108 "--eval.wosac-control-mode" ,
@@ -127,6 +119,12 @@ def run_wosac_eval_in_subprocess(config, logger, global_step):
127119 str (eval_config .get ("wosac_aggregate_results" , True )),
128120 ]
129121
122+ if not model_files :
123+ print ("No model files found for WOSAC evaluation. Running WOSAC with random policy." )
124+ elif len (model_files ) > 0 :
125+ latest_cpt = max (model_files , key = os .path .getctime )
126+ cmd .extend (["--load-model-path" , latest_cpt ])
127+
130128 # Run WOSAC evaluation in subprocess
131129 result = subprocess .run (cmd , capture_output = True , text = True , timeout = 600 , cwd = os .getcwd ())
132130
0 commit comments