Skip to content

Commit

Permalink
General cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-braf committed Oct 31, 2023
1 parent f508625 commit adef23f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion model_analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ def profile(

if not self._config.skip_summary_reports:
self._create_summary_tables(verbose)
self._create_summary_reports(mode)

# TODO: need to figure out summary reporting for LLMs
if not self._config.is_llm_model():
self._create_summary_reports(mode)

# FIXME: need to figure out detailed reporting for LLMs
if not self._config.is_llm_model():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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

Expand Down Expand Up @@ -328,7 +329,7 @@ def _create_request_period_list(self) -> List[int]:
return []

if self._model_parameters["request_period"]:
return sorted(self._model_parameters["period"])
return sorted(self._model_parameters["request_period"])
elif self._cli_config.run_config_search_disable:
return [DEFAULT_RUN_CONFIG_MIN_REQUEST_PERIOD]
else:
Expand Down Expand Up @@ -448,6 +449,9 @@ def _modify_text_in_input_dict(self, text_input_length: int) -> Dict:
def _write_modified_input_dict_to_file(
self, modified_input_dict: Dict, input_json_filename: str
) -> None:
if not os.path.exists(DEFAULT_INPUT_JSON_PATH):
os.makedirs(DEFAULT_INPUT_JSON_PATH)

with open(input_json_filename, "w") as f:
json.dump(modified_input_dict, f)

Expand Down
2 changes: 1 addition & 1 deletion model_analyzer/config/input/config_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
DEFAULT_SKIP_SUMMARY_REPORTS = False
DEFAULT_SKIP_DETAILED_REPORTS = False
DEFAULT_OUTPUT_MODEL_REPOSITORY = os.path.join(os.getcwd(), "output_model_repository")
DEFAULT_INPUT_JSON_PATH = os.getcwd()
DEFAULT_INPUT_JSON_PATH = os.path.join(os.getcwd(), "input_json_dir")
DEFAULT_OVERRIDE_OUTPUT_REPOSITORY_FLAG = False
DEFAULT_BATCH_SIZES = 1
DEFAULT_MAX_RETRIES = 50
Expand Down
5 changes: 5 additions & 0 deletions model_analyzer/record/metrics_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import logging
import os
import shutil
import time
from collections import defaultdict
from typing import Dict, List, Optional, Tuple
Expand All @@ -27,6 +28,7 @@
from model_analyzer.config.generate.base_model_config_generator import (
BaseModelConfigGenerator,
)
from model_analyzer.config.input.config_defaults import DEFAULT_INPUT_JSON_PATH
from model_analyzer.config.run.run_config import RunConfig
from model_analyzer.constants import LOGGER_NAME, PA_ERROR_LOG_FILENAME
from model_analyzer.model_analyzer_exceptions import TritonModelAnalyzerException
Expand Down Expand Up @@ -309,6 +311,9 @@ def profile_models(self, run_config: RunConfig) -> Optional[RunConfigMeasurement
def finalize(self):
self._server.stop()

if os.path.exists(DEFAULT_INPUT_JSON_PATH):
shutil.rmtree(DEFAULT_INPUT_JSON_PATH)

def _create_model_variants(self, run_config: RunConfig) -> None:
"""
Creates and fills all model variant directories
Expand Down
4 changes: 3 additions & 1 deletion tests/test_model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,9 @@ def _test_model_manager(self, yaml_content, expected_ranges, args=None):
MagicMock(),
)

model_manager.run_models([config.profile_models[0]])
with patch("shutil.rmtree"):
model_manager.run_models([config.profile_models[0]])

self.mock_model_config.stop()

self._check_results(model_manager, expected_ranges)
Expand Down

0 comments on commit adef23f

Please sign in to comment.