From 51aedfa4bbd22d089a8803c6de31ed9064c1bb2c Mon Sep 17 00:00:00 2001 From: braf Date: Wed, 18 Oct 2023 22:59:33 +0000 Subject: [PATCH] More cleanup from hwoo CR --- .../generate/perf_analyzer_config_generator.py | 12 +++++------- tests/common/test_utils.py | 12 ++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/model_analyzer/config/generate/perf_analyzer_config_generator.py b/model_analyzer/config/generate/perf_analyzer_config_generator.py index 44cb4b8d9..06fb3e41d 100755 --- a/model_analyzer/config/generate/perf_analyzer_config_generator.py +++ b/model_analyzer/config/generate/perf_analyzer_config_generator.py @@ -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 diff --git a/tests/common/test_utils.py b/tests/common/test_utils.py index 7e27824cf..164ee1ad4 100755 --- a/tests/common/test_utils.py +++ b/tests/common/test_utils.py @@ -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