Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc LLM cleanup #782

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions model_analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ def profile(

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

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

# TODO TMA-1443: need to figure out detailed reporting for LLMs
if not self._config.is_llm_model():
self._create_detailed_reports(mode)

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 @@ -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
Loading