Skip to content

Commit

Permalink
Minor refactor and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-braf committed Oct 18, 2023
1 parent bca684c commit fdd4d58
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions input-data-10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data": [{"PROMPT": ["Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello"], "STREAM": [true]}]}
1 change: 1 addition & 0 deletions input-data-100.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data": [{"PROMPT": ["Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello"], "STREAM": [true]}]}
1 change: 1 addition & 0 deletions input-data-50.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data": [{"PROMPT": ["Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello"], "STREAM": [true]}]}
13 changes: 10 additions & 3 deletions model_analyzer/config/generate/perf_analyzer_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,22 @@ def _update_perf_config_based_on_parameter_combination(
) -> None:
if "request-parameter" in parameter_combination:
request_parameter = parameter_combination["request-parameter"]
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])
max_token = self._extract_max_token_from_request_parameter(
request_parameter
)
parameter_combination["request-period"] = (
max_token if max_token < 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])

return max_token

def _update_perf_config_based_on_perf_analyzer_flags(
self, perf_config: PerfAnalyzerConfig
) -> None:
Expand Down
1 change: 0 additions & 1 deletion tests/test_perf_analyzer_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,6 @@ def _run_and_test_perf_analyzer_config_generator(
self.assertEqual(
expected_configs[i]._options, perf_analyzer_configs[i]._options
)
self.maxDiff = None
self.assertEqual(expected_configs[i]._args, perf_analyzer_configs[i]._args)
self.assertEqual(
expected_configs[i]._additive_args,
Expand Down

0 comments on commit fdd4d58

Please sign in to comment.