Skip to content

Remove and combine Microsoft.ML.UniversalModelFormat.Onnx with Microsoft.ML.Model.OnnxConverter. #2722

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

Merged
merged 1 commit into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.ML.OnnxConverter/OnnxContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Data.DataView;
using Microsoft.ML.UniversalModelFormat.Onnx;
using Microsoft.ML.Model.OnnxConverter;

namespace Microsoft.ML.Model.OnnxConverter
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.OnnxConverter/OnnxExportExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Google.Protobuf;
using Microsoft.Data.DataView;
using Microsoft.ML.Model.OnnxConverter;
using static Microsoft.ML.UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper;
using static Microsoft.ML.Model.OnnxConverter.OnnxCSharpToProtoWrapper;

namespace Microsoft.ML
{
Expand Down
258 changes: 129 additions & 129 deletions src/Microsoft.ML.OnnxConverter/OnnxMl.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Microsoft.ML.OnnxConverter/OnnxMl.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
2. Download protobuf C# compiler version 3.0 or greater from
https://github.com/google/protobuf/tree/master/csharp
3. Add `option csharp_namespace =
"Microsoft.ML.UniversalModelFormat.Onnx";` to `onnx-ml.proto3` right below `package ONNX_NAMESPACE;`
"Microsoft.ML.Model.OnnxConverter";` to `onnx-ml.proto3` right below `package ONNX_NAMESPACE;`
4. Assuming the compiler and proto file are saved at
`E:\protobuf-csharp-port\lib` then run the following in command line to get C# code from the proto file:
```
protoc.exe -I="E:\protobuf-csharp-port\lib" --csharp_out="E:\protobuf-csharp-port\lib" "E:\protobuf-csharp-port\lib\onnx-ml.proto3"
```
5. Find-Replace `public` with `internal` in `OnnxMl.cs`, wrap the root class in OnnxMl.cs with `internal class OnnxCSharpToProtoWrapper and append '.OnnxCSharpToProtoWrapper` to `Microsoft.ML.UniversalModelFormat.Onnx` namespace prefix whereever there is an error`.
5. Find-Replace `public` with `internal` in `OnnxMl.cs`, wrap the root class in OnnxMl.cs with `internal class OnnxCSharpToProtoWrapper and append '.OnnxCSharpToProtoWrapper` to `Microsoft.ML.Model.OnnxConverter` namespace prefix whereever there is an error`.

## The proto3 file is current as of 06/01/2018 and generated from onnx-ml.proto3 based on the following commit https://github.com/onnx/onnx/commit/33e9cd4182fe468675241fba4ae8a16c2f0bd82f
2 changes: 1 addition & 1 deletion src/Microsoft.ML.OnnxConverter/OnnxNodeImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System;
using System.Collections.Generic;
using static Microsoft.ML.UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper;
using static Microsoft.ML.Model.OnnxConverter.OnnxCSharpToProtoWrapper;

namespace Microsoft.ML.Model.OnnxConverter
{
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.OnnxConverter/OnnxUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Google.Protobuf;
using Microsoft.Data.DataView;
using Microsoft.ML.Data;
using static Microsoft.ML.UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper;
using static Microsoft.ML.Model.OnnxConverter.OnnxCSharpToProtoWrapper;

namespace Microsoft.ML.Model.OnnxConverter
{
Expand Down Expand Up @@ -255,7 +255,7 @@ public static ModelProto MakeModel(List<NodeProto> nodes, string producerName, s
model.Domain = domain;
model.ProducerName = producerName;
model.ProducerVersion = producerVersion;
model.IrVersion = (long)UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper.Version.IrVersion;
model.IrVersion = (long)OnnxCSharpToProtoWrapper.Version.IrVersion;
model.ModelVersion = modelVersion;
model.OpsetImport.Add(new OperatorSetIdProto() { Domain = "ai.onnx.ml", Version = 1 });
model.OpsetImport.Add(new OperatorSetIdProto() { Domain = "", Version = 7 });
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.OnnxConverter/SaveOnnxCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.ML.Internal.Utilities;
using Microsoft.ML.Model.OnnxConverter;
using Newtonsoft.Json;
using static Microsoft.ML.UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper;
using static Microsoft.ML.Model.OnnxConverter.OnnxCSharpToProtoWrapper;

[assembly: LoadableClass(SaveOnnxCommand.Summary, typeof(SaveOnnxCommand), typeof(SaveOnnxCommand.Arguments), typeof(SignatureCommand),
"Save ONNX", "SaveOnnx", DocName = "command/SaveOnnx.md")]
Expand Down
4 changes: 2 additions & 2 deletions test/Microsoft.ML.Tests/OnnxConversionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Newtonsoft.Json;
using Xunit;
using Xunit.Abstractions;
using static Microsoft.ML.UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper;
using static Microsoft.ML.Model.OnnxConverter.OnnxCSharpToProtoWrapper;

namespace Microsoft.ML.Tests
{
Expand All @@ -40,7 +40,7 @@ public OnnxConversionTest(ITestOutputHelper output) : base(output)
}

/// <summary>
/// In this test, we convert a trained <see cref="TransformerChain"/> into ONNX <see cref="UniversalModelFormat.Onnx.OnnxCSharpToProtoWrapper.ModelProto"/> file and then
/// In this test, we convert a trained <see cref="TransformerChain"/> into ONNX <see cref="ModelProto"/> file and then
/// call <see cref="OnnxScoringEstimator"/> to evaluate that file. The outputs of <see cref="OnnxScoringEstimator"/> are checked against the original
/// ML.NET model's outputs.
/// </summary>
Expand Down