From 008850209bc472ccc9636f9758e043937f110cbf Mon Sep 17 00:00:00 2001 From: Elias Bermudez <6505145+debermudez@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:46:59 -0700 Subject: [PATCH 1/5] Pass tokenizer to plot config parser (#22) * Pass tokenizer to plot config parser * Move tokenizer_arg to tokenizer --- genai-perf/genai_perf/main.py | 2 +- genai-perf/genai_perf/plots/plot_config_parser.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/genai-perf/genai_perf/main.py b/genai-perf/genai_perf/main.py index 9ff7b5b9..caf3e804 100755 --- a/genai-perf/genai_perf/main.py +++ b/genai-perf/genai_perf/main.py @@ -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() diff --git a/genai-perf/genai_perf/plots/plot_config_parser.py b/genai-perf/genai_perf/plots/plot_config_parser.py index 00588f6b..764f2e09 100755 --- a/genai-perf/genai_perf/plots/plot_config_parser.py +++ b/genai-perf/genai_perf/plots/plot_config_parser.py @@ -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}. " @@ -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)), @@ -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() From ceba73e4e053038aeb68747a82202632ec39bdc1 Mon Sep 17 00:00:00 2001 From: Matthew Kotila Date: Thu, 1 Aug 2024 11:41:34 -0700 Subject: [PATCH 2/5] Add .clang-format back (#24) --- .clang-format | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..268d81e8 --- /dev/null +++ b/.clang-format @@ -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 From 2b03b53fff2a07b43854a41a31eac6429984dc3d Mon Sep 17 00:00:00 2001 From: Meenakshi Sharma <163925564+nvda-mesharma@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:17:58 -0700 Subject: [PATCH 3/5] Create SECURITY.md --- SECURITY.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..7aa39f4e --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,44 @@ + + +# Report a Security Vulnerability + +To report a potential security vulnerability in any NVIDIA product, please use either: +* This web form: [Security Vulnerability Submission Form](https://www.nvidia.com/object/submit-security-vulnerability.html), or +* Send email to: [NVIDIA PSIRT](mailto:psirt@nvidia.com) + +**OEM Partners should contact their NVIDIA Customer Program Manager** + +If reporting a potential vulnerability via email, please encrypt it using NVIDIA’s public PGP key ([see PGP Key page](https://www.nvidia.com/en-us/security/pgp-key/)) and include the following information: +1. Product/Driver name and version/branch that contains the vulnerability +2. Type of vulnerability (code execution, denial of service, buffer overflow, etc.) +3. Instructions to reproduce the vulnerability +4. Proof-of-concept or exploit code +5. Potential impact of the vulnerability, including how an attacker could exploit the vulnerability + +See https://www.nvidia.com/en-us/security/ for past NVIDIA Security Bulletins and Notices. From fe5466a1b94c7bd948461bfaa617a72d095bed53 Mon Sep 17 00:00:00 2001 From: David Yastremsky <58150256+dyastremsky@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:49:17 -0700 Subject: [PATCH 4/5] Add code analysis hooks (#20) * Add precommit hooks --- .github/workflows/codeql.yml | 84 ++++++++++++++++++++++ .github/workflows/pre-commit.yml | 38 ++++++++++ .github/workflows/python-package-genai.yml | 60 ++++++++++++++++ .pre-commit-config.yaml | 80 +++++++++++++++++++++ pyproject.toml | 53 ++++++++++++++ src/client_backend/triton/CMakeLists.txt | 2 +- 6 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .github/workflows/python-package-genai.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..745a3373 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,84 @@ +# Copyright 2023, 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. + +name: "CodeQL" + +on: + pull_request: + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to: + # https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: +security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # Command-line programs to run using the OS shell. + # See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..ab4bd951 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,38 @@ +# Copyright 2023, 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. + +name: pre-commit + +on: + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/python-package-genai.yml b/.github/workflows/python-package-genai.yml new file mode 100644 index 00000000..88d3750a --- /dev/null +++ b/.github/workflows/python-package-genai.yml @@ -0,0 +1,60 @@ +# Copyright 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. + +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions for GenAI-Perf. +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package (GenAI-Perf) + +on: + pull_request: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-22.04"] + python-version: ["3.8", "3.10"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + cd genai-perf/ + python -m pip install --upgrade pip + python -m pip install -e . + python -c "import genai_perf; print(genai_perf.__version__)" + - name: Test with pytest + run: | + pip install pytest pytest-timeout pytest-cov psutil + cd genai-perf/tests + pytest --doctest-modules --junitxml=junit/test-results.xml --cov=genai_perf --cov-report=xml --cov-report=html --ignore-glob=test_models diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..fad9e819 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,80 @@ +# Copyright 2023, 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. + +repos: +- repo: https://github.com/timothycrosley/isort + rev: 5.12.0 + hooks: + - id: isort + additional_dependencies: [toml] +- repo: https://github.com/psf/black + rev: 24.4.0 + hooks: + - id: black + types_or: [python, cython] +- repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + args: [--max-line-length=88, --select=C,E,F,W,B,B950, --extend-ignore = E203,E501] + types_or: [python, cython] +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v16.0.5 + hooks: + - id: clang-format + types_or: [c, c++, cuda, proto, textproto, java] + args: ["-fallback-style=none", "-style=file", "-i"] +- repo: https://github.com/codespell-project/codespell + rev: v2.2.4 + hooks: + - id: codespell + additional_dependencies: [tomli] + args: ["--toml", "pyproject.toml"] + exclude: (?x)^(.*stemmer.*|.*stop_words.*|^CHANGELOG.md$) +# More details about these pre-commit hooks here: +# https://pre-commit.com/hooks.html +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-json + - id: check-toml + - id: check-yaml + - id: check-shebang-scripts-are-executable + - id: end-of-file-fixer + types_or: [c, c++, cuda, proto, textproto, java, python] + - id: mixed-line-ending + - id: requirements-txt-fixer + - id: trailing-whitespace + +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.9.0 + hooks: + - id: mypy + types_or: [python, cython] + additional_dependencies: [tokenize-rt==3.2.0, types-requests] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c37b79b1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,53 @@ +# Copyright 2023, 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. + +[tool.codespell] +# note: pre-commit passes explicit lists of files here, which this skip file list doesn't override - +# this is only to allow you to run codespell interactively +# this also overrides the grpc_generated folder, since it is generated +skip = "./.git,./.github" +# ignore short words, and typename parameters like OffsetT +ignore-regex = "\\b(.{1,4}|[A-Z]\\w*T)\\b" +# ignore allowed words +# ignoring atleast to avoid testing::AtLeast from getting flagged +ignore-words-list = "atleast" +# use the 'clear' dictionary for unambiguous spelling mistakes +builtin = "clear" +# disable warnings about binary files and wrong encoding +quiet-level = 3 + +[tool.isort] +profile = "black" +use_parentheses = true +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +ensure_newline_before_comments = true +line_length = 88 +balanced_wrapping = true +indent = " " +skip = ["build"] + diff --git a/src/client_backend/triton/CMakeLists.txt b/src/client_backend/triton/CMakeLists.txt index c299cf89..4b2714e7 100644 --- a/src/client_backend/triton/CMakeLists.txt +++ b/src/client_backend/triton/CMakeLists.txt @@ -59,7 +59,7 @@ target_include_directories( target_link_directories( triton-client-backend-library PUBLIC - ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib ) target_link_libraries( From 7ced23f8652b8d21f3de21d59065abd9fd91e036 Mon Sep 17 00:00:00 2001 From: David Yastremsky <58150256+dyastremsky@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:36:00 -0700 Subject: [PATCH 5/5] Print models being profiled (#29) --- genai-perf/genai_perf/parser.py | 7 +++---- genai-perf/tests/test_cli.py | 13 +------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/genai-perf/genai_perf/parser.py b/genai-perf/genai_perf/parser.py index bae4c516..60994f29 100644 --- a/genai-perf/genai_perf/parser.py +++ b/genai-perf/genai_perf/parser.py @@ -85,10 +85,9 @@ def _check_model_args( parser: argparse.ArgumentParser, args: argparse.Namespace ) -> argparse.Namespace: """ - Check if model name is provided. + Check arguments associated with the model and apply any necessary formatting. """ - if not args.model: - parser.error("The -m/--model option is required and cannot be empty.") + logger.info(f"Profiling these models: {', '.join(args.model)}") args = _convert_str_to_enum_entry( args, "model_selection_strategy", ModelSelectionStrategy ) @@ -532,7 +531,7 @@ def _add_endpoint_args(parser): "-m", "--model", nargs="+", - default=[], + required=True, help=f"The name of the model(s) to benchmark.", ) endpoint_group.add_argument( diff --git a/genai-perf/tests/test_cli.py b/genai-perf/tests/test_cli.py index 2ef5d52b..b88a050e 100644 --- a/genai-perf/tests/test_cli.py +++ b/genai-perf/tests/test_cli.py @@ -250,9 +250,6 @@ def test_non_file_flags_parsed(self, monkeypatch, arg, expected_attributes, caps for key, value in expected_attributes.items(): assert getattr(args, key) == value - # Check that nothing was printed as a byproduct of parsing the arguments - captured = capsys.readouterr() - assert captured.out == "" @pytest.mark.parametrize( "models, expected_model_list, formatted_name", @@ -295,10 +292,6 @@ def test_multiple_model_args( for key, value in formatted_name.items(): assert getattr(args, key) == value - # Check that nothing was printed as a byproduct of parsing the arguments - captured = capsys.readouterr() - assert captured.out == "" - def test_file_flags_parsed(self, monkeypatch, mocker): _ = mocker.patch("os.path.isfile", return_value=True) combined_args = [ @@ -362,8 +355,6 @@ def test_default_profile_export_filepath( args, _ = parser.parse_args() assert args.artifact_dir == Path(expected_path) - captured = capsys.readouterr() - assert captured.out == "" @pytest.mark.parametrize( "arg, expected_path, expected_output", @@ -412,8 +403,6 @@ def test_default_load_level(self, monkeypatch, capsys): ) args, _ = parser.parse_args() assert args.concurrency == 1 - captured = capsys.readouterr() - assert captured.out == "" def test_load_level_mutually_exclusive(self, monkeypatch, capsys): monkeypatch.setattr( @@ -433,7 +422,7 @@ def test_load_level_mutually_exclusive(self, monkeypatch, capsys): def test_model_not_provided(self, monkeypatch, capsys): monkeypatch.setattr("sys.argv", ["genai-perf", "profile"]) - expected_output = "The -m/--model option is required and cannot be empty." + expected_output = "the following arguments are required: -m/--model" with pytest.raises(SystemExit) as excinfo: parser.parse_args()