Skip to content

Commit

Permalink
Remove unnecessary wrapper-helper around early-stopping call (#2666)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2666

As titled

Reviewed By: saitcakmak, Balandat

Differential Revision: D55710758
  • Loading branch information
Lena Kashtelyan authored and facebook-github-bot committed Sep 10, 2024
1 parent 9658082 commit eaf5675
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 128 deletions.
22 changes: 3 additions & 19 deletions ax/service/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,8 +1233,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 @@ -1428,24 +1430,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
109 changes: 0 additions & 109 deletions ax/utils/testing/backend_scheduler.py

This file was deleted.

0 comments on commit eaf5675

Please sign in to comment.