model_analyzer/config/input/config_command_profile.py
def _add_profile_models_configs(self):
        """
        Adds configs specific to model specifications
        """
        triton_server_flags_scheme = ConfigObject(schema={
            k: ConfigPrimitive(str) for k in TritonServerConfig.allowed_keys()
        })
        perf_analyzer_additive_keys = {
            k: None for k in PerfAnalyzerConfig.additive_keys()
        }
        perf_analyzer_flags_scheme = ConfigObject(
            schema={
                k:
                ((ConfigUnion([ConfigPrimitive(
                    type_=str), ConfigListString()])) if (
                        k in perf_analyzer_additive_keys) else ConfigPrimitive(
                            type_=str))
                for k in PerfAnalyzerConfig.allowed_keys()
            })
        triton_server_environment_scheme = ConfigObject(
            schema={'*': ConfigPrimitive(str)})
        self._add_config(
            ConfigField(
                'perf_analyzer_flags',
                field_type=perf_analyzer_flags_scheme,
                description=
                'Allows custom configuration of the perf analyzer instances used by model analyzer.'
            ))
        self._add_config(
            ConfigField(
                'triton_server_flags',
                field_type=triton_server_flags_scheme,
                description=
                'Allows custom configuration of the triton instances used by model analyzer.'
            ))
        self._add_config(
            ConfigField(
                'triton_server_environment',
                field_type=triton_server_environment_scheme,
                description=
                'Allows setting environment variables for tritonserver server instances launched by Model Analyzer'
            ))

        objectives_scheme = ConfigUnion([
            ConfigObject(
                schema={
                    tag: ConfigPrimitive(type_=int)
                    for tag in RecordType.get_all_record_types().keys()
                }),
            ConfigListString(output_mapper=objective_list_output_mapper)
        ])
        constraints_scheme = ConfigObject(
            schema={
                'perf_throughput':
                    ConfigObject(schema={
                        'min': ConfigPrimitive(int),
                    }),
                'perf_latency_avg':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency_p90':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency_p95':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency_p99':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'gpu_used_memory':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
            })
        self._add_config(
            ConfigField(
                'objectives',
                field_type=objectives_scheme,
                default_value=DEFAULT_OFFLINE_OBJECTIVES,
                description=
                'Model Analyzer uses the objectives described here to find the best configuration for each model.'
            ))
        self._add_config(
            ConfigField(
                'constraints',
                field_type=constraints_scheme,
                description=
                'Constraints on the objectives specified in the "objectives" field of the config.'
            ))
        model_config_fields = self._get_model_config_fields()
        profile_model_scheme = ConfigObject(
            required=True,
            schema={
                # Any key is allowed, but the keys must follow the pattern
                # below
                '*':
                    ConfigObject(
                        schema={
                            'cpu_only':
                                ConfigPrimitive(bool),
                            'parameters':
                                ConfigObject(
                                    schema={
                                        'batch_sizes':
                                            ConfigListNumeric(type_=int),
                                        'concurrency':
                                            ConfigListNumeric(type_=int)
                                    }),
                            'objectives':
                                objectives_scheme,
                            'constraints':
                                constraints_scheme,
                            'model_config_parameters':
                                model_config_fields,
                            'perf_analyzer_flags':
                                perf_analyzer_flags_scheme,
                            'triton_server_flags':
                                triton_server_flags_scheme,
                            'triton_server_environment':
                                triton_server_environment_scheme
                        })
            },
            output_mapper=ConfigModelProfileSpec.
            model_object_to_config_model_profile_spec)
        self._add_config(
            ConfigField(
                'profile_models',
                flags=['--profile-models'],
                field_type=ConfigUnion([
                    profile_model_scheme,
                    ConfigListGeneric(ConfigUnion([
                        profile_model_scheme,
                        ConfigPrimitive(str,
                                        output_mapper=ConfigModelProfileSpec.
                                        model_str_to_config_model_profile_spec)
                    ]),
                                      required=True,
                                      output_mapper=ConfigModelProfileSpec.
                                      model_mixed_to_config_model_profile_spec),
                    ConfigListString(output_mapper=ConfigModelProfileSpec.
                                     model_list_to_config_model_profile_spec),
                ],
                                       required=True),
                description='List of the models to be profiled'))
        self._add_config(
            ConfigField(
                'batch_sizes',
                flags=['--batch-sizes', '-b'],
                field_type=ConfigListNumeric(int),
                default_value=DEFAULT_BATCH_SIZES,
                description=
                'Comma-delimited list of batch sizes to use for the profiling'))
        self._add_config(
            ConfigField(
                'concurrency',
                flags=['-c', '--concurrency'],
                field_type=ConfigListNumeric(int),
                description=
                "Comma-delimited list of concurrency values or ranges <start:end:step>"
                " to be used during profiling"))

        Adds configs specific to model specifications
        
Adds configs specific to model specifications
Adds configs specific to model specifications
def _add_profile_models_configs(self):
        triton_server_flags_scheme = ConfigObject(schema={
            k: ConfigPrimitive(str) for k in TritonServerConfig.allowed_keys()
        })
        perf_analyzer_additive_keys = {
            k: None for k in PerfAnalyzerConfig.additive_keys()
        }
        perf_analyzer_flags_scheme = ConfigObject(
            schema={
                k:
                ((ConfigUnion([ConfigPrimitive(
                    type_=str), ConfigListString()])) if (
                        k in perf_analyzer_additive_keys) else ConfigPrimitive(
                            type_=str))
                for k in PerfAnalyzerConfig.allowed_keys()
            })
        triton_server_environment_scheme = ConfigObject(
            schema={'*': ConfigPrimitive(str)})
        self._add_config(
            ConfigField(
                'perf_analyzer_flags',
                field_type=perf_analyzer_flags_scheme,
                description=
                'Allows custom configuration of the perf analyzer instances used by model analyzer.'
            ))
        self._add_config(
            ConfigField(
                'triton_server_flags',
                field_type=triton_server_flags_scheme,
                description=
                'Allows custom configuration of the triton instances used by model analyzer.'
            ))
        self._add_config(
            ConfigField(
                'triton_server_environment',
                field_type=triton_server_environment_scheme,
                description=
                'Allows setting environment variables for tritonserver server instances launched by Model Analyzer'
            ))
        objectives_scheme = ConfigUnion([
            ConfigObject(
                schema={
                    tag: ConfigPrimitive(type_=int)
                    for tag in RecordType.get_all_record_types().keys()
                }),
            ConfigListString(output_mapper=objective_list_output_mapper)
        ])
        constraints_scheme = ConfigObject(
            schema={
                'perf_throughput':
                    ConfigObject(schema={
                        'min': ConfigPrimitive(int),
                    }),
                'perf_latency_avg':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency_p90':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency_p95':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency_p99':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'perf_latency':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
                'gpu_used_memory':
                    ConfigObject(schema={
                        'max': ConfigPrimitive(int),
                    }),
            })
        self._add_config(
            ConfigField(
                'objectives',
                field_type=objectives_scheme,
                default_value=DEFAULT_OFFLINE_OBJECTIVES,
                description=
                'Model Analyzer uses the objectives described here to find the best configuration for each model.'
            ))
        self._add_config(
            ConfigField(
                'constraints',
                field_type=constraints_scheme,
                description=
                'Constraints on the objectives specified in the "objectives" field of the config.'
            ))
        model_config_fields = self._get_model_config_fields()
        profile_model_scheme = ConfigObject(
            required=True,
            schema={
                '*':
                    ConfigObject(
                        schema={
                            'cpu_only':
                                ConfigPrimitive(bool),
                            'parameters':
                                ConfigObject(
                                    schema={
                                        'batch_sizes':
                                            ConfigListNumeric(type_=int),
                                        'concurrency':
                                            ConfigListNumeric(type_=int)
                                    }),
                            'objectives':
                                objectives_scheme,
                            'constraints':
                                constraints_scheme,
                            'model_config_parameters':
                                model_config_fields,
                            'perf_analyzer_flags':
                                perf_analyzer_flags_scheme,
                            'triton_server_flags':
                                triton_server_flags_scheme,
                            'triton_server_environment':
                                triton_server_environment_scheme
                        })
            },
            output_mapper=ConfigModelProfileSpec.
            model_object_to_config_model_profile_spec)
        self._add_config(
            ConfigField(
                'profile_models',
                flags=['--profile-models'],
                field_type=ConfigUnion([
                    profile_model_scheme,
                    ConfigListGeneric(ConfigUnion([
                        profile_model_scheme,
                        ConfigPrimitive(str,
                                        output_mapper=ConfigModelProfileSpec.
                                        model_str_to_config_model_profile_spec)
                    ]),
                                      required=True,
                                      output_mapper=ConfigModelProfileSpec.
                                      model_mixed_to_config_model_profile_spec),
                    ConfigListString(output_mapper=ConfigModelProfileSpec.
                                     model_list_to_config_model_profile_spec),
                ],
                                       required=True),
                description='List of the models to be profiled'))
        self._add_config(
            ConfigField(
                'batch_sizes',
                flags=['--batch-sizes', '-b'],
                field_type=ConfigListNumeric(int),
                default_value=DEFAULT_BATCH_SIZES,
                description=
                'Comma-delimited list of batch sizes to use for the profiling'))
        self._add_config(
            ConfigField(
                'concurrency',
                flags=['-c', '--concurrency'],
                field_type=ConfigListNumeric(int),
                description=
                "Comma-delimited list of concurrency values or ranges <start:end:step>"
                " to be used during profiling"))
def _add_profile_models_configs ( self ) : triton_server_flags_scheme = ConfigObject ( schema = { k : ConfigPrimitive ( str ) for k in TritonServerConfig . allowed_keys ( ) } ) perf_analyzer_additive_keys = { k : None for k in PerfAnalyzerConfig . additive_keys ( ) } perf_analyzer_flags_scheme = ConfigObject ( schema = { k : ( ( ConfigUnion ( [ ConfigPrimitive ( type_ = str ) , ConfigListString ( ) ] ) ) if ( k in perf_analyzer_additive_keys ) else ConfigPrimitive ( type_ = str ) ) for k in PerfAnalyzerConfig . allowed_keys ( ) } ) triton_server_environment_scheme = ConfigObject ( schema = { '*' : ConfigPrimitive ( str ) } ) self . _add_config ( ConfigField ( 'perf_analyzer_flags' , field_type = perf_analyzer_flags_scheme , description = 'Allows custom configuration of the perf analyzer instances used by model analyzer.' ) ) self . _add_config ( ConfigField ( 'triton_server_flags' , field_type = triton_server_flags_scheme , description = 'Allows custom configuration of the triton instances used by model analyzer.' ) ) self . _add_config ( ConfigField ( 'triton_server_environment' , field_type = triton_server_environment_scheme , description = 'Allows setting environment variables for tritonserver server instances launched by Model Analyzer' ) ) objectives_scheme = ConfigUnion ( [ ConfigObject ( schema = { tag : ConfigPrimitive ( type_ = int ) for tag in RecordType . get_all_record_types ( ) . keys ( ) } ) , ConfigListString ( output_mapper = objective_list_output_mapper ) ] ) constraints_scheme = ConfigObject ( schema = { 'perf_throughput' : ConfigObject ( schema = { 'min' : ConfigPrimitive ( int ) , } ) , 'perf_latency_avg' : ConfigObject ( schema = { 'max' : ConfigPrimitive ( int ) , } ) , 'perf_latency_p90' : ConfigObject ( schema = { 'max' : ConfigPrimitive ( int ) , } ) , 'perf_latency_p95' : ConfigObject ( schema = { 'max' : ConfigPrimitive ( int ) , } ) , 'perf_latency_p99' : ConfigObject ( schema = { 'max' : ConfigPrimitive ( int ) , } ) , 'perf_latency' : ConfigObject ( schema = { 'max' : ConfigPrimitive ( int ) , } ) , 'gpu_used_memory' : ConfigObject ( schema = { 'max' : ConfigPrimitive ( int ) , } ) , } ) self . _add_config ( ConfigField ( 'objectives' , field_type = objectives_scheme , default_value = DEFAULT_OFFLINE_OBJECTIVES , description = 'Model Analyzer uses the objectives described here to find the best configuration for each model.' ) ) self . _add_config ( ConfigField ( 'constraints' , field_type = constraints_scheme , description = 'Constraints on the objectives specified in the "objectives" field of the config.' ) ) model_config_fields = self . _get_model_config_fields ( ) profile_model_scheme = ConfigObject ( required = True , schema = { '*' : ConfigObject ( schema = { 'cpu_only' : ConfigPrimitive ( bool ) , 'parameters' : ConfigObject ( schema = { 'batch_sizes' : ConfigListNumeric ( type_ = int ) , 'concurrency' : ConfigListNumeric ( type_ = int ) } ) , 'objectives' : objectives_scheme , 'constraints' : constraints_scheme , 'model_config_parameters' : model_config_fields , 'perf_analyzer_flags' : perf_analyzer_flags_scheme , 'triton_server_flags' : triton_server_flags_scheme , 'triton_server_environment' : triton_server_environment_scheme } ) } , output_mapper = ConfigModelProfileSpec . model_object_to_config_model_profile_spec ) self . _add_config ( ConfigField ( 'profile_models' , flags = [ '--profile-models' ] , field_type = ConfigUnion ( [ profile_model_scheme , ConfigListGeneric ( ConfigUnion ( [ profile_model_scheme , ConfigPrimitive ( str , output_mapper = ConfigModelProfileSpec . model_str_to_config_model_profile_spec ) ] ) , required = True , output_mapper = ConfigModelProfileSpec . model_mixed_to_config_model_profile_spec ) , ConfigListString ( output_mapper = ConfigModelProfileSpec . model_list_to_config_model_profile_spec ) , ] , required = True ) , description = 'List of the models to be profiled' ) ) self . _add_config ( ConfigField ( 'batch_sizes' , flags = [ '--batch-sizes' , '-b' ] , field_type = ConfigListNumeric ( int ) , default_value = DEFAULT_BATCH_SIZES , description = 'Comma-delimited list of batch sizes to use for the profiling' ) ) self . _add_config ( ConfigField ( 'concurrency' , flags = [ '-c' , '--concurrency' ] , field_type = ConfigListNumeric ( int ) , description = "Comma-delimited list of concurrency values or ranges <start:end:step>" " to be used during profiling" ) )
Adds configs specific to model specifications
Adds configs specific to model specifications
"""
        Adds configs specific to model specifications
        """ # Any key is allowed, but the keys must follow the pattern # below
self