Skip to content

Commit 8cb5d42

Browse files
nv-braftgerdesnv
andauthored
Add BLS composing model option to PA config (#664)
* Adding bls composing model options to PA config * fix a few issues * Fix type checking * Appending composing model config names to representaiton string * Ignore typing error --------- Co-authored-by: tgerdes <[email protected]>
1 parent f039395 commit 8cb5d42

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

docs/config.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ profile_models:
638638
cpu_only: true
639639
model_2:
640640
perf_analyzer_flags:
641-
percentile: 95
642-
latency-report-file: /path/to/latency/report/file
641+
percentile: 95
643642
```
644643

645644
The above config tells model analyzer to profile `model_1` on CPU only,
@@ -669,7 +668,6 @@ profile_models:
669668
batch_sizes: 4
670669
perf_analyzer_flags:
671670
percentile: 95
672-
latency-report-file: /path/to/latency/report/file
673671
```
674672

675673
### Model-specific options for Perf Analyzer
@@ -685,7 +683,6 @@ profile_models:
685683
model_1:
686684
perf_analyzer_flags:
687685
percentile: 95
688-
latency-report-file: /path/to/latency/report/file
689686
```
690687

691688
### Shape, Input-Data, and Streaming
@@ -931,7 +928,6 @@ profile_models:
931928
model_1:
932929
perf_analyzer_flags:
933930
percentile: 95
934-
latency-report-file: /path/to/latency/report/file
935931
model_config_parameters:
936932
max_batch_size: 2
937933
dynamic_batching:

model_analyzer/config/input/config_command.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Dict, List, Optional, Any
15+
from typing import Dict, List, Optional, Any, Union
1616
from model_analyzer.model_analyzer_exceptions \
1717
import TritonModelAnalyzerException
1818
import yaml
@@ -266,12 +266,11 @@ def _check_no_brute_search(self, args: Namespace,
266266

267267
def _check_no_multi_model(self, args: Namespace,
268268
yaml_config: Optional[Dict[str, List]]) -> None:
269-
profile_models = self._get_config_value('profile_models', args,
270-
yaml_config)
269+
profile_models: Union[Dict, List, str] = self._get_config_value(
270+
'profile_models', args, yaml_config) # type: ignore
271271

272-
profile_model_count = len(profile_models) if isinstance(
273-
profile_models, list) else len(
274-
profile_models.split(',')) # type: ignore
272+
profile_model_count = len(profile_models.split(',')) if isinstance(
273+
profile_models, str) else len(profile_models)
275274

276275
if profile_model_count > 1:
277276
raise TritonModelAnalyzerException(

model_analyzer/config/run/model_run_config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,13 @@ def representation(self) -> str:
107107
Returns a representation string for the ModelRunConfig that can be used
108108
as a key to uniquely identify it
109109
"""
110+
repr = self.perf_config().representation()
110111

111-
return self.perf_config().representation()
112+
if self._composing_configs:
113+
repr += " " + (',').join(
114+
self.get_composing_config_names()) # type: ignore
115+
116+
return repr
112117

113118
def _check_for_client_vs_model_batch_size(self) -> bool:
114119
"""

model_analyzer/perf_analyzer/perf_analyzer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import os
5454
import csv
5555
import tempfile
56+
import glob
5657

5758
logger = logging.getLogger(LOGGER_NAME)
5859

@@ -446,7 +447,9 @@ def _parse_outputs(self, metrics):
446447
for perf_config in [
447448
mrc.perf_config() for mrc in self._config.model_run_configs()
448449
]:
449-
os.remove(perf_config['latency-report-file'])
450+
# Remove the latency file and all associated composing model latency files
451+
for f in glob.glob(f"*{perf_config['latency-report-file']}"):
452+
os.remove(f)
450453

451454
def _extract_perf_records_from_row(
452455
self, requested_metrics: List[Record],

model_analyzer/perf_analyzer/perf_config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class PerfAnalyzerConfig:
4141
'ssl-https-client-certificate-type',
4242
'ssl-https-client-certificate-file', 'ssl-https-private-key-type',
4343
'ssl-https-private-key-file', 'collect-metrics', 'metrics-url',
44-
'metrics-interval'
44+
'metrics-interval', 'bls-composing-models'
4545
]
4646

4747
input_to_options = [
@@ -177,6 +177,13 @@ def update_config_from_profile_config(self, model_name, profile_config):
177177
'metrics-interval': metrics_interval
178178
})
179179

180+
if profile_config.bls_composing_models:
181+
bls_composing_model_names = ','.join([
182+
bls_composing_model.model_name()
183+
for bls_composing_model in profile_config.bls_composing_models
184+
])
185+
params.update({'bls-composing-models': bls_composing_model_names})
186+
180187
self.update_config(params)
181188

182189
@classmethod

0 commit comments

Comments
 (0)