@@ -58,15 +58,16 @@ class TrialConfig(BaseModel):
5858 after which experiment will be stopped. Default is -1 (no early stopping). \
5959 Count each time when calling log_metrics with the monitored metric." ,
6060 )
61- max_run_number : int = Field (
61+ max_runs_per_trial : int = Field (
6262 default = - 1 ,
63- description = "Maximum number of runs for the trial. \
63+ description = "Maximum number of runs for each trial. \
6464 Default is -1 (no limit). Count by the finished runs." ,
6565 )
6666 monitor_metric : str | None = Field (
6767 default = None ,
68- description = "The metric to monitor for saving the best checkpoint. \
69- Required if save_on_best is True." ,
68+ description = "The metric to monitor together with other configurations \
69+ like early_stopping_runs and save_on_best. \
70+ Required if save_on_best is true or early_stopping_runs > 0." ,
7071 )
7172 monitor_mode : str = Field (
7273 default = "max" ,
@@ -116,7 +117,7 @@ class Trial:
116117 "_running_tasks" ,
117118 # Only work when early_stopping_runs > 0
118119 "_early_stopping_counter" ,
119- # Only work when max_run_number > 0
120+ # Only work when max_runs_per_trial > 0
120121 "_total_runs_counter" ,
121122 )
122123
@@ -315,12 +316,12 @@ def start_run(self, call_func: callable) -> Run:
315316
316317 task .add_done_callback (lambda t : self ._running_tasks .pop (run .id , None ))
317318 task .add_done_callback (lambda t : self ._runs .pop (run .id , None ))
318- if self ._config .max_run_number > 0 :
319+ if self ._config .max_runs_per_trial > 0 :
319320 task .add_done_callback (
320321 lambda t : (
321322 setattr (self , "_total_runs_counter" , self ._total_runs_counter + 1 ),
322323 self .cancel ()
323- if self ._total_runs_counter >= self ._config .max_run_number
324+ if self ._total_runs_counter >= self ._config .max_runs_per_trial
324325 else None ,
325326 )
326327 )
0 commit comments