With this Dataiku DSS plugin one can export Visual Deep Learning
and Keras .h5 models
to ONNX format
ONNX is an open format built to represent machine learning models for scoring (inference) purposes. ONNX defines a common set of operators - the building blocks of machine learning and deep learning models - and a common file format to enable AI developers to use models with a variety of frameworks, tools, runtimes, and compilers. More info here
This plugin aims at offering an easy way to deploy deep learning models to various systems with the ONNX runtime. You can learn more about the languages, architectures and hardware accelerations supported by ONNX runtime here
This DSS plugin offers the conversion of two kinds of models:
- Visual Deep Learning models trained with DSS
- Keras
.h5 models
.
This plugin contains one recipe and one macro for each conversion type.
Visual Deep Learning models trained with DSS:
Keras .h5 models
:
- (If you don't already have one) create a DSS python3 code environment, adding to it the Visual Deep Learning packages preset.
- Train a Visual Deep learning model in DSS with this code environment (here is a tutorial to help you get started)
- Install this plugin
- Go the flow
- Click on the saved model
- In the right panel in the
other actions section
, click onExport to ONNX
- Fill in the parameters (details below)
- Click on
RUN MACRO
- Click on
Download ONNX model
to trigger the download. The model has also been added to the output folder
Saved model
(DSS saved model): Visual Deep Learning model trained in DSS to convertOutput folder
(DSS managed folder): Folder where the ONNX model will be addedOutput model path
(String): Path where the ONNX model will be storedOverwrite if exists
(boolean): Whether the model should overwrite the existing file at same path (if it already exists)Fixed batch size
(boolean): Some runtimes do not support dynamic batch size and thereefore the size should be specified during export.Batch size
(int) [optional]: Batch size of the model's inputForce input/output to Float (32 bits)
(boolean): Some runtimes do not supportDouble
. Uncheck if your runtime supportsDouble
- Put a .h5 model file obtained through Keras's model.save() method into a DSS Managed Folder
- Go to flow
- Click on the folder
- In the right panel in the
other actions section
, click onExport .h5 to ONNX
- Fill in the parameters (details below)
- Click on
RUN MACRO
- Click on
Download onnx model
to trigger the download. The model has also been added to the output folder
Input folder
(DSS managed folder): Folder where the .h5 model isModel path
(String): Path to the .h5 model to convertOutput folder
(DSS managed folder) [optional]: Folder where the ONNX model will be added. IfOutput folder
is left empty the model is added to the input folder.Output model path
(String): Path where the ONNX model will be storedOverwrite if exists
(boolean): Whether the model should overwrite the existing file at same path (if it already exists)Fixed batch size
(boolean): Some runtimes do not support dynamic batch size and thereefore the size should be specified during export.Batch size
(int) [optional]: Batch size of the model's inputForce input/output to Float (32 bits)
(boolean): Some runtimes do not supportDouble
. Uncheck if your runtime supportsDouble
The macros are also available in the Macro
menu of a project.
- Create (if you don't already have one) a DSS python3 code environment, adding to it the Visual Deep Learning packages preset.
- Train a Visual Deep learning model in DSS with this code env
- Create a managed folder by clicking on
+ DATASET > Folder
- Install this plugin
- Go the flow
- Click on the
+ RECIPE > ONNX exporter
button - Click on the
Convert saved model
option in the modal - Choose the saved model you just trained as input and the folder you created as output
- Fill in the parameters on the recipe page (details below)
Output model path
(String): Path where the ONNX model will be storedOverwrite if exists
(boolean): Whether the model should overwrite the existing file at same path (if it already exists)Fixed batch size
(boolean): Some runtimes do not support dynamic batch size and thereefore the size should be specified during export.Batch size
(int) [optional]: Batch size of the model's inputForce input/output to Float (32 bits)
(boolean): Some runtimes do not supportDouble
. Uncheck if your runtime supportsDouble
-
Put a .h5 model file obtained through Keras's model.save() method into a DSS Managed Folder
-
Go to flow
-
Click on the folder
-
In the right panel in the Plugin recipes section, click on
ONNX exporter
-
Click on the
Convert Keras .h5 model
option in the modal -
Fill in the parameters (details below)
Model path
(String): Path to the .h5 model to convertOutput folder
(DSS managed folder) [optional]: Folder where the ONNX model will be added. IfOutput folder
is left empty the model is added to the input folder.Output model path
(String): Path where the ONNX model will be storedOverwrite if exists
(boolean): Whether the model should overwrite the existing file at same path (if it already exists)Fixed batch size
(boolean): Some runtimes do not support dynamic batch size and thereefore the size should be specified during export.Batch size
(int) [optional]: Batch size of the model's inputForce input/output to Float (32 bits)
(boolean): Some runtimes do not supportDouble
. Uncheck if your runtime supportsDouble