( onnx_model_path: typing.List[os.PathLike] config: PretrainedConfig )
Handles the ONNX Runtime optimization process for models shared on huggingface.co/models.
( model_or_path: typing.Union[str, os.PathLike, optimum.onnxruntime.modeling_ort.ORTModel] file_names: typing.Optional[typing.List[str]] = None )
Parameters
Union[str, os.PathLike, ORTModel]) —
The path to a local directory hosting the model to optimize or an instance of an ORTModel to quantize.
Can be either:List[str], optional) —
The list of file names of the models to optimize.
( onnx_model_path: typing.Union[str, os.PathLike] )
Computes the dictionary mapping the name of the fused operators to their number of apparition in the model.
( onnx_model_path: typing.Union[str, os.PathLike] onnx_optimized_model_path: typing.Union[str, os.PathLike] )
Compute the difference in the number of nodes between the original and the optimized model.
( onnx_model_path: typing.Union[str, os.PathLike] onnx_optimized_model_path: typing.Union[str, os.PathLike] )
Compute the dictionary mapping the operators name to the difference in the number of corresponding nodes between the original and the optimized model.
( optimization_config: OptimizationConfig save_dir: typing.Union[str, os.PathLike] file_suffix: typing.Optional[str] = 'optimized' use_external_data_format: bool = False )
Parameters
OptimizationConfig) —
The configuration containing the parameters related to optimization.
Union[str, os.PathLike]) —
The path used to save the optimized model.
str, optional, defaults to "optimized") —
The file suffix used to save the optimized model.
bool, optional, defaults to False) —
Whether to use external data format to store model of size >= 2Gb.
Optimizes a model given the optimization specifications defined in optimization_config.