Skip to content

Commit

Permalink
Connect up parameter description class (#869)
Browse files Browse the repository at this point in the history
* Added hooks for creating search parameters with some basic unit testing

* Adding more unit testing

* Cleaning up codeql

* Adding story ref for TODO

* Changes based on review comments

* Refactored ConfigParameters

* Renaming to SearchParameter(s)

* Moving unit testing into SearchParameters test class

* Fix codeql issues
  • Loading branch information
nv-braf authored and root committed May 7, 2024
1 parent 6ed29fe commit 2b40c67
Show file tree
Hide file tree
Showing 8 changed files with 705 additions and 272 deletions.
12 changes: 11 additions & 1 deletion model_analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
import logging
import sys
from copy import deepcopy
from typing import List, Optional, Union
from typing import Dict, List, Optional, Union

from model_analyzer.cli.cli import CLI
from model_analyzer.config.generate.base_model_config_generator import (
BaseModelConfigGenerator,
)
from model_analyzer.config.generate.search_parameters import SearchParameters
from model_analyzer.constants import LOGGER_NAME, PA_ERROR_LOG_FILENAME
from model_analyzer.state.analyzer_state_manager import AnalyzerStateManager
from model_analyzer.triton.server.server import TritonServer
Expand Down Expand Up @@ -82,6 +83,8 @@ def __init__(
constraint_manager=self._constraint_manager,
)

self._search_parameters: Dict[str, SearchParameters] = {}

def profile(
self, client: TritonClient, gpus: List[GPUDevice], mode: str, verbose: bool
) -> None:
Expand Down Expand Up @@ -115,6 +118,7 @@ def profile(

self._create_metrics_manager(client, gpus)
self._create_model_manager(client, gpus)
self._populate_search_parameters()

if self._config.triton_launch_mode == "remote":
self._warn_if_other_models_loaded_on_remote_server(client)
Expand Down Expand Up @@ -414,3 +418,9 @@ def _warn_if_other_models_loaded_on_remote_server(self, client):
f"A model not being profiled ({model_name}) is loaded on the remote Tritonserver. "
"This could impact the profile results."
)

def _populate_search_parameters(self):
for model in self._config.profile_models:
self._search_parameters[model.model_name()] = SearchParameters(
self._config, model.parameters(), model.model_config_parameters()
)
100 changes: 0 additions & 100 deletions model_analyzer/config/generate/config_parameters.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from typing import Any, List, Optional


class ParameterType(Enum):
class ParameterUsage(Enum):
MODEL = auto()
RUNTIME = auto()
BUILD = auto()
Expand All @@ -32,17 +32,17 @@ class ParameterCategory(Enum):


@dataclass
class ConfigParameter:
class SearchParameter:
"""
A dataclass that holds information about a configuration parameter
A dataclass that holds information about a configuration's search parameter
"""

ptype: ParameterType
usage: ParameterUsage
category: ParameterCategory

# This is only applicable to LIST category
enumerated_list: Optional[List[Any]] = None

# These are only applicable to INTEGER and EXPONENTIAL categories
min_range: Optional[int] = None
max_range: Optional[int] = None

# This is only applicable to LIST category
enumerated_list: List[Any] = []
Loading

0 comments on commit 2b40c67

Please sign in to comment.