-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ONNX API documentation. #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fc17a17
3619573
e31d4ca
ca7942c
48ab0b4
67e1d00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,54 @@ namespace Microsoft.ML.Models | |
public sealed partial class OnnxConverter | ||
{ | ||
/// <summary> | ||
/// Converts the model to ONNX format. | ||
/// <see href="https://onnx.ai/">ONNX</see> is an intermediate representation format | ||
/// for machine learning models. It is used to make models portable such that you can | ||
/// train a model using a toolkit and run it in another tookit's runtime, for example, | ||
/// you can create a model using ML.NET (or any ONNX compatible toolkit), convert it to ONNX and | ||
/// then the ONNX model can be converted into say, CoreML, TensorFlow or WinML model | ||
/// to run on the respective runtime. | ||
/// | ||
/// This API converts an ML.NET model to ONNX format by inspecting the transform pipeline | ||
/// from the end, checking for components that know how to save themselves as ONNX. | ||
/// The first item in the transform pipeline that does not know how to save itself | ||
/// as ONNX, is considered the "input" to the ONNX pipeline. (Ideally this would be the | ||
/// original loader itself, but this may not be possible if the user used unsavable | ||
/// transforms in defining the pipe.) All the columns in the source that are a type the | ||
/// ONNX knows how to deal with will be tracked. Intermediate transformations of the | ||
/// data appearing as new columns will appear in the output block of the ONNX, with names | ||
/// derived from the corresponding column names. The ONNX JSON will be serialized to a | ||
/// path defined through the Json option. | ||
/// | ||
/// This API supports the following arguments: | ||
/// <see cref="Onnx"/> indicates the file to write the ONNX protocol buffer file to. This is optional. | ||
/// <see cref="Json"/> indicates the file to write the JSON representation of the ONNX model. This is optional. | ||
/// <see cref="Name"/> indicates the name property in the ONNX model. If left unspecified, it will | ||
/// be the extension-less name of the file specified in the onnx indicates the protocol buffer file | ||
/// to write the ONNX representation to. | ||
/// <see cref="Domain"/> indicates the domain name of the model. ONNX uses reverse domain name space indicators. | ||
/// For example com.microsoft.cognitiveservices. This is a required field. | ||
/// <see cref="InputsToDrop"/> is a string array of input column names to omit from the input mapping. | ||
/// A common scenario might be to drop the label column, for instance, since it may not be practically | ||
/// useful for the pipeline. Note that any columns depending on these naturally cannot be saved. | ||
/// <see cref="OutputsToDrop"/> is similar, except for the output schema. Note that the pipeline handler | ||
/// is currently not intelligent enough to drop intermediate calculations that produce this value: this will | ||
/// merely omit that value from the actual output. | ||
/// | ||
/// Transforms that can be exported to ONNX | ||
/// 1. Concat | ||
/// 2. KeyToVector | ||
/// 3. NAReplace | ||
/// 4. Normalize | ||
/// 5. Term | ||
/// 6. Categorical | ||
/// | ||
/// Learners that can be exported to ONNX | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth referring to what it would take to expand this list? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if it is worth revealing anything that we are not sure about or isn't public. In reply to: 198317926 [](ancestors = 198317926) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we can say these are the most used learners. In reply to: 198318122 [](ancestors = 198318122,198317926) |
||
/// 1. FastTree | ||
/// 2. LightGBM | ||
/// 3. Logistic Regression | ||
/// | ||
/// See <a href="https://github.com/dotnet/machinelearning/blob/master/test/Microsoft.ML.Tests/OnnxTests.cs"/> | ||
/// for an example. | ||
/// for an example on how to train a model and then convert that model to ONNX. | ||
/// </summary> | ||
/// <param name="model">Model that needs to be converted to ONNX format.</param> | ||
public void Convert(PredictionModel model) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though you can guess from the context, I'd say "similar to InputsToDrop"