Skip to content
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
34 changes: 34 additions & 0 deletions tests/integration/defs/perf/sampler_options_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -*- coding: utf-8 -*-
"""
Sampler options config for trtllm-bench perf tests
"""


def get_sampler_options_config(model_label: str) -> dict:
"""
Return the sampler options config corresponding to the model label.
Args:
model_label: model label from self._config.to_string()
Returns:
dict: sampler options config
"""
base_config = {
'top_k': 4,
'top_p': 0.5,
'temperature': 0.5,
}
return base_config
10 changes: 10 additions & 0 deletions tests/integration/defs/perf/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from ..conftest import get_llm_root, llm_models_root, trt_environment
from .pytorch_model_config import get_model_yaml_config
from .sampler_options_config import get_sampler_options_config
from .utils import (AbstractPerfScriptTestClass, PerfBenchScriptTestCmds,
PerfDisaggScriptTestCmds, PerfMetricType,
PerfServerClientBenchmarkCmds, generate_test_nodes)
Expand Down Expand Up @@ -1684,6 +1685,15 @@ def get_trtllm_bench_command(self, engine_dir):
benchmark_cmd += [
f"--extra_llm_api_options={autodeploy_config_path}"
]
# for sampler options
sampler_options_path = os.path.join(engine_dir, "sampler_options.yml")
if not os.path.exists(sampler_options_path):
os.makedirs(os.path.dirname(sampler_options_path), exist_ok=True)
sampler_config = get_sampler_options_config(self._config.to_string())
print_info(f"sampler options config: {sampler_config}")
with open(sampler_options_path, 'w') as f:
yaml.dump(sampler_config, f, default_flow_style=False)
benchmark_cmd += [f"--sampler_options={sampler_options_path}"]
return benchmark_cmd

def get_commands(self):
Expand Down