triton-model-analyzer 1.48.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- model_analyzer/__init__.py +15 -0
- model_analyzer/analyzer.py +448 -0
- model_analyzer/cli/__init__.py +15 -0
- model_analyzer/cli/cli.py +193 -0
- model_analyzer/config/__init__.py +15 -0
- model_analyzer/config/generate/__init__.py +15 -0
- model_analyzer/config/generate/automatic_model_config_generator.py +164 -0
- model_analyzer/config/generate/base_model_config_generator.py +352 -0
- model_analyzer/config/generate/brute_plus_binary_parameter_search_run_config_generator.py +164 -0
- model_analyzer/config/generate/brute_run_config_generator.py +154 -0
- model_analyzer/config/generate/concurrency_sweeper.py +75 -0
- model_analyzer/config/generate/config_generator_interface.py +52 -0
- model_analyzer/config/generate/coordinate.py +143 -0
- model_analyzer/config/generate/coordinate_data.py +86 -0
- model_analyzer/config/generate/generator_utils.py +116 -0
- model_analyzer/config/generate/manual_model_config_generator.py +187 -0
- model_analyzer/config/generate/model_config_generator_factory.py +92 -0
- model_analyzer/config/generate/model_profile_spec.py +74 -0
- model_analyzer/config/generate/model_run_config_generator.py +154 -0
- model_analyzer/config/generate/model_variant_name_manager.py +150 -0
- model_analyzer/config/generate/neighborhood.py +536 -0
- model_analyzer/config/generate/optuna_plus_concurrency_sweep_run_config_generator.py +141 -0
- model_analyzer/config/generate/optuna_run_config_generator.py +838 -0
- model_analyzer/config/generate/perf_analyzer_config_generator.py +312 -0
- model_analyzer/config/generate/quick_plus_concurrency_sweep_run_config_generator.py +130 -0
- model_analyzer/config/generate/quick_run_config_generator.py +753 -0
- model_analyzer/config/generate/run_config_generator_factory.py +329 -0
- model_analyzer/config/generate/search_config.py +112 -0
- model_analyzer/config/generate/search_dimension.py +73 -0
- model_analyzer/config/generate/search_dimensions.py +85 -0
- model_analyzer/config/generate/search_parameter.py +49 -0
- model_analyzer/config/generate/search_parameters.py +388 -0
- model_analyzer/config/input/__init__.py +15 -0
- model_analyzer/config/input/config_command.py +483 -0
- model_analyzer/config/input/config_command_profile.py +1747 -0
- model_analyzer/config/input/config_command_report.py +267 -0
- model_analyzer/config/input/config_defaults.py +236 -0
- model_analyzer/config/input/config_enum.py +83 -0
- model_analyzer/config/input/config_field.py +216 -0
- model_analyzer/config/input/config_list_generic.py +112 -0
- model_analyzer/config/input/config_list_numeric.py +151 -0
- model_analyzer/config/input/config_list_string.py +111 -0
- model_analyzer/config/input/config_none.py +71 -0
- model_analyzer/config/input/config_object.py +129 -0
- model_analyzer/config/input/config_primitive.py +81 -0
- model_analyzer/config/input/config_status.py +75 -0
- model_analyzer/config/input/config_sweep.py +83 -0
- model_analyzer/config/input/config_union.py +113 -0
- model_analyzer/config/input/config_utils.py +128 -0
- model_analyzer/config/input/config_value.py +243 -0
- model_analyzer/config/input/objects/__init__.py +15 -0
- model_analyzer/config/input/objects/config_model_profile_spec.py +325 -0
- model_analyzer/config/input/objects/config_model_report_spec.py +173 -0
- model_analyzer/config/input/objects/config_plot.py +198 -0
- model_analyzer/config/input/objects/config_protobuf_utils.py +101 -0
- model_analyzer/config/input/yaml_config_validator.py +82 -0
- model_analyzer/config/run/__init__.py +15 -0
- model_analyzer/config/run/model_run_config.py +313 -0
- model_analyzer/config/run/run_config.py +168 -0
- model_analyzer/constants.py +76 -0
- model_analyzer/device/__init__.py +15 -0
- model_analyzer/device/device.py +24 -0
- model_analyzer/device/gpu_device.py +87 -0
- model_analyzer/device/gpu_device_factory.py +248 -0
- model_analyzer/entrypoint.py +307 -0
- model_analyzer/log_formatter.py +65 -0
- model_analyzer/model_analyzer_exceptions.py +24 -0
- model_analyzer/model_manager.py +255 -0
- model_analyzer/monitor/__init__.py +15 -0
- model_analyzer/monitor/cpu_monitor.py +69 -0
- model_analyzer/monitor/dcgm/DcgmDiag.py +191 -0
- model_analyzer/monitor/dcgm/DcgmFieldGroup.py +83 -0
- model_analyzer/monitor/dcgm/DcgmGroup.py +815 -0
- model_analyzer/monitor/dcgm/DcgmHandle.py +141 -0
- model_analyzer/monitor/dcgm/DcgmJsonReader.py +69 -0
- model_analyzer/monitor/dcgm/DcgmReader.py +623 -0
- model_analyzer/monitor/dcgm/DcgmStatus.py +57 -0
- model_analyzer/monitor/dcgm/DcgmSystem.py +412 -0
- model_analyzer/monitor/dcgm/__init__.py +15 -0
- model_analyzer/monitor/dcgm/common/__init__.py +13 -0
- model_analyzer/monitor/dcgm/common/dcgm_client_cli_parser.py +194 -0
- model_analyzer/monitor/dcgm/common/dcgm_client_main.py +86 -0
- model_analyzer/monitor/dcgm/dcgm_agent.py +887 -0
- model_analyzer/monitor/dcgm/dcgm_collectd_plugin.py +369 -0
- model_analyzer/monitor/dcgm/dcgm_errors.py +395 -0
- model_analyzer/monitor/dcgm/dcgm_field_helpers.py +546 -0
- model_analyzer/monitor/dcgm/dcgm_fields.py +815 -0
- model_analyzer/monitor/dcgm/dcgm_fields_collectd.py +671 -0
- model_analyzer/monitor/dcgm/dcgm_fields_internal.py +29 -0
- model_analyzer/monitor/dcgm/dcgm_fluentd.py +45 -0
- model_analyzer/monitor/dcgm/dcgm_monitor.py +138 -0
- model_analyzer/monitor/dcgm/dcgm_prometheus.py +326 -0
- model_analyzer/monitor/dcgm/dcgm_structs.py +2357 -0
- model_analyzer/monitor/dcgm/dcgm_telegraf.py +65 -0
- model_analyzer/monitor/dcgm/dcgm_value.py +151 -0
- model_analyzer/monitor/dcgm/dcgmvalue.py +155 -0
- model_analyzer/monitor/dcgm/denylist_recommendations.py +573 -0
- model_analyzer/monitor/dcgm/pydcgm.py +47 -0
- model_analyzer/monitor/monitor.py +143 -0
- model_analyzer/monitor/remote_monitor.py +137 -0
- model_analyzer/output/__init__.py +15 -0
- model_analyzer/output/file_writer.py +63 -0
- model_analyzer/output/output_writer.py +42 -0
- model_analyzer/perf_analyzer/__init__.py +15 -0
- model_analyzer/perf_analyzer/genai_perf_config.py +206 -0
- model_analyzer/perf_analyzer/perf_analyzer.py +882 -0
- model_analyzer/perf_analyzer/perf_config.py +479 -0
- model_analyzer/plots/__init__.py +15 -0
- model_analyzer/plots/detailed_plot.py +266 -0
- model_analyzer/plots/plot_manager.py +224 -0
- model_analyzer/plots/simple_plot.py +213 -0
- model_analyzer/record/__init__.py +15 -0
- model_analyzer/record/gpu_record.py +68 -0
- model_analyzer/record/metrics_manager.py +887 -0
- model_analyzer/record/record.py +280 -0
- model_analyzer/record/record_aggregator.py +256 -0
- model_analyzer/record/types/__init__.py +15 -0
- model_analyzer/record/types/cpu_available_ram.py +93 -0
- model_analyzer/record/types/cpu_used_ram.py +93 -0
- model_analyzer/record/types/gpu_free_memory.py +96 -0
- model_analyzer/record/types/gpu_power_usage.py +107 -0
- model_analyzer/record/types/gpu_total_memory.py +96 -0
- model_analyzer/record/types/gpu_used_memory.py +96 -0
- model_analyzer/record/types/gpu_utilization.py +108 -0
- model_analyzer/record/types/inter_token_latency_avg.py +60 -0
- model_analyzer/record/types/inter_token_latency_base.py +74 -0
- model_analyzer/record/types/inter_token_latency_max.py +60 -0
- model_analyzer/record/types/inter_token_latency_min.py +60 -0
- model_analyzer/record/types/inter_token_latency_p25.py +60 -0
- model_analyzer/record/types/inter_token_latency_p50.py +60 -0
- model_analyzer/record/types/inter_token_latency_p75.py +60 -0
- model_analyzer/record/types/inter_token_latency_p90.py +60 -0
- model_analyzer/record/types/inter_token_latency_p95.py +60 -0
- model_analyzer/record/types/inter_token_latency_p99.py +60 -0
- model_analyzer/record/types/output_token_throughput.py +105 -0
- model_analyzer/record/types/perf_client_response_wait.py +97 -0
- model_analyzer/record/types/perf_client_send_recv.py +97 -0
- model_analyzer/record/types/perf_latency.py +111 -0
- model_analyzer/record/types/perf_latency_avg.py +60 -0
- model_analyzer/record/types/perf_latency_base.py +74 -0
- model_analyzer/record/types/perf_latency_p90.py +60 -0
- model_analyzer/record/types/perf_latency_p95.py +60 -0
- model_analyzer/record/types/perf_latency_p99.py +60 -0
- model_analyzer/record/types/perf_server_compute_infer.py +97 -0
- model_analyzer/record/types/perf_server_compute_input.py +97 -0
- model_analyzer/record/types/perf_server_compute_output.py +97 -0
- model_analyzer/record/types/perf_server_queue.py +97 -0
- model_analyzer/record/types/perf_throughput.py +105 -0
- model_analyzer/record/types/time_to_first_token_avg.py +60 -0
- model_analyzer/record/types/time_to_first_token_base.py +74 -0
- model_analyzer/record/types/time_to_first_token_max.py +60 -0
- model_analyzer/record/types/time_to_first_token_min.py +60 -0
- model_analyzer/record/types/time_to_first_token_p25.py +60 -0
- model_analyzer/record/types/time_to_first_token_p50.py +60 -0
- model_analyzer/record/types/time_to_first_token_p75.py +60 -0
- model_analyzer/record/types/time_to_first_token_p90.py +60 -0
- model_analyzer/record/types/time_to_first_token_p95.py +60 -0
- model_analyzer/record/types/time_to_first_token_p99.py +60 -0
- model_analyzer/reports/__init__.py +15 -0
- model_analyzer/reports/html_report.py +195 -0
- model_analyzer/reports/pdf_report.py +50 -0
- model_analyzer/reports/report.py +86 -0
- model_analyzer/reports/report_factory.py +62 -0
- model_analyzer/reports/report_manager.py +1376 -0
- model_analyzer/reports/report_utils.py +42 -0
- model_analyzer/result/__init__.py +15 -0
- model_analyzer/result/constraint_manager.py +150 -0
- model_analyzer/result/model_config_measurement.py +354 -0
- model_analyzer/result/model_constraints.py +105 -0
- model_analyzer/result/parameter_search.py +246 -0
- model_analyzer/result/result_manager.py +430 -0
- model_analyzer/result/result_statistics.py +159 -0
- model_analyzer/result/result_table.py +217 -0
- model_analyzer/result/result_table_manager.py +646 -0
- model_analyzer/result/result_utils.py +42 -0
- model_analyzer/result/results.py +277 -0
- model_analyzer/result/run_config_measurement.py +658 -0
- model_analyzer/result/run_config_result.py +210 -0
- model_analyzer/result/run_config_result_comparator.py +110 -0
- model_analyzer/result/sorted_results.py +151 -0
- model_analyzer/state/__init__.py +15 -0
- model_analyzer/state/analyzer_state.py +76 -0
- model_analyzer/state/analyzer_state_manager.py +215 -0
- model_analyzer/triton/__init__.py +15 -0
- model_analyzer/triton/client/__init__.py +15 -0
- model_analyzer/triton/client/client.py +234 -0
- model_analyzer/triton/client/client_factory.py +57 -0
- model_analyzer/triton/client/grpc_client.py +104 -0
- model_analyzer/triton/client/http_client.py +107 -0
- model_analyzer/triton/model/__init__.py +15 -0
- model_analyzer/triton/model/model_config.py +556 -0
- model_analyzer/triton/model/model_config_variant.py +29 -0
- model_analyzer/triton/server/__init__.py +15 -0
- model_analyzer/triton/server/server.py +76 -0
- model_analyzer/triton/server/server_config.py +269 -0
- model_analyzer/triton/server/server_docker.py +229 -0
- model_analyzer/triton/server/server_factory.py +306 -0
- model_analyzer/triton/server/server_local.py +158 -0
- triton_model_analyzer-1.48.0.dist-info/METADATA +52 -0
- triton_model_analyzer-1.48.0.dist-info/RECORD +204 -0
- triton_model_analyzer-1.48.0.dist-info/WHEEL +5 -0
- triton_model_analyzer-1.48.0.dist-info/entry_points.txt +2 -0
- triton_model_analyzer-1.48.0.dist-info/licenses/LICENSE +67 -0
- triton_model_analyzer-1.48.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
# Copyright 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
from argparse import Namespace
|
|
18
|
+
from copy import deepcopy
|
|
19
|
+
from typing import Any, Dict, List, Optional, Union
|
|
20
|
+
|
|
21
|
+
import yaml
|
|
22
|
+
|
|
23
|
+
from model_analyzer.config.generate.generator_utils import GeneratorUtils
|
|
24
|
+
from model_analyzer.model_analyzer_exceptions import TritonModelAnalyzerException
|
|
25
|
+
|
|
26
|
+
from .yaml_config_validator import YamlConfigValidator
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ConfigCommand:
|
|
30
|
+
"""
|
|
31
|
+
Model Analyzer config object.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __init__(self):
|
|
35
|
+
"""
|
|
36
|
+
Create a new config.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
self._fields = {}
|
|
40
|
+
|
|
41
|
+
def _add_config(self, config_field):
|
|
42
|
+
"""
|
|
43
|
+
Add a new config field.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
config_field : ConfigField
|
|
48
|
+
Config field to be added
|
|
49
|
+
|
|
50
|
+
Raises
|
|
51
|
+
------
|
|
52
|
+
KeyError
|
|
53
|
+
If the field already exists, it will raise this exception.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
if config_field.name() not in self._fields:
|
|
57
|
+
self._fields[config_field.name()] = config_field
|
|
58
|
+
else:
|
|
59
|
+
raise KeyError
|
|
60
|
+
|
|
61
|
+
def _fill_config(self):
|
|
62
|
+
"""
|
|
63
|
+
Makes calls to _add_config,
|
|
64
|
+
must be overloaded by subclass
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
raise NotImplementedError
|
|
68
|
+
|
|
69
|
+
def _load_config_file(self, file_path):
|
|
70
|
+
"""
|
|
71
|
+
Load YAML config
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
file_path : str
|
|
76
|
+
Path to the Model Analyzer config file
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
with open(file_path, "r") as config_file:
|
|
80
|
+
config = yaml.safe_load(config_file)
|
|
81
|
+
return config
|
|
82
|
+
|
|
83
|
+
def set_config_values(self, args: Namespace) -> None:
|
|
84
|
+
"""
|
|
85
|
+
Set the config values. This function sets all the values for the
|
|
86
|
+
config. CLI arguments have the highest priority, then YAML config
|
|
87
|
+
values and then default values.
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
args : argparse.Namespace
|
|
92
|
+
Parsed arguments from the CLI
|
|
93
|
+
|
|
94
|
+
Raises
|
|
95
|
+
------
|
|
96
|
+
TritonModelAnalyzerException
|
|
97
|
+
If the required fields are not specified, it will raise
|
|
98
|
+
this exception
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
yaml_config = self._load_yaml_config(args)
|
|
102
|
+
self._check_for_illegal_config_settings(args, yaml_config)
|
|
103
|
+
self._set_field_values(args, yaml_config)
|
|
104
|
+
self._preprocess_and_verify_arguments()
|
|
105
|
+
self._autofill_values()
|
|
106
|
+
|
|
107
|
+
# This is done after the model(s) are populated so that we
|
|
108
|
+
# can easily count the parameter combinations
|
|
109
|
+
self._check_quick_search_model_config_parameters_combinations()
|
|
110
|
+
|
|
111
|
+
def _load_yaml_config(self, args: Namespace) -> Optional[Dict[str, List]]:
|
|
112
|
+
if "config_file" in args:
|
|
113
|
+
yaml_config = self._load_config_file(args.config_file)
|
|
114
|
+
YamlConfigValidator.validate(yaml_config)
|
|
115
|
+
else:
|
|
116
|
+
yaml_config = None
|
|
117
|
+
|
|
118
|
+
return yaml_config
|
|
119
|
+
|
|
120
|
+
def _check_for_illegal_config_settings(
|
|
121
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
122
|
+
) -> None:
|
|
123
|
+
# Note: Illegal config settings check for ensemble is done in model_manager,
|
|
124
|
+
# since we don't yet know the type of model being profiled
|
|
125
|
+
|
|
126
|
+
self._check_for_duplicate_profile_models_option(args, yaml_config)
|
|
127
|
+
self._check_for_multi_model_incompatibility(args, yaml_config)
|
|
128
|
+
self._check_for_quick_search_incompatibility(args, yaml_config)
|
|
129
|
+
self._check_for_bls_incompatibility(args, yaml_config)
|
|
130
|
+
self._check_for_concurrency_rate_request_conflicts(args, yaml_config)
|
|
131
|
+
self._check_for_config_search_rate_request_conflicts(args, yaml_config)
|
|
132
|
+
self._check_for_dcgm_disable_launch_mode_conflict(args, yaml_config)
|
|
133
|
+
|
|
134
|
+
def _set_field_values(
|
|
135
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
136
|
+
) -> None:
|
|
137
|
+
for key, value in self._fields.items():
|
|
138
|
+
self._fields[key].set_name(key)
|
|
139
|
+
config_value = self._get_config_value(key, args, yaml_config)
|
|
140
|
+
|
|
141
|
+
if config_value:
|
|
142
|
+
self._fields[key].set_value(config_value, is_set_by_config=True)
|
|
143
|
+
elif value.default_value() is not None:
|
|
144
|
+
self._fields[key].set_value(
|
|
145
|
+
value.default_value(), is_set_by_config=False
|
|
146
|
+
)
|
|
147
|
+
elif value.required():
|
|
148
|
+
flags = ", ".join(value.flags())
|
|
149
|
+
raise TritonModelAnalyzerException(
|
|
150
|
+
f"Config for {value.name()} is not specified. You need to specify it using the YAML config file or using the {flags} flags in CLI."
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def _get_config_value(
|
|
154
|
+
self, key: str, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
155
|
+
) -> Optional[Any]:
|
|
156
|
+
if key in args:
|
|
157
|
+
return getattr(args, key)
|
|
158
|
+
elif yaml_config is not None and key in yaml_config:
|
|
159
|
+
return yaml_config[key]
|
|
160
|
+
else:
|
|
161
|
+
return None
|
|
162
|
+
|
|
163
|
+
def _check_for_duplicate_profile_models_option(
|
|
164
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
165
|
+
) -> None:
|
|
166
|
+
key_in_args = "profile_models" in args
|
|
167
|
+
key_in_yaml = yaml_config is not None and "profile_models" in yaml_config
|
|
168
|
+
|
|
169
|
+
if key_in_args and key_in_yaml:
|
|
170
|
+
raise TritonModelAnalyzerException(
|
|
171
|
+
f"\n The profile model option is specified on both "
|
|
172
|
+
"the CLI (--profile-models) and in the YAML config file."
|
|
173
|
+
"\n Please remove the option from one of the locations and try again"
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def _check_for_multi_model_incompatibility(
|
|
177
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
178
|
+
) -> None:
|
|
179
|
+
if not self._get_config_value(
|
|
180
|
+
"run_config_profile_models_concurrently_enable", args, yaml_config
|
|
181
|
+
):
|
|
182
|
+
return
|
|
183
|
+
|
|
184
|
+
self._check_multi_model_search_mode_incompatibility(args, yaml_config)
|
|
185
|
+
|
|
186
|
+
def _check_multi_model_search_mode_incompatibility(
|
|
187
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
188
|
+
) -> None:
|
|
189
|
+
if (
|
|
190
|
+
self._get_config_value("run_config_search_mode", args, yaml_config)
|
|
191
|
+
== "brute"
|
|
192
|
+
):
|
|
193
|
+
raise TritonModelAnalyzerException(
|
|
194
|
+
f"\nConcurrent profiling of models not supported in brute search mode."
|
|
195
|
+
"\nPlease use quick search mode (`--run-config-search-mode quick`) or disable concurrent model profiling."
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
def _check_for_quick_search_incompatibility(
|
|
199
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
200
|
+
) -> None:
|
|
201
|
+
if (
|
|
202
|
+
self._get_config_value("run_config_search_mode", args, yaml_config)
|
|
203
|
+
!= "quick"
|
|
204
|
+
):
|
|
205
|
+
return
|
|
206
|
+
|
|
207
|
+
self._check_quick_search_no_search_disable(args, yaml_config)
|
|
208
|
+
self._check_quick_search_no_global_list_values(args, yaml_config)
|
|
209
|
+
self._check_quick_search_no_per_model_list_values(args, yaml_config)
|
|
210
|
+
|
|
211
|
+
def _check_for_bls_incompatibility(
|
|
212
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
213
|
+
) -> None:
|
|
214
|
+
if not self._get_config_value("bls_composing_models", args, yaml_config):
|
|
215
|
+
return
|
|
216
|
+
|
|
217
|
+
self._check_bls_no_brute_search(args, yaml_config)
|
|
218
|
+
self._check_bls_no_multi_model(args, yaml_config)
|
|
219
|
+
self._check_bls_no_concurrent_search(args, yaml_config)
|
|
220
|
+
|
|
221
|
+
def _check_quick_search_no_search_disable(
|
|
222
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
223
|
+
) -> None:
|
|
224
|
+
if self._get_config_value("run_config_search_disable", args, yaml_config):
|
|
225
|
+
raise TritonModelAnalyzerException(
|
|
226
|
+
f"\nDisabling of run config search is not supported in quick search mode."
|
|
227
|
+
"\nPlease use brute search mode or remove --run-config-search-disable."
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
def _check_quick_search_no_global_list_values(
|
|
231
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
232
|
+
) -> None:
|
|
233
|
+
concurrency = self._get_config_value("concurrency", args, yaml_config)
|
|
234
|
+
batch_sizes = self._get_config_value("batch_sizes", args, yaml_config)
|
|
235
|
+
|
|
236
|
+
if concurrency or batch_sizes:
|
|
237
|
+
raise TritonModelAnalyzerException(
|
|
238
|
+
f"\nProfiling of models in quick search mode is not supported with lists of concurrencies or batch sizes."
|
|
239
|
+
"\nPlease use brute search mode or remove concurrency/batch sizes list."
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
def _check_quick_search_no_per_model_list_values(
|
|
243
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
244
|
+
) -> None:
|
|
245
|
+
profile_models = self._get_config_value("profile_models", args, yaml_config)
|
|
246
|
+
|
|
247
|
+
if (
|
|
248
|
+
not profile_models
|
|
249
|
+
or type(profile_models) is str
|
|
250
|
+
or type(profile_models) is list
|
|
251
|
+
):
|
|
252
|
+
return
|
|
253
|
+
|
|
254
|
+
self._check_per_model_parameters(profile_models)
|
|
255
|
+
self._check_per_model_model_config_parameters(profile_models)
|
|
256
|
+
|
|
257
|
+
def _check_per_model_parameters(self, profile_models: Dict) -> None:
|
|
258
|
+
for model in profile_models.values():
|
|
259
|
+
if not "parameters" in model:
|
|
260
|
+
continue
|
|
261
|
+
|
|
262
|
+
if (
|
|
263
|
+
"concurrency" in model["parameters"]
|
|
264
|
+
or "batch size" in model["parameters"]
|
|
265
|
+
):
|
|
266
|
+
raise TritonModelAnalyzerException(
|
|
267
|
+
f"\nProfiling of models in quick search mode is not supported with lists of concurrencies or batch sizes."
|
|
268
|
+
"\nPlease use brute search mode or remove concurrency/batch sizes list."
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
def _check_per_model_model_config_parameters(self, profile_models: Dict) -> None:
|
|
272
|
+
for model in profile_models.values():
|
|
273
|
+
if not "model_config_parameters" in model:
|
|
274
|
+
continue
|
|
275
|
+
|
|
276
|
+
if "max_batch_size" in model["model_config_parameters"]:
|
|
277
|
+
raise TritonModelAnalyzerException(
|
|
278
|
+
f"\nProfiling of models in quick search mode is not supported with lists of max batch sizes."
|
|
279
|
+
"\nPlease use brute search mode or remove max batch size list."
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
if "instance_group" in model["model_config_parameters"]:
|
|
283
|
+
raise TritonModelAnalyzerException(
|
|
284
|
+
f"\nProfiling of models in quick search mode is not supported with instance group as a model config parameter"
|
|
285
|
+
"\nPlease use brute search mode or remove instance_group from 'model_config_parameters'."
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
def _check_quick_search_model_config_parameters_combinations(self) -> None:
|
|
289
|
+
config = self.get_config()
|
|
290
|
+
if not "profile_models" in config:
|
|
291
|
+
return
|
|
292
|
+
|
|
293
|
+
if config["run_config_search_mode"].value() != "quick":
|
|
294
|
+
return
|
|
295
|
+
|
|
296
|
+
profile_models = config["profile_models"].value()
|
|
297
|
+
for model in profile_models:
|
|
298
|
+
model_config_params = deepcopy(model.model_config_parameters())
|
|
299
|
+
if model_config_params:
|
|
300
|
+
if len(GeneratorUtils.generate_combinations(model_config_params)) > 1:
|
|
301
|
+
raise TritonModelAnalyzerException(
|
|
302
|
+
f"\nProfiling of models in quick search mode is not supported for the specified model config parameters, "
|
|
303
|
+
f"as more than one combination of parameters can be generated."
|
|
304
|
+
f"\nPlease use brute search mode to profile or remove the model config parameters specified."
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
def _check_bls_no_brute_search(
|
|
308
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
309
|
+
) -> None:
|
|
310
|
+
if (
|
|
311
|
+
self._get_config_value("run_config_search_mode", args, yaml_config)
|
|
312
|
+
== "brute"
|
|
313
|
+
):
|
|
314
|
+
raise TritonModelAnalyzerException(
|
|
315
|
+
f"\nProfiling of models in brute search mode is not supported for BLS models."
|
|
316
|
+
"\nPlease use quick search mode."
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
def _check_bls_no_multi_model(
|
|
320
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
321
|
+
) -> None:
|
|
322
|
+
profile_models: Union[Dict, List, str] = self._get_config_value(
|
|
323
|
+
"profile_models", args, yaml_config
|
|
324
|
+
) # type: ignore
|
|
325
|
+
|
|
326
|
+
profile_model_count = (
|
|
327
|
+
len(profile_models.split(","))
|
|
328
|
+
if isinstance(profile_models, str)
|
|
329
|
+
else len(profile_models)
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
if profile_model_count > 1:
|
|
333
|
+
raise TritonModelAnalyzerException(
|
|
334
|
+
f"\nProfiling of multiple models is not supported for BLS models."
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
def _check_bls_no_concurrent_search(
|
|
338
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
339
|
+
) -> None:
|
|
340
|
+
if self._get_config_value(
|
|
341
|
+
"run_config_profile_models_concurrently_enable", args, yaml_config
|
|
342
|
+
):
|
|
343
|
+
raise TritonModelAnalyzerException(
|
|
344
|
+
f"\nProfiling models concurrently is not supported for BLS models."
|
|
345
|
+
"\nPlease remove `--run-config-profile-models-concurrently-enable from the config/CLI."
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
def _check_for_concurrency_rate_request_conflicts(
|
|
349
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
350
|
+
) -> None:
|
|
351
|
+
if self._get_config_value("concurrency", args, yaml_config):
|
|
352
|
+
if self._get_config_value("request_rate_search_enable", args, yaml_config):
|
|
353
|
+
raise TritonModelAnalyzerException(
|
|
354
|
+
f"\nCannot have both `request-rate-search-enable` and `concurrency` specified in the config/CLI."
|
|
355
|
+
)
|
|
356
|
+
elif self._get_config_value("request_rate", args, yaml_config):
|
|
357
|
+
raise TritonModelAnalyzerException(
|
|
358
|
+
f"\nCannot have both `request-rate` and `concurrency` specified in the config/CLI."
|
|
359
|
+
)
|
|
360
|
+
elif self._get_config_value(
|
|
361
|
+
"run_config_search_min_request_rate", args, yaml_config
|
|
362
|
+
):
|
|
363
|
+
raise TritonModelAnalyzerException(
|
|
364
|
+
f"\nCannot have both `run-config-search-min-request-rate` and `concurrency` specified in the config/CLI."
|
|
365
|
+
)
|
|
366
|
+
elif self._get_config_value(
|
|
367
|
+
"run_config_search_max_request_rate", args, yaml_config
|
|
368
|
+
):
|
|
369
|
+
raise TritonModelAnalyzerException(
|
|
370
|
+
f"\nCannot have both `run-config-search-max-request-rate` and `concurrency` specified in the config/CLI."
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
def _check_for_config_search_rate_request_conflicts(
|
|
374
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
375
|
+
) -> None:
|
|
376
|
+
if self._get_config_value(
|
|
377
|
+
"run_config_search_max_concurrency", args, yaml_config
|
|
378
|
+
) or self._get_config_value(
|
|
379
|
+
"run_config_search_min_concurrency", args, yaml_config
|
|
380
|
+
):
|
|
381
|
+
if self._get_config_value("request_rate_search_enable", args, yaml_config):
|
|
382
|
+
raise TritonModelAnalyzerException(
|
|
383
|
+
f"\nCannot have both `request-rate-search-enable` and `run-config-search-min/max-concurrency` specified in the config/CLI."
|
|
384
|
+
)
|
|
385
|
+
elif self._get_config_value("request_rate", args, yaml_config):
|
|
386
|
+
raise TritonModelAnalyzerException(
|
|
387
|
+
f"\nCannot have both `request-rate` and `run-config-search-min/max-concurrency` specified in the config/CLI."
|
|
388
|
+
)
|
|
389
|
+
elif self._get_config_value(
|
|
390
|
+
"run_config_search_min_request_rate", args, yaml_config
|
|
391
|
+
):
|
|
392
|
+
raise TritonModelAnalyzerException(
|
|
393
|
+
f"\nCannot have both `run-config-search-min-request-rate` and `run-config-search-min/max-concurrency` specified in the config/CLI."
|
|
394
|
+
)
|
|
395
|
+
elif self._get_config_value(
|
|
396
|
+
"run_config_search_max_request_rate", args, yaml_config
|
|
397
|
+
):
|
|
398
|
+
raise TritonModelAnalyzerException(
|
|
399
|
+
f"\nCannot have both `run-config-search-max-request-rate` and `run-config-search-min/max-concurrency` specified in the config/CLI."
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
def _check_for_dcgm_disable_launch_mode_conflict(
|
|
403
|
+
self, args: Namespace, yaml_config: Optional[Dict[str, List]]
|
|
404
|
+
) -> None:
|
|
405
|
+
if self._get_config_value("dcgm_disable", args, yaml_config):
|
|
406
|
+
launch_mode = self._get_config_value(
|
|
407
|
+
"triton_launch_mode", args, yaml_config
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
if launch_mode != "remote":
|
|
411
|
+
raise TritonModelAnalyzerException(
|
|
412
|
+
f"\nIf `dcgm-disable` then `triton-launch-mode` must be set to remote"
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
def _preprocess_and_verify_arguments(self):
|
|
416
|
+
"""
|
|
417
|
+
Enforces some rules on the config.
|
|
418
|
+
|
|
419
|
+
Raises
|
|
420
|
+
------
|
|
421
|
+
TritonModelAnalyzerException
|
|
422
|
+
If there is a problem with arguments or config.
|
|
423
|
+
"""
|
|
424
|
+
|
|
425
|
+
pass
|
|
426
|
+
|
|
427
|
+
def _autofill_values(self):
|
|
428
|
+
"""
|
|
429
|
+
Enforces some rules on the config.
|
|
430
|
+
|
|
431
|
+
Raises
|
|
432
|
+
------
|
|
433
|
+
TritonModelAnalyzerException
|
|
434
|
+
If there is a problem with arguments or config.
|
|
435
|
+
"""
|
|
436
|
+
|
|
437
|
+
pass
|
|
438
|
+
|
|
439
|
+
def get_config(self):
|
|
440
|
+
"""
|
|
441
|
+
Get the config dictionary.
|
|
442
|
+
|
|
443
|
+
Returns
|
|
444
|
+
-------
|
|
445
|
+
dict
|
|
446
|
+
Returns a dictionary where the keys are the
|
|
447
|
+
configuration name and the values are ConfigField objects.
|
|
448
|
+
"""
|
|
449
|
+
|
|
450
|
+
return self._fields
|
|
451
|
+
|
|
452
|
+
def get_all_config(self):
|
|
453
|
+
"""
|
|
454
|
+
Get a dictionary containing all the configurations.
|
|
455
|
+
|
|
456
|
+
Returns
|
|
457
|
+
-------
|
|
458
|
+
dict
|
|
459
|
+
A dictionary containing all the configurations.
|
|
460
|
+
"""
|
|
461
|
+
|
|
462
|
+
config_dict = {}
|
|
463
|
+
for config in self._fields.values():
|
|
464
|
+
config_dict[config.name()] = config.value()
|
|
465
|
+
|
|
466
|
+
return config_dict
|
|
467
|
+
|
|
468
|
+
def __deepcopy__(self, memo):
|
|
469
|
+
cls = self.__class__
|
|
470
|
+
result = cls.__new__(cls)
|
|
471
|
+
memo[id(self)] = result
|
|
472
|
+
for k, v in self.__dict__.items():
|
|
473
|
+
setattr(result, k, deepcopy(v, memo))
|
|
474
|
+
return result
|
|
475
|
+
|
|
476
|
+
def __getattr__(self, name):
|
|
477
|
+
return self._fields[name].value()
|
|
478
|
+
|
|
479
|
+
def __setattr__(self, name, value):
|
|
480
|
+
if name == "_fields":
|
|
481
|
+
self.__dict__[name] = value
|
|
482
|
+
else:
|
|
483
|
+
self._fields[name].set_value(value, is_set_by_config=True)
|