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,173 @@
|
|
|
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
|
+
|
|
18
|
+
class ConfigModelReportSpec:
|
|
19
|
+
"""
|
|
20
|
+
A class representing the configuration used for
|
|
21
|
+
a single model.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, model_config_name, plots=None):
|
|
25
|
+
"""
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
model_config_name : str
|
|
29
|
+
Name used for the model
|
|
30
|
+
plots : list of ConfigPlot
|
|
31
|
+
containing plot names and ConfigObjects
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
self._model_config_name = model_config_name
|
|
35
|
+
self._plots = plots
|
|
36
|
+
|
|
37
|
+
def model_config_name(self):
|
|
38
|
+
"""
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
str
|
|
42
|
+
The model name used for this config.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
return self._model_config_name
|
|
46
|
+
|
|
47
|
+
def plots(self):
|
|
48
|
+
"""
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
list of ConfigPlot
|
|
52
|
+
containing plot names and ConfigObjects
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
return self._plots
|
|
56
|
+
|
|
57
|
+
def set_model_config_name(self, model_config_name):
|
|
58
|
+
"""
|
|
59
|
+
Parameters
|
|
60
|
+
-------
|
|
61
|
+
model_config_name : str
|
|
62
|
+
The model name used for this config.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
self._model_config_name = model_config_name
|
|
66
|
+
|
|
67
|
+
def set_plots(self, plots):
|
|
68
|
+
"""
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
plots : list of ConfigPLot
|
|
72
|
+
containing plot names and ConfigObjects
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
self._plots = plots
|
|
76
|
+
|
|
77
|
+
@staticmethod
|
|
78
|
+
def model_object_to_config_model_report_spec(value):
|
|
79
|
+
"""
|
|
80
|
+
Converts a ConfigObject to ConfigModelReportSpec.
|
|
81
|
+
|
|
82
|
+
Parameters
|
|
83
|
+
----------
|
|
84
|
+
value : dict
|
|
85
|
+
A dictionary where the keys are model names
|
|
86
|
+
and the values are ConfigObjects.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
list
|
|
91
|
+
A list of ConfigModelReportSpec objects.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
models = []
|
|
95
|
+
for model_config_name, model_properties in value.items():
|
|
96
|
+
models.append(
|
|
97
|
+
ConfigModelReportSpec(model_config_name, **model_properties.value())
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return models
|
|
101
|
+
|
|
102
|
+
@staticmethod
|
|
103
|
+
def model_str_to_config_model_report_spec(model_config_name):
|
|
104
|
+
"""
|
|
105
|
+
Constructs a ConfigModelReportSpec from a given
|
|
106
|
+
model_config_name.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
model_config_name : str
|
|
111
|
+
Name of the model
|
|
112
|
+
|
|
113
|
+
Returns
|
|
114
|
+
-------
|
|
115
|
+
ConfigModelReportSpec
|
|
116
|
+
ConfigModelReportSpec object with the given model name.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
return ConfigModelReportSpec(model_config_name)
|
|
120
|
+
|
|
121
|
+
@staticmethod
|
|
122
|
+
def model_list_to_config_model_report_spec(report_models):
|
|
123
|
+
"""
|
|
124
|
+
Construct ConfigModelReportSpec objects from a list of strings.
|
|
125
|
+
|
|
126
|
+
Parameters
|
|
127
|
+
----------
|
|
128
|
+
report_models : list
|
|
129
|
+
A list of strings containing model names.
|
|
130
|
+
|
|
131
|
+
Returns
|
|
132
|
+
-------
|
|
133
|
+
list
|
|
134
|
+
A list of ConfigModelReportSpec objects.
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
models = []
|
|
138
|
+
for model_config_name in report_models:
|
|
139
|
+
models.append(ConfigModelReportSpec(model_config_name))
|
|
140
|
+
return models
|
|
141
|
+
|
|
142
|
+
@staticmethod
|
|
143
|
+
def model_mixed_to_config_model_report_spec(models):
|
|
144
|
+
"""
|
|
145
|
+
Unifies a mixed list of ConfigModelReportSpec objects
|
|
146
|
+
and list of ConfigModelReportSpec objects.
|
|
147
|
+
|
|
148
|
+
Parameters
|
|
149
|
+
----------
|
|
150
|
+
models : list
|
|
151
|
+
A mixed list containing lists or ConfigModelReportSpec objects.
|
|
152
|
+
|
|
153
|
+
Returns
|
|
154
|
+
-------
|
|
155
|
+
list
|
|
156
|
+
A list only containing ConfigModelReportSpec objects.
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
new_models = []
|
|
160
|
+
for model in models:
|
|
161
|
+
if type(model.value()) is list:
|
|
162
|
+
for model_i in model.value():
|
|
163
|
+
new_models.append(model_i)
|
|
164
|
+
else:
|
|
165
|
+
new_models.append(model.value())
|
|
166
|
+
return new_models
|
|
167
|
+
|
|
168
|
+
def __repr__(self):
|
|
169
|
+
model_object = {"model_config_name": self._model_config_name}
|
|
170
|
+
if self._plots:
|
|
171
|
+
model_object["plots"] = self._plots
|
|
172
|
+
|
|
173
|
+
return str(model_object)
|
|
@@ -0,0 +1,198 @@
|
|
|
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
|
+
|
|
18
|
+
class ConfigPlot:
|
|
19
|
+
"""
|
|
20
|
+
A class representing the configuration used for
|
|
21
|
+
a single plot.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, name, title=None, x_axis=None, y_axis=None, monotonic=False):
|
|
25
|
+
"""
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
name : str
|
|
29
|
+
Name to use to identify the plot
|
|
30
|
+
title : str
|
|
31
|
+
title of the plot
|
|
32
|
+
x_axis : str
|
|
33
|
+
The metric tag for the x-axis of this plot
|
|
34
|
+
y_axis : str
|
|
35
|
+
The metric tag for the y-axis of this plot
|
|
36
|
+
monotonic: bool
|
|
37
|
+
Whether or not to prune decreasing points in this
|
|
38
|
+
plot
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
self._name = name
|
|
42
|
+
self._title = title
|
|
43
|
+
self._x_axis = x_axis
|
|
44
|
+
self._y_axis = y_axis
|
|
45
|
+
self._monotonic = monotonic
|
|
46
|
+
|
|
47
|
+
def name(self):
|
|
48
|
+
"""
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
str
|
|
52
|
+
Name of plot (to which it will be saved)
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
return self._name
|
|
56
|
+
|
|
57
|
+
def title(self):
|
|
58
|
+
"""
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
str
|
|
62
|
+
title of the plot
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
return self._title
|
|
66
|
+
|
|
67
|
+
def x_axis(self):
|
|
68
|
+
"""
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
str
|
|
72
|
+
tag for x_axis of the plot
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
return self._x_axis
|
|
76
|
+
|
|
77
|
+
def y_axis(self):
|
|
78
|
+
"""
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
str
|
|
82
|
+
tag for y axis of the plot
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
return self._y_axis
|
|
86
|
+
|
|
87
|
+
def monotonic(self):
|
|
88
|
+
"""
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
bool
|
|
92
|
+
Whether or not to prune
|
|
93
|
+
decreasing points
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
return self._monotonic
|
|
97
|
+
|
|
98
|
+
def set_name(self, name):
|
|
99
|
+
"""
|
|
100
|
+
Parameters
|
|
101
|
+
-------
|
|
102
|
+
name: str
|
|
103
|
+
Name of plot (to which it will be saved)
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
self._name = name
|
|
107
|
+
|
|
108
|
+
def set_title(self, title):
|
|
109
|
+
"""
|
|
110
|
+
Parameters
|
|
111
|
+
-------
|
|
112
|
+
str
|
|
113
|
+
title of the plot
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
self._title = title
|
|
117
|
+
|
|
118
|
+
def set_x_axis(self, x_axis):
|
|
119
|
+
"""
|
|
120
|
+
Parameters
|
|
121
|
+
-------
|
|
122
|
+
x_axis: str
|
|
123
|
+
tag for x_axis of the plot
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
self._x_axis = x_axis
|
|
127
|
+
|
|
128
|
+
def set_y_axis(self, y_axis):
|
|
129
|
+
"""
|
|
130
|
+
Parameters
|
|
131
|
+
-------
|
|
132
|
+
y_axis: str
|
|
133
|
+
tag for x_axis of the plot
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
self._y_axis = y_axis
|
|
137
|
+
|
|
138
|
+
def set_monotonic(self, monotonic):
|
|
139
|
+
"""
|
|
140
|
+
Parameters
|
|
141
|
+
-------
|
|
142
|
+
monotonic: bool
|
|
143
|
+
Whether or not to prune
|
|
144
|
+
decreasing points
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
self._monotonic = monotonic
|
|
148
|
+
|
|
149
|
+
@staticmethod
|
|
150
|
+
def from_list(plots):
|
|
151
|
+
"""
|
|
152
|
+
Converts a List of plot specs to ConfigPlot.
|
|
153
|
+
|
|
154
|
+
Parameters
|
|
155
|
+
----------
|
|
156
|
+
plots : list
|
|
157
|
+
A list of ConfigPlots
|
|
158
|
+
|
|
159
|
+
Returns
|
|
160
|
+
-------
|
|
161
|
+
list
|
|
162
|
+
A list of ConfigPlot objects.
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
plot_list = []
|
|
166
|
+
for plot in plots:
|
|
167
|
+
plot_list.append(plot.value()[0])
|
|
168
|
+
return plot_list
|
|
169
|
+
|
|
170
|
+
@staticmethod
|
|
171
|
+
def from_object(plots):
|
|
172
|
+
"""
|
|
173
|
+
Converts a plot spec object to ConfigPlot.
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
plots : dict
|
|
178
|
+
containing plot names and ConfigObjects
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
ConfigPlot
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
plot_list = []
|
|
185
|
+
for plot_name, plot_spec in plots.items():
|
|
186
|
+
plot_list.append(ConfigPlot(plot_name, **plot_spec.value()))
|
|
187
|
+
return plot_list
|
|
188
|
+
|
|
189
|
+
def __repr__(self):
|
|
190
|
+
plot_object = {
|
|
191
|
+
"name": self._name,
|
|
192
|
+
"title": self._title,
|
|
193
|
+
"x_axis": self._x_axis,
|
|
194
|
+
"y_axis": self._y_axis,
|
|
195
|
+
"monotonic": self._monotonic,
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return str(plot_object)
|
|
@@ -0,0 +1,101 @@
|
|
|
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 google.protobuf.descriptor import FieldDescriptor
|
|
18
|
+
|
|
19
|
+
from model_analyzer.model_analyzer_exceptions import TritonModelAnalyzerException
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def is_protobuf_type_primitive(protobuf_type):
|
|
23
|
+
"""
|
|
24
|
+
Check whether the protobuf type is primitive (i.e. not Message).
|
|
25
|
+
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
protobuf_type : int
|
|
29
|
+
Protobuf type
|
|
30
|
+
|
|
31
|
+
Returns
|
|
32
|
+
-------
|
|
33
|
+
bool
|
|
34
|
+
True if the protobuf type is a primitive.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
if protobuf_type == FieldDescriptor.TYPE_BOOL:
|
|
38
|
+
return True
|
|
39
|
+
elif protobuf_type == FieldDescriptor.TYPE_DOUBLE:
|
|
40
|
+
return True
|
|
41
|
+
elif protobuf_type == FieldDescriptor.TYPE_FLOAT:
|
|
42
|
+
return True
|
|
43
|
+
elif protobuf_type == FieldDescriptor.TYPE_INT32:
|
|
44
|
+
return True
|
|
45
|
+
elif protobuf_type == FieldDescriptor.TYPE_INT64:
|
|
46
|
+
return True
|
|
47
|
+
elif protobuf_type == FieldDescriptor.TYPE_STRING:
|
|
48
|
+
return True
|
|
49
|
+
elif protobuf_type == FieldDescriptor.TYPE_UINT32:
|
|
50
|
+
return True
|
|
51
|
+
elif protobuf_type == FieldDescriptor.TYPE_UINT64:
|
|
52
|
+
return True
|
|
53
|
+
else:
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def protobuf_to_config_type(protobuf_type):
|
|
58
|
+
"""
|
|
59
|
+
Map the protobuf type to the Python types.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
protobuf_type : int
|
|
64
|
+
The protobuf type to be mapped.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
type or bool
|
|
69
|
+
The equivalent Python type for the protobuf type. If the type is not
|
|
70
|
+
supported, it will return False.
|
|
71
|
+
|
|
72
|
+
Raises
|
|
73
|
+
------
|
|
74
|
+
TritonModelAnalyzerException
|
|
75
|
+
If the protobuf_type is not a primitive type, this exception will be
|
|
76
|
+
raised.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
if not is_protobuf_type_primitive(protobuf_type):
|
|
80
|
+
raise TritonModelAnalyzerException()
|
|
81
|
+
|
|
82
|
+
# TODO: Is using int for INT32 and INT64 ok? Similarly for UINT32, UINT64,
|
|
83
|
+
# FLOAT, DOUBLE.
|
|
84
|
+
if protobuf_type == FieldDescriptor.TYPE_BOOL:
|
|
85
|
+
return bool
|
|
86
|
+
elif protobuf_type == FieldDescriptor.TYPE_DOUBLE:
|
|
87
|
+
return float
|
|
88
|
+
elif protobuf_type == FieldDescriptor.TYPE_FLOAT:
|
|
89
|
+
return float
|
|
90
|
+
elif protobuf_type == FieldDescriptor.TYPE_INT32:
|
|
91
|
+
return int
|
|
92
|
+
elif protobuf_type == FieldDescriptor.TYPE_INT64:
|
|
93
|
+
return int
|
|
94
|
+
elif protobuf_type == FieldDescriptor.TYPE_STRING:
|
|
95
|
+
return str
|
|
96
|
+
elif protobuf_type == FieldDescriptor.TYPE_UINT32:
|
|
97
|
+
return int
|
|
98
|
+
elif protobuf_type == FieldDescriptor.TYPE_UINT64:
|
|
99
|
+
return int
|
|
100
|
+
else:
|
|
101
|
+
return False
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
# Copyright 2022-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
|
+
import logging
|
|
18
|
+
from typing import Set
|
|
19
|
+
|
|
20
|
+
from model_analyzer.constants import LOGGER_NAME
|
|
21
|
+
from model_analyzer.model_analyzer_exceptions import TritonModelAnalyzerException
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger(LOGGER_NAME)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class YamlConfigValidator:
|
|
27
|
+
"""
|
|
28
|
+
Validate all options from the yaml file.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
_valid_yaml_options: Set[str] = set({})
|
|
32
|
+
|
|
33
|
+
@staticmethod
|
|
34
|
+
def validate(yaml_file):
|
|
35
|
+
"""
|
|
36
|
+
Verifies the options present in the yaml config file.
|
|
37
|
+
If an error is found, the validator will throw an exception.
|
|
38
|
+
"""
|
|
39
|
+
if not yaml_file:
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
YamlConfigValidator._create_valid_option_set()
|
|
43
|
+
|
|
44
|
+
valid = True
|
|
45
|
+
for option in yaml_file.keys():
|
|
46
|
+
valid &= YamlConfigValidator._is_valid_option(option)
|
|
47
|
+
|
|
48
|
+
if not valid:
|
|
49
|
+
raise TritonModelAnalyzerException(
|
|
50
|
+
"The Yaml configuration file is incorrect. Please check the logged errors for the specific options that are causing the issue."
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@staticmethod
|
|
54
|
+
def _is_valid_option(option):
|
|
55
|
+
if option not in YamlConfigValidator._valid_yaml_options:
|
|
56
|
+
logger.error(
|
|
57
|
+
f"{option} is not a valid yaml argument. Please be sure to use underscores and check spelling."
|
|
58
|
+
)
|
|
59
|
+
return False
|
|
60
|
+
return True
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
def _create_valid_option_set():
|
|
64
|
+
"""
|
|
65
|
+
Create set of valid yaml options
|
|
66
|
+
"""
|
|
67
|
+
# Importing here to remove a circular dependency.
|
|
68
|
+
# If these imports are moved to the top of the file, they are imported at file load.
|
|
69
|
+
# This will cause a circular dependency between ConfigCommand, ConfigCommand*, and YamlConfigValidator
|
|
70
|
+
# However, importing here, only requires these files to be imported on object initialization.
|
|
71
|
+
from model_analyzer.config.input.config_command_profile import (
|
|
72
|
+
ConfigCommandProfile,
|
|
73
|
+
)
|
|
74
|
+
from model_analyzer.config.input.config_command_report import (
|
|
75
|
+
ConfigCommandReport,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
config_array = [ConfigCommandProfile(), ConfigCommandReport()]
|
|
79
|
+
|
|
80
|
+
for config in config_array:
|
|
81
|
+
for field in config.get_config():
|
|
82
|
+
YamlConfigValidator._valid_yaml_options.add(field)
|
|
@@ -0,0 +1,15 @@
|
|
|
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.
|