@@ -10,9 +10,54 @@ namespace Microsoft.ML.Models
10
10
public sealed partial class OnnxConverter
11
11
{
12
12
/// <summary>
13
- /// Converts the model to ONNX format.
13
+ /// <see href="https://onnx.ai/">ONNX</see> is an intermediate representation format
14
+ /// for machine learning models. It is used to make models portable such that you can
15
+ /// train a model using a toolkit and run it in another tookit's runtime, for example,
16
+ /// you can create a model using ML.NET (or any ONNX compatible toolkit), convert it to ONNX and
17
+ /// then the ONNX model can be converted into say, CoreML, TensorFlow or WinML model
18
+ /// to run on the respective runtime.
19
+ ///
20
+ /// This API converts an ML.NET model to ONNX format by inspecting the transform pipeline
21
+ /// from the end, checking for components that know how to save themselves as ONNX.
22
+ /// The first item in the transform pipeline that does not know how to save itself
23
+ /// as ONNX, is considered the "input" to the ONNX pipeline. (Ideally this would be the
24
+ /// original loader itself, but this may not be possible if the user used unsavable
25
+ /// transforms in defining the pipe.) All the columns in the source that are a type the
26
+ /// ONNX knows how to deal with will be tracked. Intermediate transformations of the
27
+ /// data appearing as new columns will appear in the output block of the ONNX, with names
28
+ /// derived from the corresponding column names. The ONNX JSON will be serialized to a
29
+ /// path defined through the Json option.
30
+ ///
31
+ /// This API supports the following arguments:
32
+ /// <see cref="Onnx"/> indicates the file to write the ONNX protocol buffer file to. This is optional.
33
+ /// <see cref="Json"/> indicates the file to write the JSON representation of the ONNX model. This is optional.
34
+ /// <see cref="Name"/> indicates the name property in the ONNX model. If left unspecified, it will
35
+ /// be the extension-less name of the file specified in the onnx indicates the protocol buffer file
36
+ /// to write the ONNX representation to.
37
+ /// <see cref="Domain"/> indicates the domain name of the model. ONNX uses reverse domain name space indicators.
38
+ /// For example com.microsoft.cognitiveservices. This is a required field.
39
+ /// <see cref="InputsToDrop"/> is a string array of input column names to omit from the input mapping.
40
+ /// A common scenario might be to drop the label column, for instance, since it may not be practically
41
+ /// useful for the pipeline. Note that any columns depending on these naturally cannot be saved.
42
+ /// <see cref="OutputsToDrop"/> is similar, except for the output schema. Note that the pipeline handler
43
+ /// is currently not intelligent enough to drop intermediate calculations that produce this value: this will
44
+ /// merely omit that value from the actual output.
45
+ ///
46
+ /// Transforms that can be exported to ONNX
47
+ /// 1. Concat
48
+ /// 2. KeyToVector
49
+ /// 3. NAReplace
50
+ /// 4. Normalize
51
+ /// 5. Term
52
+ /// 6. Categorical
53
+ ///
54
+ /// Learners that can be exported to ONNX
55
+ /// 1. FastTree
56
+ /// 2. LightGBM
57
+ /// 3. Logistic Regression
58
+ ///
14
59
/// See <a href="https://github.com/dotnet/machinelearning/blob/master/test/Microsoft.ML.Tests/OnnxTests.cs"/>
15
- /// for an example.
60
+ /// for an example on how to train a model and then convert that model to ONNX .
16
61
/// </summary>
17
62
/// <param name="model">Model that needs to be converted to ONNX format.</param>
18
63
public void Convert ( PredictionModel model )
0 commit comments