Config
Classes, enums and types used to configure the Triton Model Navigator.
model_navigator.configuration
Definition of enums and classes representing configuration for Model Navigator.
CustomConfig
Bases: ABC
Base class used for custom configs. Input for Model Navigator optimize
method.
defaults
from_dict
classmethod
CustomConfigForFormat
dataclass
Bases: DataObject
, CustomConfig
Abstract base class used for custom configs representing particular format.
Parameters:
-
custom_args
(Dict[str, Any]
, default:dict()
) –Custom arguments passed to conversion function.
-
device
(Optional[str]
, default:None
) –torch-like string used for selecting device e.q. "cuda:0".
defaults
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
abstractmethod
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
CustomConfigForTensorRT
dataclass
CustomConfigForTensorRT(custom_args=dict(), device=None, trt_profiles=None, trt_profile=None, precision=DEFAULT_TENSORRT_PRECISION, precision_mode=DEFAULT_TENSORRT_PRECISION_MODE, max_workspace_size=DEFAULT_MAX_WORKSPACE_SIZE, run_max_batch_size_search=None)
Bases: CustomConfigForFormat
Abstract base class used for custom configs representing particular TensorRT format.
__post_init__
Initialize common TensorRT parameters and validate configuration.
Source code in model_navigator/configuration/__init__.py
defaults
Update parameters to defaults.
Source code in model_navigator/configuration/__init__.py
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
abstractmethod
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
DeviceKind
Format
Bases: Enum
All model formats supported by Model Navigator 'optimize' function.
Parameters:
-
PYTHON
(str
) –Format indicating any model defined in Python.
-
TORCH
(str
) –Format indicating PyTorch model.
-
TENSORFLOW
(str
) –Format indicating TensorFlow model.
-
JAX
(str
) –Format indicating JAX model.
-
TORCHSCRIPT
(str
) –Format indicating TorchScript model.
-
TF_SAVEDMODEL
(str
) –Format indicating TensorFlow SavedModel.
-
TF_TRT
(str
) –Format indicating TensorFlow TensorRT model.
-
TORCH_TRT
(str
) –Format indicating PyTorch TensorRT model.
-
ONNX
(str
) –Format indicating ONNX model.
-
TENSORRT
(str
) –Format indicating TensorRT model.
JitType
MaxThroughputAndMinLatencyStrategy
Bases: RuntimeSearchStrategy
Get runtime with the highest throughput and the lowest latency.
MaxThroughputStrategy
Bases: RuntimeSearchStrategy
Get runtime with the highest throughput.
MaxThroughputWithLatencyBudgetStrategy
Bases: RuntimeSearchStrategy
Get runtime with the hightest throughput within the latency budget.
Initialize the class.
Parameters:
-
latency_budget
(float
) –Latency budget in milliseconds.
Source code in model_navigator/configuration/__init__.py
MinLatencyStrategy
Bases: RuntimeSearchStrategy
Get runtime with the lowest latency.
OnnxConfig
dataclass
OnnxConfig(custom_args=dict(), device=None, opset=DEFAULT_ONNX_OPSET, dynamo_export=False, dynamic_axes=None, dynamo_dynamic_shapes=None, onnx_extended_conversion=False, graph_surgeon_optimization=True, export_device=None, model_path=None)
Bases: CustomConfigForFormat
ONNX custom config used for ONNX export and conversion.
Parameters:
-
opset
(Optional[int]
, default:DEFAULT_ONNX_OPSET
) –ONNX opset used for conversion.
-
dynamo_export
(Optional[bool]
, default:False
) –Enable additional dynamo export.
-
dynamic_axes
(Optional[Dict[str, Union[Dict[int, str], List[int]]]]
, default:None
) –Dynamic axes for ONNX conversion.
-
dynamo_dynamic_shapes
(Optional[bool]
, default:None
) –Enable dynamic shapes for dynamo export. By default dynamic shapes are enabled if dynamic_axes are set or batching is enabled.
-
onnx_extended_conversion
(bool
, default:False
) –Enables additional conversions from TorchScript to ONNX.
-
graph_surgeon_optimization
(bool
, default:True
) –Enables polygraphy graph surgeon optimization: fold_constants, infer_shapes, toposort, cleanup.
-
export_device
(Optional[str]
, default:None
) –Device used for ONNX export.
-
model_path
(Optional[Union[str, Path]]
, default:None
) –optional path to onnx model file, if provided the model will be loaded from the file instead of exporting to onnx
defaults
Update parameters to defaults.
Only configuration related to ONNX export and conversion parameters are updated. We leave the dynamo and extended conversion flags as are set during config initialization.
Source code in model_navigator/configuration/__init__.py
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
OptimizationProfile
dataclass
OptimizationProfile(max_batch_size=None, batch_sizes=None, window_size=DEFAULT_WINDOW_SIZE, stability_percentage=DEFAULT_STABILITY_PERCENTAGE, stabilization_windows=DEFAULT_STABILIZATION_WINDOWS, min_trials=DEFAULT_MIN_TRIALS, max_trials=DEFAULT_MAX_TRIALS, throughput_cutoff_threshold=DEFAULT_THROUGHPUT_CUTOFF_THRESHOLD, throughput_backoff_limit=DEFAULT_THROUGHPUT_BACKOFF_LIMIT, dataloader=None)
Bases: DataObject
Optimization profile configuration.
For each batch size profiler will run measurements in windows of fixed number of queries. Batch sizes are profiled in the ascending order.
Profiler will run multiple trials and will stop when the measurements
are stable (within stability_percentage
from the mean) within three consecutive windows.
If the measurements are not stable after max_trials
trials, the profiler will stop with an error.
Profiler will also stop profiling when the throughput does not increase at least by throughput_cutoff_threshold
.
Parameters:
-
max_batch_size
(Optional[int]
, default:None
) –Maximal batch size used during conversion and profiling. None mean automatic search is enabled.
-
batch_sizes
–List of batch sizes to profile. None mean automatic search is enabled.
-
window_size
(int
, default:DEFAULT_WINDOW_SIZE
) –Number of requests to measure in each window.
-
stability_percentage
(float
, default:DEFAULT_STABILITY_PERCENTAGE
) –Allowed percentage of variation from the mean in consecutive windows.
-
stabilization_windows
(int
, default:DEFAULT_STABILIZATION_WINDOWS
) –Number consecutive windows selected for stabilization.
-
min_trials
(int
, default:DEFAULT_MIN_TRIALS
) –Minimal number of window trials.
-
max_trials
(int
, default:DEFAULT_MAX_TRIALS
) –Maximum number of window trials.
-
throughput_cutoff_threshold
(Optional[float]
, default:DEFAULT_THROUGHPUT_CUTOFF_THRESHOLD
) –Minimum throughput increase to continue profiling.
-
throughput_backoff_limit
(int
, default:DEFAULT_THROUGHPUT_BACKOFF_LIMIT
) –Back-off limit to run multiple more profiling steps to avoid stop at local minimum when throughput saturate based on
throughput_cutoff_threshold
. -
dataloader
(Optional[SizedDataLoader]
, default:None
) –Optional dataloader for profiling. Use only 1 sample.
__post_init__
Validate OptimizationProfile definition to avoid unsupported configurations.
Source code in model_navigator/configuration/__init__.py
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
Instantiate OptimizationProfile class from a dictionary.
Parameters:
-
optimization_profile_dict
(Mapping
) –Data dictionary.
Returns:
-
OptimizationProfile
–OptimizationProfile
Source code in model_navigator/configuration/__init__.py
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Append dataloader
field to filtered fields during dump.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/configuration/__init__.py
RuntimeSearchStrategy
SelectedRuntimeStrategy
Bases: RuntimeSearchStrategy
Get a selected runtime.
Initialize the class.
Parameters:
Source code in model_navigator/configuration/__init__.py
ShapeTuple
dataclass
Bases: DataObject
Represents a set of shapes for a single binding in a profile.
Each element of the tuple represents a shape for a single dimension of the binding.
Parameters:
-
min
(Tuple[int]
) –The minimum shape that the profile will support.
-
opt
(Tuple[int]
) –The shape for which TensorRT will optimize the engine.
-
max
(Tuple[int]
) –The maximum shape that the profile will support.
__iter__
__repr__
__str__
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
SizedIterable
TensorFlowConfig
dataclass
Bases: CustomConfigForFormat
TensorFlow custom config used for SavedModel export.
Parameters:
-
jit_compile
(Tuple[Optional[bool], ...]
, default:(None)
) –Enable or Disable jit_compile flag for tf.function wrapper for Jax infer function.
-
enable_xla
(Tuple[Optional[bool], ...]
, default:(None)
) –Enable or Disable enable_xla flag for jax2tf converter.
defaults
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
TensorFlowTensorRTConfig
dataclass
TensorFlowTensorRTConfig(custom_args=dict(), device=None, trt_profiles=None, trt_profile=None, precision=DEFAULT_TENSORRT_PRECISION, precision_mode=DEFAULT_TENSORRT_PRECISION_MODE, max_workspace_size=DEFAULT_MAX_WORKSPACE_SIZE, run_max_batch_size_search=None, minimum_segment_size=DEFAULT_MIN_SEGMENT_SIZE)
Bases: CustomConfigForTensorRT
TensorFlow TensorRT custom config used for TensorRT SavedModel export.
Parameters:
-
minimum_segment_size
(int
, default:DEFAULT_MIN_SEGMENT_SIZE
) –Min size of subgraph.
__post_init__
Initialize common TensorRT parameters and validate configuration.
Source code in model_navigator/configuration/__init__.py
defaults
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
Instantiate TensorFlowTensorRTConfig from a dictionary.
Source code in model_navigator/configuration/__init__.py
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
TensorRTCompatibilityLevel
TensorRTConfig
dataclass
TensorRTConfig(custom_args=dict(), device=None, trt_profiles=None, trt_profile=None, precision=DEFAULT_TENSORRT_PRECISION, precision_mode=DEFAULT_TENSORRT_PRECISION_MODE, max_workspace_size=DEFAULT_MAX_WORKSPACE_SIZE, run_max_batch_size_search=None, optimization_level=None, compatibility_level=None, onnx_parser_flags=None, timing_cache_dir=None, model_path=None)
Bases: CustomConfigForTensorRT
TensorRT custom config used for TensorRT conversion.
Parameters:
-
optimization_level
(Optional[int]
, default:None
) –Optimization level for TensorRT conversion. Allowed values are fom 0 to 5. Where default is 3 based on TensorRT API documentation.
-
compatibility_level
(Optional[TensorRTCompatibilityLevel]
, default:None
) –Compatibility level for TensorRT conversion.
-
onnx_parser_flags
(Optional[List[int]]
, default:None
) –List of TensorRT OnnxParserFlags used for conversion.
-
timing_cache_dir
(Optional[Union[str, Path]]
, default:None
) –Storage directory for TRT tactic timing info collected from builder
-
model_path
(Optional[Union[str, Path]]
, default:None
) –optional path to trt model file, if provided the model will be loaded from the file instead of converting onnx to trt
__post_init__
Parse dataclass enums.
Source code in model_navigator/configuration/__init__.py
defaults
Update parameters to defaults.
Source code in model_navigator/configuration/__init__.py
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
Instantiate TensorRTConfig from a dictionary.
Source code in model_navigator/configuration/__init__.py
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
TensorRTPrecision
TensorRTPrecisionMode
TensorRTProfile
Bases: Dict[str, ShapeTuple]
Single optimization profile that can be used to build an engine.
More specifically, it is an Dict[str, ShapeTuple]
which maps binding
names to a set of min/opt/max shapes.
__getitem__
Retrieves the shapes registered for a given input name.
Returns:
-
ShapeTuple
–A named tuple including ``min``, ``opt``, and ``max`` members for the shapes corresponding to the input.
Source code in model_navigator/configuration/__init__.py
__repr__
__str__
String representation.
add
A convenience function to add shapes for a single binding.
Parameters:
-
name
(str
) –The name of the binding.
-
min
(Tuple[int]
) –The minimum shape that the profile will support.
-
opt
(Tuple[int]
) –The shape for which TensorRT will optimize the engine.
-
max
(Tuple[int]
) –The maximum shape that the profile will support.
Returns:
-
Profile
–self, which allows this function to be easily chained to add multiple bindings, e.g., TensorRTProfile().add(...).add(...)
Source code in model_navigator/configuration/__init__.py
from_dict
classmethod
Create a TensorRTProfile from a dictionary.
Parameters:
-
profile_dict
(Dict[str, Dict[str, Tuple[int, ...]]]
) –A dictionary mapping binding names to a dictionary containing
min
,opt
, andmax
keys.
Returns:
-
TensorRTProfile
–A TensorRTProfile object.
Source code in model_navigator/configuration/__init__.py
to_dict
Serialize to a dictionary.
Returns:
-
Dict[str, Dict[str, Tuple[int, ...]]]
–Dict[str, Dict[str, Tuple[int, ...]]]: A dictionary mapping binding names to a dictionary containing
min
,opt
, andmax
keys.
Source code in model_navigator/configuration/__init__.py
TensorType
TorchConfig
dataclass
Bases: CustomConfigForFormat
Torch custom config used for torch runner.
Parameters:
-
autocast
(bool
, default:True
) –Enable Automatic Mixed Precision in runner (default: False).
-
inference_mode
(bool
, default:True
) –Enable inference mode in runner (default: True).
defaults
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
TorchExportConfig
dataclass
Bases: CustomConfigForFormat
Torch export custom config used for torch.export.export.
Parameters:
-
autocast
(bool
, default:True
) –Enable Automatic Mixed Precision in runner (default: False).
-
inference_mode
(bool
, default:True
) –Enable inference mode in runner (default: True).
defaults
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
TorchScriptConfig
dataclass
TorchScriptConfig(custom_args=dict(), device=None, jit_type=(JitType.SCRIPT, JitType.TRACE), strict=True, autocast=True, inference_mode=True)
Bases: CustomConfigForFormat
Torch custom config used for TorchScript export.
Parameters:
-
jit_type
(Union[Union[str, JitType], Tuple[Union[str, JitType], ...]]
, default:(SCRIPT, TRACE)
) –Type of TorchScript export.
-
strict
(bool
, default:True
) –Enable or Disable strict flag for tracer used in TorchScript export (default: True).
-
autocast
(bool
, default:True
) –Enable Automatic Mixed Precision in runner (default: False).
-
inference_mode
(bool
, default:True
) –Enable inference mode in runner (default: True).
__post_init__
Parse dataclass enums.
defaults
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
TorchTensorRTConfig
dataclass
TorchTensorRTConfig(custom_args=dict(), device=None, trt_profiles=None, trt_profile=None, precision=DEFAULT_TENSORRT_PRECISION, precision_mode=DEFAULT_TENSORRT_PRECISION_MODE, max_workspace_size=DEFAULT_MAX_WORKSPACE_SIZE, run_max_batch_size_search=None)
Bases: CustomConfigForTensorRT
Torch custom config used for TensorRT TorchScript conversion.
__post_init__
Initialize common TensorRT parameters and validate configuration.
Source code in model_navigator/configuration/__init__.py
defaults
Update parameters to defaults.
Source code in model_navigator/configuration/__init__.py
filter_data
staticmethod
Filter fields in dictionary.
Parameters:
Returns:
-
–
Filtered dictionary
Source code in model_navigator/utils/common.py
from_dict
classmethod
Instantiate TorchTensorRTConfig from a dictionary.
Source code in model_navigator/configuration/__init__.py
name
classmethod
parse_data
staticmethod
Parse values in provided data.
Parameters:
-
data
(Dict
) –Dictionary with data to parse
Returns:
-
–
Parsed dictionary
Source code in model_navigator/utils/common.py
parse_value
staticmethod
Parse value to jsonable format.
Parameters:
-
value
(Any
) –Value to be parsed.
Returns:
Source code in model_navigator/utils/common.py
to_dict
Serialize to a dictionary.
Parameters:
-
filter_fields
(Optional[List[str]]
, default:None
) –List of fields to filter out. Defaults to None.
-
parse
(bool
, default:False
) –If True recursively parse field values to jsonable representation. Defaults to False.
Returns:
-
Dict
(Dict
) –Data serialized to a dictionary.
Source code in model_navigator/utils/common.py
map_custom_configs
Map custom configs from list to dictionary.
Parameters:
-
custom_configs
(Optional[Sequence[CustomConfig]]
) –List of custom configs passed to API method
Returns:
-
Dict
–Mapped configs to dictionary
Source code in model_navigator/configuration/__init__.py
model_navigator.MaxThroughputAndMinLatencyStrategy
Bases: RuntimeSearchStrategy
Get runtime with the highest throughput and the lowest latency.
model_navigator.MaxThroughputStrategy
Bases: RuntimeSearchStrategy
Get runtime with the highest throughput.
model_navigator.MinLatencyStrategy
Bases: RuntimeSearchStrategy
Get runtime with the lowest latency.