Skip to content
Open
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
28 changes: 14 additions & 14 deletions genai-perf/genai_perf/subcommand/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,41 +58,41 @@ class Profile(Subcommand):

def __init__(self, config: ConfigCommand, extra_args: Optional[List[str]]) -> None:
super().__init__(config, extra_args)
self._objectives = self._create_objectives_based_on_stimulus()
self._genai_perf_config = self._create_genai_perf_config(self._objectives)
self._perf_analyzer_config = self._create_perf_analyzer_config(self._objectives)

def profile(self) -> None:
"""
Profiles the model based on the user's stimulus
"""
objectives = self._create_objectives_based_on_stimulus()
genai_perf_config = self._create_genai_perf_config(objectives)
perf_analyzer_config = self._create_perf_analyzer_config(objectives)

if self._is_config_present_in_results(genai_perf_config, perf_analyzer_config):
if self._is_config_present_in_results(self._genai_perf_config, self._perf_analyzer_config):
self._found_config_in_checkpoint(
genai_perf_config, perf_analyzer_config, objectives
self._genai_perf_config, self._perf_analyzer_config, self._objectives
)
else:
# Pre-amble
self._create_tokenizer()
self._create_artifact_directory(perf_analyzer_config)
self._create_plot_directory(perf_analyzer_config)
self._generate_inputs(perf_analyzer_config)
self._create_artifact_directory(self._perf_analyzer_config)
self._create_plot_directory(self._perf_analyzer_config)
self._generate_inputs(self._perf_analyzer_config)

# Profile using Perf Analyzer
self._run_perf_analyzer(perf_analyzer_config)
self._run_perf_analyzer(self._perf_analyzer_config)

# Post-amble
self._set_data_parser(perf_analyzer_config)
self._set_data_parser(self._perf_analyzer_config)
self._add_results_to_checkpoint(
genai_perf_config, perf_analyzer_config, objectives
self._genai_perf_config, self._perf_analyzer_config, self._objectives
)
self._add_output_to_artifact_directory(perf_analyzer_config, objectives)
self._add_output_to_artifact_directory(self._perf_analyzer_config, self._objectives)

def create_plots(self) -> None:
# TMA-1911: support plots CLI option
plot_dir = self._config.output.artifact_directory / "plots"
plot_dir = self._perf_analyzer_config.get_artifact_directory() / "plots"
PlotConfigParser.create_init_yaml_config(
filenames=[self._config.output.profile_export_file], # single run
filenames=[self._perf_analyzer_config.get_profile_export_file()], # single run
output_dir=plot_dir,
)
config_parser = PlotConfigParser(plot_dir / "config.yaml")
Expand Down