( ort_config: ORTConfig optimization_config: OptimizationConfig **kwargs )
Handles the ONNX Runtime optimization process for models shared on huggingface.co/models.
( model_name_or_path: typing.Union[str, os.PathLike] output_path: typing.Union[str, os.PathLike] feature: str = 'default' **kwargs )
Parameters
revision can be any
identifier allowed by git.
Loads and exports a model to an ONNX Intermediate Representation (IR).
( model_name_or_path: typing.Union[str, os.PathLike] output_dir: typing.Union[str, os.PathLike] feature: str = 'default' config: typing.Optional[transformers.configuration_utils.PretrainedConfig] = None **kwargs )
Parameters
revision can be any
identifier allowed by git.
Applies the ONNX Runtime graph-level optimization on a given model and saves the resulting model.
(
onnx_model_path: typing.Optional[str] = None
optimized_model_path: typing.Optional[str] = None
summary: bool = True
nodes_details: bool = True
)
→
sorted_nodes_change (List[Tuple[str, int]])
Parameters
str, optional) —
Path of a stored ONNX model.
str, optional) —
Path of the corresponding optimized ONNX model.
bool, defaults to True) —
Whether report the optimization details: reduction of nodes, and complex node fusions.
bool, defaults to True) —
Whether report the top 5 reduced op_types, and return the detailed node change list.
Returns
sorted_nodes_change (List[Tuple[str, int]])
Returns a sorted list with op types and its change after the optimization.
Returns a dictionary reporting the optimization.