Skip to content

Commit

Permalink
Remove unnecessary wrapper-helper around early-stopping call (faceboo…
Browse files Browse the repository at this point in the history
…k#2666)

Summary:
Pull Request resolved: facebook#2666

As titled

Differential Revision: D55710758
  • Loading branch information
Lena Kashtelyan authored and facebook-github-bot committed Aug 16, 2024
1 parent d988dd8 commit 7c6e286
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions ax/service/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,8 +1229,10 @@ def poll_and_process_results(self, poll_all_trial_statuses: bool = False) -> boo
trial_indices_with_updated_data_or_status.update(trial_indices_with_new_data)

# EARLY STOP TRIALS
stop_trial_info = self.should_stop_trials_early(
stop_trial_info = early_stopping_utils.should_stop_trials_early(
early_stopping_strategy=self.options.early_stopping_strategy,
trial_indices=self.experiment.running_trial_indices,
experiment=self.experiment,
)
self.stop_trial_runs(
trials=[self.experiment.trials[trial_idx] for trial_idx in stop_trial_info],
Expand Down Expand Up @@ -1424,24 +1426,6 @@ def _process_completed_trials(self, newly_completed: set[int]) -> None:
trial_indices=newly_completed,
)

def should_stop_trials_early(
self, trial_indices: set[int]
) -> dict[int, Optional[str]]:
"""Evaluate whether to early-stop running trials.
Args:
trial_indices: Indices of trials to consider for early stopping.
Returns:
A dictionary mapping trial indices that should be early stopped to
(optional) messages with the associated reason.
"""
return early_stopping_utils.should_stop_trials_early(
early_stopping_strategy=self.options.early_stopping_strategy,
trial_indices=trial_indices,
experiment=self.experiment,
)

def estimate_early_stopping_savings(self, map_key: Optional[str] = None) -> float:
"""Estimate early stopping savings using progressions of the MapMetric present
on the EarlyStoppingConfig as a proxy for resource usage.
Expand Down

0 comments on commit 7c6e286

Please sign in to comment.