Skip to content

Commit

Permalink
chore: deprecate Custom Searcher [MD-504] (#9829)
Browse files Browse the repository at this point in the history
Add deprecation warnings for Custom Searcher
  • Loading branch information
azhou-determined authored Aug 16, 2024
1 parent f7846cb commit a367cd0
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
DeepSpeed Autotune: User Guide
################################

.. important::

**Deprecation Notice**: DeepSpeed Autotune is deprecated and will be removed in an upcoming
release. For information on supported search methods, please visit :ref:`search-methods`.

.. meta::
:description: This user guide demonstrates how to optimize DeepSpeed parameters in order to take full advantage of the user's hardware and model.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
Custom Search Methods
#######################

.. important::

**Deprecation Notice**: Support for all custom search methods have been deprecated and will be
removed in a future release. Please see :ref:`search-methods` for details on supported preset
searchers.

+----------------------------------------------------------------+
| API reference |
+================================================================+
Expand Down
5 changes: 5 additions & 0 deletions docs/reference/custom-searcher-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Custom Searcher Reference
###########################

.. important::

**Deprecation Notice**: Custom Searcher is deprecated and will be removed in a future release.
Please see :ref:`search-methods` for details on supported preset searchers.

*******************************************
``determined.searcher.LocalSearchRunner``
*******************************************
Expand Down
4 changes: 1 addition & 3 deletions docs/reference/experiment-config-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,7 @@ points in the grid for this hyperparameter. Grid points are evenly spaced betwee
The ``searcher`` section defines how the experiment's hyperparameter space will be explored. To run
an experiment that trains a single trial with fixed hyperparameters, specify the ``single`` searcher
and specify constant values for the model's hyperparameters. Otherwise, Determined supports three
different hyperparameter search algorithms: ``adaptive_asha``, ``random``, and ``grid``. To define
your own hyperparameter search algorithm, specify the ``custom`` searcher. For more information
about custom search algorithms, see :ref:`topic-guides_hp-tuning-det_custom`.
different hyperparameter search algorithms: ``adaptive_asha``, ``random``, and ``grid``.

The name of the hyperparameter search algorithm to use is configured via the ``name`` field; the
remaining fields configure the behavior of the searcher and depend on the searcher being used. For
Expand Down
8 changes: 8 additions & 0 deletions docs/release-notes/deprecate-custom-searchers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:orphan:

**Deprecation**

- Custom Searchers: All custom searchers (including DeepSpeed Autotune) have been deprecated. This
feature will be removed in a future release. We will maintain first-class support for a variety
of preset searchers, which can be easily configured for any experiment. Please see
:ref:`search-methods` for details.
22 changes: 22 additions & 0 deletions e2e_tests/tests/fixtures/custom_searcher/searchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import random
import sys
import uuid
import warnings
from typing import Any, Dict, List, Optional, Set

from urllib3 import connectionpool
Expand All @@ -15,6 +16,13 @@

class SingleSearchMethod(searcher.SearchMethod):
def __init__(self, experiment_config: dict, max_length: int) -> None:
warnings.warn(
"`SingleSearchMethod` and all custom searchers have been deprecated. "
"This feature will be removed in a future release. Consider configuring a preset "
"searcher instead (see Determined docs for details).",
FutureWarning,
stacklevel=2,
)
# since this is a single trial the hyperparameter space comprises a single point
self.hyperparameters = experiment_config["hyperparameters"]
self.max_length = max_length
Expand Down Expand Up @@ -74,6 +82,13 @@ def __init__(
exception_points: Optional[List[str]] = None,
metric_as_dict: bool = False,
) -> None:
warnings.warn(
"`RandomSearchMethod` and all custom searchers have been deprecated. "
"This feature will be removed in a future release. Consider configuring a preset "
"searcher instead (see Determined docs for details).",
FutureWarning,
stacklevel=2,
)
self.max_trials = max_trials
self.max_concurrent_trials = max_concurrent_trials
self.max_length = max_length
Expand Down Expand Up @@ -363,6 +378,13 @@ def __init__(
max_concurrent_trials: int = 16,
exception_points: Optional[List[str]] = None,
) -> None:
warnings.warn(
"`ASHASearchMethod` and all custom searchers have been deprecated. "
"This feature will be removed in a future release. Consider configuring a preset "
"searcher instead (see Determined docs for details).",
FutureWarning,
stacklevel=2,
)
self.asha_search_state = ASHASearchMethodState(
max_length, max_trials, num_rungs, divisor, max_concurrent_trials
)
Expand Down
8 changes: 8 additions & 0 deletions harness/determined/searcher/_remote_search_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import pathlib
import pickle
import warnings
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union

import determined as det
Expand All @@ -21,6 +22,13 @@ class RemoteSearchRunner(searcher.SearchRunner):
"""

def __init__(self, search_method: searcher.SearchMethod, context: det.core.Context) -> None:
warnings.warn(
"`RemoteSearchRunner` and all custom searchers have been deprecated. "
"This feature will be removed in a future release. Consider configuring a preset "
"searcher instead (see Determined docs for details).",
FutureWarning,
stacklevel=2,
)
super().__init__(search_method)
self.context = context
info = det.get_cluster_info()
Expand Down
10 changes: 10 additions & 0 deletions harness/determined/searcher/_search_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import pathlib
import uuid
import warnings
from typing import Any, Dict, List, Optional, Set, Tuple

from determined import experimental
Expand Down Expand Up @@ -224,6 +225,15 @@ class SearchMethod:
Do not modify ``searcher_state`` passed into event handlers.
"""

def __init__(self) -> None:
warnings.warn(
"`SearchMethod` and all custom searchers have been deprecated. "
"This feature will be removed in a future release. Consider configuring a preset "
"searcher instead (see Determined docs for details).",
FutureWarning,
stacklevel=2,
)

@abc.abstractmethod
def initial_operations(self, searcher_state: SearcherState) -> List[Operation]:
"""
Expand Down
8 changes: 8 additions & 0 deletions harness/determined/searcher/_search_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pickle
import time
import uuid
import warnings
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union

from determined import searcher
Expand Down Expand Up @@ -256,6 +257,13 @@ def __init__(
searcher_dir: Optional[pathlib.Path] = None,
session: Optional[api.Session] = None,
):
warnings.warn(
"`LocalSearchRunner` and all custom searchers have been deprecated. "
"This feature will be removed in a future release. Consider configuring a preset "
"searcher instead (see Determined docs for details).",
FutureWarning,
stacklevel=2,
)
super().__init__(search_method)
self.state_path = None
self.session = session
Expand Down

0 comments on commit a367cd0

Please sign in to comment.