Skip to content

Commit

Permalink
Fixing codeQL and hwoo's review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-braf committed Oct 17, 2023
1 parent daccc30 commit d7fb662
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions model_analyzer/config/generate/perf_analyzer_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

import json
import logging
from itertools import permutations, repeat
from itertools import repeat
from typing import Any, Dict, Generator, List, Optional, Tuple

from model_analyzer.config.input.config_command_profile import ConfigCommandProfile
from model_analyzer.config.input.config_defaults import (
DEFAULT_INPUT_JSON_PATH,
DEFAULT_RUN_CONFIG_MIN_CONCURRENCY,
DEFAULT_RUN_CONFIG_MIN_MAX_TOKEN_COUNT,
DEFAULT_RUN_CONFIG_MIN_PERIODIC_CONCURRENCY,
DEFAULT_RUN_CONFIG_MIN_REQUEST_RATE,
DEFAULT_RUN_CONFIG_MIN_TEXT_INPUT_LENGTH,
DEFAULT_RUN_CONFIG_PERIODIC_CONCURRENCY,
)
from model_analyzer.constants import (
LOGGER_NAME,
Expand Down Expand Up @@ -270,27 +270,25 @@ def _generate_periodic_concurrencies(self) -> List[str]:
self._cli_config.run_config_search_max_periodic_concurrency_step,
)

for min_periodic_concurrency in periodic_concurrency_doubled_list:
for max_periodic_concurrency in periodic_concurrency_doubled_list:
for start in periodic_concurrency_doubled_list:
for end in periodic_concurrency_doubled_list:
for step in step_doubled_list:
if self._is_illegal_periodic_concurrency_combination(
min_periodic_concurrency, max_periodic_concurrency, step
start, end, step
):
continue

periodic_concurrencies.append(
f"{min_periodic_concurrency}:{max_periodic_concurrency}:{step}"
)
periodic_concurrencies.append(f"{start}:{end}:{step}")
return periodic_concurrencies

def _is_illegal_periodic_concurrency_combination(
self, min: int, max: int, step: int
self, start: int, end: int, step: int
) -> bool:
if min > max:
if start > end:
return True
elif max == min and step != 1:
elif start == end and step != 1:
return True
elif (max - min) % step:
elif (end - start) % step:
return True

return False
Expand Down
2 changes: 1 addition & 1 deletion tests/test_perf_analyzer_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def test_llm_search_text_input_length(self):
periodic_concurrencies = ["16:32:4", "16:32:8", "16:32:16"]

expected_configs = []
for til in text_input_lengths:
for _ in text_input_lengths:
for pc in periodic_concurrencies:
expected_configs.append(
construct_perf_analyzer_config(
Expand Down

0 comments on commit d7fb662

Please sign in to comment.