Skip to content

Commit

Permalink
More cleanup from hwoo CR
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-braf committed Oct 18, 2023
1 parent d6e7c74 commit 51aedfa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
12 changes: 5 additions & 7 deletions model_analyzer/config/generate/perf_analyzer_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,21 +379,19 @@ def _update_perf_config_based_on_parameter_combination(
) -> None:
if "request-parameter" in parameter_combination:
request_parameter = parameter_combination["request-parameter"]
max_token = self._extract_max_token_from_request_parameter(
max_tokens = self._extract_max_tokens_from_request_parameter(
request_parameter
)
parameter_combination["request-period"] = (
max_token if max_token < 10 else 10
max_tokens if max_tokens < 10 else 10
)

perf_config.update_config(parameter_combination)

def _extract_max_token_from_request_parameter(self, request_parameter: str) -> int:
max_token_start = request_parameter.find(":")
max_token_stop = request_parameter.find(":", max_token_start + 1)
max_token = int(request_parameter[max_token_start + 1 : max_token_stop])
def _extract_max_tokens_from_request_parameter(self, request_parameter: str) -> int:
_, max_tokens, _ = request_parameter.split(":")

return max_token
return int(max_tokens)

def _update_perf_config_based_on_perf_analyzer_flags(
self, perf_config: PerfAnalyzerConfig
Expand Down
12 changes: 6 additions & 6 deletions tests/common/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@ def construct_perf_analyzer_config(
pa_config._args["concurrency-range"] = concurrency

if llm_search_mode:
pa_config._args["request-parameter"] = (
"max_tokens:" + str(max_token_count) + ":int"
)
pa_config._args["request-parameter"] = f"max_tokens:{str(max_token_count)}:int"

pa_config._args["request-period"] = (
max_token_count if max_token_count < 10 else 10
)
pa_config._args["input-data"] = (
DEFAULT_INPUT_JSON_PATH + "/input-data-" + str(text_input_length) + ".json"
)
pa_config._args[
"input-data"
] = f"{DEFAULT_INPUT_JSON_PATH}/input-data-{str(text_input_length)}.json"

pa_config._args["streaming"] = "True"

pa_config._args["measurement-mode"] = DEFAULT_MEASUREMENT_MODE
Expand Down

0 comments on commit 51aedfa

Please sign in to comment.