Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding cli option for optuna search #867

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions model_analyzer/config/input/config_command_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,14 +920,15 @@ def _add_run_search_configs(self):
ConfigField(
"run_config_search_mode",
flags=["--run-config-search-mode"],
choices=["brute", "quick"],
choices=["brute", "quick", "optuna"],
field_type=ConfigPrimitive(str),
default_value=DEFAULT_RUN_CONFIG_SEARCH_MODE,
description="The search mode for Model Analyzer to find and evaluate"
" model configurations. 'brute' will brute force all combinations of"
" configuration options. 'quick' will attempt to find a near-optimal"
" configuration as fast as possible, but isn't guaranteed to find the"
" best.",
" best. 'optuna' is a more generalized search algorithm allowing "
" the user to quickly search over any set of parameters.",
)
)
self._add_config(
Expand Down
9 changes: 8 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ def test_copy(self):

def test_multi_model_search_mode(self):
"""
Test that multi-model is only run in quick
Test that multi-model is only run in quick/optuna
"""
args = [
"model-analyzer",
Expand Down Expand Up @@ -2011,6 +2011,13 @@ def test_multi_model_search_mode(self):

self._evaluate_config(new_args, yaml_content, subcommand="profile")

# Optuna should pass
new_args = list(args)
new_args.append("--run-config-search-mode")
new_args.append("optuna")

self._evaluate_config(new_args, yaml_content, subcommand="profile")

def test_quick_search_mode(self):
"""
Test that only legal options are specified in quick search
Expand Down
Loading