finetuner.tuner.onnx module#

finetuner.tuner.onnx.to_onnx(embed_model, model_path, input_shape, opset_version=11, input_type='float32')[source]#

Func that takes a model in PaddlePaddle, PyTorch or Keras, and converts it to the ONNX format :params embed_model: Model to be converted and stored in ONNX :params model_path: Path to store ONNX model to :params input_shape: Input shape of embedding model :params opset_version: ONNX opset version in which to register :params input_type: Input type for model tracing during export of

PyTorch-based models

Return type


finetuner.tuner.onnx.validate_onnx_export(embed_model, export_path, input_shape)[source]#

Test an exported model by comparing the outputs of the original and the exported model against the same input. :params embed_model: The original embedding model. Can be either a PyTorch module,

a Keras model or a PaddlePaddle layer.

Params export_path

The path where the exported model is stored.

Params input_shape

The model’s expected input shape, without the batch axis.

Return type