Skip to content

Commit

Permalink
Merge branch 'main' into dyas-precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
dyastremsky authored Aug 5, 2024
2 parents e9d91d7 + ceba73e commit b5f675a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 5 deletions.
63 changes: 63 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
BasedOnStyle: Google

IndentWidth: 2
ColumnLimit: 80
ContinuationIndentWidth: 4
UseTab: Never
MaxEmptyLinesToKeep: 2

SortIncludes: true
CompactNamespaces: true
ReflowComments: true

DerivePointerAlignment: false
PointerAlignment: Left

AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline

AlwaysBreakAfterReturnType: TopLevelDefinitions
AlignAfterOpenBracket: AlwaysBreak
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true

BinPackArguments: true
BinPackParameters: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false

IndentCaseLabels: true
2 changes: 1 addition & 1 deletion genai-perf/genai_perf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def create_plots(args: Namespace) -> None:
output_dir=plot_dir,
)
config_parser = PlotConfigParser(plot_dir / "config.yaml")
plot_configs = config_parser.generate_configs()
plot_configs = config_parser.generate_configs(args.tokenizer)
plot_manager = PlotManager(plot_configs)
plot_manager.generate_plots()

Expand Down
8 changes: 4 additions & 4 deletions genai-perf/genai_perf/plots/plot_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PlotConfigParser:
def __init__(self, filename: Path) -> None:
self._filename = filename

def generate_configs(self) -> List[PlotConfig]:
def generate_configs(self, tokenizer: str = DEFAULT_TOKENIZER) -> List[PlotConfig]:
"""Load YAML configuration file and convert to PlotConfigs."""
logger.info(
f"Generating plot configurations by parsing {self._filename}. "
Expand All @@ -61,7 +61,7 @@ def generate_configs(self) -> List[PlotConfig]:
# Collect profile run data
profile_data: List[ProfileRunData] = []
for filepath in config["paths"]:
stats = self._get_statistics(filepath)
stats = self._get_statistics(filepath, tokenizer)
profile_data.append(
ProfileRunData(
name=self._get_run_name(Path(filepath)),
Expand All @@ -85,11 +85,11 @@ def generate_configs(self) -> List[PlotConfig]:

return plot_configs

def _get_statistics(self, filepath: str) -> Statistics:
def _get_statistics(self, filepath: str, tokenizer: str) -> Statistics:
"""Extract a single profile run data."""
data_parser = LLMProfileDataParser(
filename=Path(filepath),
tokenizer=get_tokenizer(DEFAULT_TOKENIZER),
tokenizer=get_tokenizer(tokenizer),
)
load_info = data_parser.get_profile_load_info()

Expand Down

0 comments on commit b5f675a

Please sign in to comment.