Skip to content

Commit

Permalink
Adding cli option for optuna search
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-braf committed Apr 26, 2024
1 parent eefea55 commit c3d3f3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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 version of quick search allowing "
" the user to quick search over any parameter.",
)
)
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

0 comments on commit c3d3f3c

Please sign in to comment.