From ac4aaacfc0a845898ad249d0a1c745d3d3a163cb Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 9 Jan 2019 01:56:10 +0000
Subject: [PATCH 01/19] Initial checking to run unit tests on Linux
---
Directory.Build.props | 1 +
build/Dependencies.props | 2 +-
.../Microsoft.ML.OnnxTransform.nupkgproj | 2 +-
.../Microsoft.ML.OnnxTransform.csproj | 2 +-
.../OnnxTransformTests.cs | 17 +++++++++--------
5 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 497572b99f..1dd337e7ad 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -18,6 +18,7 @@
https://api.nuget.org/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
+ https://www.myget.org/F/onnxruntime-dev/api/v3/index.json
diff --git a/build/Dependencies.props b/build/Dependencies.props
index d10339d749..ffec68e728 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.1.5
+ 0.1.5-dev-fb1ba09f
0.0.0.7
2.1.3
4.5.0
diff --git a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
index 27c03c1848..253197ee88 100644
--- a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
+++ b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
index 81f014d392..d4e4df09a7 100644
--- a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
+++ b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index 0954396c15..fcef22f5d5 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -86,7 +86,7 @@ public OnnxTransformTests(ITestOutputHelper output) : base(output)
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
void TestSimpleCase()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
var modelFile = "squeezenet/00000001/model.onnx";
@@ -189,7 +189,7 @@ void TestOldSavingAndLoading(int? gpuDeviceId, bool fallbackToCpu)
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
public void OnnxStatic()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
var modelFile = "squeezenet/00000001/model.onnx";
@@ -231,21 +231,22 @@ public void OnnxStatic()
}
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
+ //[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
+ [Fact(Skip = "Skip Temporaily")]
void TestCommandLine()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
var env = new MLContext();
var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx} GpuDeviceId=0 FallbackToCpu=+}" });
Assert.Equal(0, x);
}
-
+
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
public void OnnxModelScenario()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
var modelFile = "squeezenet/00000001/model.onnx";
@@ -282,7 +283,7 @@ public void OnnxModelScenario()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
public void OnnxModelMultiInput()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
var modelFile = @"twoinput\twoinput.onnx";
@@ -328,7 +329,7 @@ public void OnnxModelMultiInput()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
public void TestUnknownDimensions()
{
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
// model contains -1 in input and output shape dimensions
From 8efafe6bc404308aa88af209fc5433d4b1b3112b Mon Sep 17 00:00:00 2001
From: jignparm
Date: Sat, 19 Jan 2019 02:12:03 +0000
Subject: [PATCH 02/19] Test linux execution on dev package of onnxruntime
---
build/Dependencies.props | 2 +-
.../Microsoft.ML.OnnxTransform.nupkgproj | 2 +-
.../Microsoft.ML.OnnxTransform.csproj | 2 +-
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 13 ++++++++-----
src/Microsoft.ML.OnnxTransform/OnnxUtils.cs | 6 ++++--
.../OnnxTransformTests.cs | 5 ++---
6 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/build/Dependencies.props b/build/Dependencies.props
index ffec68e728..b70fc6c86f 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.1.5-dev-fb1ba09f
+ 0.1.5-dev-0d45203b
0.0.0.7
2.1.3
4.5.0
diff --git a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
index 253197ee88..b817e809d1 100644
--- a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
+++ b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
index d4e4df09a7..ce2ac23746 100644
--- a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
+++ b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index e81ca8d7f7..6d81ce8765 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -43,16 +43,19 @@ namespace Microsoft.ML.Transforms
///
///
/// Supports inferencing of models in ONNX 1.2 and 1.3 format (opset 7, 8 and 9), using the
- /// Microsoft.ML.OnnxRuntime.Gpu library.
+ /// Microsoft.ML.OnnxRuntime library.
///
- /// Models are scored on CPU by default. If GPU execution is needed (optional), install
+ ///
Models are scored on CPU by default. If GPU execution is needed (optional), use the
+ /// NuGet package available at
+ /// Microsoft.ML.OnnxRuntime.Gpu
+ /// and download
/// CUDA 10.0 Toolkit
/// and
- /// cuDNN
- /// , and set the parameter 'gpuDeviceId' to a valid non-negative integer. Typical device ID values are 0 or 1.
+ /// cuDNN.
+ /// Set parameter 'gpuDeviceId' to a valid non-negative integer. Typical device ID values are 0 or 1.
///
/// The inputs and outputs of the ONNX models must be Tensor type. Sequence and Maps are not yet supported.
- /// OnnxRuntime currently works on Windows 64-bit platforms only. Linux and OSX to be supported soon.
+ /// OnnxRuntime currently works on Windows and Linux 64-bit platforms. OSX to be supported soon.
/// Visit https://github.com/onnx/models to see a list of readily available models to get started with.
/// Refer to http://onnx.ai' for more information about ONNX.
///
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
index 68c6b11797..36035a421b 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
@@ -81,11 +81,13 @@ public OnnxModel(string modelFile, int? gpuDeviceId = null, bool fallbackToCpu =
{
_modelFile = modelFile;
- if (gpuDeviceId.HasValue)
+ // Reserve Int32.MinValue for test purpose.
+ if (gpuDeviceId.HasValue && gpuDeviceId.Value != Int32.MinValue)
{
try
{
- _session = new InferenceSession(modelFile, SessionOptions.MakeSessionOptionWithCudaProvider(gpuDeviceId.Value));
+ _session = new InferenceSession(modelFile,
+ SessionOptions.MakeSessionOptionWithCudaProvider(gpuDeviceId.Value));
}
catch (OnnxRuntimeException)
{
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index 76a381f62e..eb85c5fe58 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -231,15 +231,14 @@ public void OnnxStatic()
}
}
- //[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
- [Fact(Skip = "Skip Temporaily")]
+ [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
void TestCommandLine()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
var env = new MLContext();
- var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx} GpuDeviceId=0 FallbackToCpu=+}" });
+ var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx} GpuDeviceId=" + Int32.MinValue + " FallbackToCpu=+}" });
Assert.Equal(0, x);
}
From 683579b3c2759c2441fc2920dff3d0610e0dd7d9 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 23 Jan 2019 07:37:22 +0000
Subject: [PATCH 03/19] Added fix to onnxruntime nuget prop file to handle
Linux dlls correctly
---
build/Dependencies.props | 2 +-
test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/build/Dependencies.props b/build/Dependencies.props
index b70fc6c86f..b25535ca5c 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.1.5-dev-0d45203b
+ 0.1.5-dev-ba12d665
0.0.0.7
2.1.3
4.5.0
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index eb85c5fe58..bf903626ea 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -192,7 +192,7 @@ public void OnnxStatic()
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
- var modelFile = "squeezenet/00000001/model.onnx";
+ var modelFile = Path.Combine(Directory.GetCurrentDirectory(), "squeezenet", "00000001", "model.onnx");
var env = new MLContext(conc: 1);
var imageHeight = 224;
@@ -283,7 +283,7 @@ public void OnnxModelMultiInput()
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return;
- var modelFile = @"twoinput\twoinput.onnx";
+ var modelFile = Path.Combine(Directory.GetCurrentDirectory(), "twoinput", "twoinput.onnx");
using (var env = new ConsoleEnvironment(seed: 1, conc: 1))
{
var samplevector = GetSampleArrayData();
From bde81d364b5c13e6dbb31eff54d0d805a40827bd Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 23 Jan 2019 22:03:02 +0000
Subject: [PATCH 04/19] test package copying all native dlls to output folder
---
build/Dependencies.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/Dependencies.props b/build/Dependencies.props
index b25535ca5c..5526a0abea 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.1.5-dev-ba12d665
+ 0.1.5-dev-f6c959a7
0.0.0.7
2.1.3
4.5.0
From 753bcaac31026a39806f8430b145224833ee6285 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Thu, 24 Jan 2019 01:00:19 +0000
Subject: [PATCH 05/19] Add rpath to dll
---
build/Dependencies.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/Dependencies.props b/build/Dependencies.props
index 5526a0abea..dd4f3df482 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.1.5-dev-f6c959a7
+ 0.1.5-dev-dff25607
0.0.0.7
2.1.3
4.5.0
From 4fa7a9f7991d89e404fb7836cb6414e057298ac8 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Tue, 29 Jan 2019 08:47:20 +0000
Subject: [PATCH 06/19] Update to Onnxruntime 2.0 package
---
build/Dependencies.props | 2 +-
.../Microsoft.ML.OnnxTransform.nupkgproj | 2 +-
.../Microsoft.ML.OnnxTransform.csproj | 2 +-
.../OnnxTransform.cs | 4 +--
.../DnnImageFeaturizerTest.cs | 6 ++++
.../OnnxTransformTests.cs | 28 ++++++++++++++-----
6 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/build/Dependencies.props b/build/Dependencies.props
index dd4f3df482..41b35acbe1 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.1.5-dev-dff25607
+ 0.2.0
0.0.0.7
2.1.3
4.5.0
diff --git a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
index b817e809d1..b79e3e13c6 100644
--- a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
+++ b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
index ce2ac23746..831646f1fe 100644
--- a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
+++ b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index 6d81ce8765..8e37d36c79 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -49,13 +49,13 @@ namespace Microsoft.ML.Transforms
/// NuGet package available at
/// Microsoft.ML.OnnxRuntime.Gpu
/// and download
- /// CUDA 10.0 Toolkit
+ /// CUDA 9.1 Toolkit
/// and
/// cuDNN.
/// Set parameter 'gpuDeviceId' to a valid non-negative integer. Typical device ID values are 0 or 1.
///
/// The inputs and outputs of the ONNX models must be Tensor type. Sequence and Maps are not yet supported.
- /// OnnxRuntime currently works on Windows and Linux 64-bit platforms. OSX to be supported soon.
+ /// OnnxRuntime currently works on Windows and Ubuntu 16.04 Linux 64-bit platforms. OSX to be supported soon.
/// Visit https://github.com/onnx/models to see a list of readily available models to get started with.
/// Refer to http://onnx.ai' for more information about ONNX.
///
diff --git a/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs b/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
index 43d270a414..f6b73c7f8e 100644
--- a/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
@@ -60,6 +60,8 @@ public DnnImageFeaturizerTests(ITestOutputHelper helper) : base(helper)
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
void TestDnnImageFeaturizer()
{
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
@@ -98,6 +100,8 @@ void TestDnnImageFeaturizer()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
public void OnnxStatic()
{
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
@@ -141,6 +145,8 @@ public void OnnxStatic()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
public void TestOldSavingAndLoading()
{
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index bf903626ea..3978c60eb4 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -86,7 +86,9 @@ public OnnxTransformTests(ITestOutputHelper output) : base(output)
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
void TestSimpleCase()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
var modelFile = "squeezenet/00000001/model.onnx";
@@ -131,6 +133,8 @@ void TestSimpleCase()
[InlineData(null, true)]
void TestOldSavingAndLoading(int? gpuDeviceId, bool fallbackToCpu)
{
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
@@ -189,7 +193,9 @@ void TestOldSavingAndLoading(int? gpuDeviceId, bool fallbackToCpu)
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
public void OnnxStatic()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
var modelFile = Path.Combine(Directory.GetCurrentDirectory(), "squeezenet", "00000001", "model.onnx");
@@ -234,7 +240,9 @@ public void OnnxStatic()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
void TestCommandLine()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
var env = new MLContext();
@@ -245,7 +253,9 @@ void TestCommandLine()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
public void OnnxModelScenario()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
var modelFile = "squeezenet/00000001/model.onnx";
@@ -280,7 +290,9 @@ public void OnnxModelScenario()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
public void OnnxModelMultiInput()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
var modelFile = Path.Combine(Directory.GetCurrentDirectory(), "twoinput", "twoinput.onnx");
@@ -296,7 +308,7 @@ public void OnnxModelMultiInput()
inb = new float[] {1,2,3,4,5}
}
});
- var onnx = new OnnxTransformer(env, modelFile, new[] { "ina", "inb" }, new[] { "outa", "outb" }).Transform(dataView);
+ var onnx = new OnnxTransformer(env, modelFile, new[] { "ina", "inb" }, new[] { "outa", "outb" }, 0).Transform(dataView);
onnx.Schema.TryGetColumnIndex("outa", out int scoresa);
onnx.Schema.TryGetColumnIndex("outb", out int scoresb);
@@ -323,7 +335,9 @@ public void OnnxModelMultiInput()
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
public void TestUnknownDimensions()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ // Onnxruntime supports Ubuntu 16.04, but not CentOS
+ // Do not execute on CentOS image
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
// model contains -1 in input and output shape dimensions
From 9e2e5dcff1992055baefba1fe750c20cb5bcc1bf Mon Sep 17 00:00:00 2001
From: jignparm
Date: Tue, 29 Jan 2019 09:05:58 +0000
Subject: [PATCH 07/19] use cpu package
---
build/Dependencies.props | 2 +-
.../Microsoft.ML.OnnxTransform.nupkgproj | 2 +-
.../Microsoft.ML.OnnxTransform.csproj | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/build/Dependencies.props b/build/Dependencies.props
index 41b35acbe1..89640c55a8 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -15,7 +15,7 @@
3.5.1
2.2.1.1
- 0.2.0
+ 0.2.0
0.0.0.7
2.1.3
4.5.0
diff --git a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
index b79e3e13c6..b817e809d1 100644
--- a/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
+++ b/pkg/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.nupkgproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
index 831646f1fe..ce2ac23746 100644
--- a/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
+++ b/src/Microsoft.ML.OnnxTransform/Microsoft.ML.OnnxTransform.csproj
@@ -9,7 +9,7 @@
-
+
From 2cbfaaa55af06b6e6db494793c75de663f8c7df2 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Tue, 29 Jan 2019 09:31:50 +0000
Subject: [PATCH 08/19] uncomment device id in unit test
---
test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index 3978c60eb4..e0769bafaf 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -308,7 +308,7 @@ public void OnnxModelMultiInput()
inb = new float[] {1,2,3,4,5}
}
});
- var onnx = new OnnxTransformer(env, modelFile, new[] { "ina", "inb" }, new[] { "outa", "outb" }, 0).Transform(dataView);
+ var onnx = new OnnxTransformer(env, modelFile, new[] { "ina", "inb" }, new[] { "outa", "outb" }).Transform(dataView);
onnx.Schema.TryGetColumnIndex("outa", out int scoresa);
onnx.Schema.TryGetColumnIndex("outb", out int scoresb);
From 54df111780e316a3d298b0093d0e7338b2c3d940 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 01:37:59 +0000
Subject: [PATCH 09/19] folder PR comments
---
.../OnnxTransform.cs | 4 +-
src/Microsoft.ML.OnnxTransform/OnnxUtils.cs | 2 +-
.../DnnImageFeaturizerTest.cs | 15 +---
.../OnnxTransformTests.cs | 70 +++++++------------
4 files changed, 34 insertions(+), 57 deletions(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index 8e37d36c79..315069867b 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -55,7 +55,7 @@ namespace Microsoft.ML.Transforms
/// Set parameter 'gpuDeviceId' to a valid non-negative integer. Typical device ID values are 0 or 1.
///
/// The inputs and outputs of the ONNX models must be Tensor type. Sequence and Maps are not yet supported.
- /// OnnxRuntime currently works on Windows and Ubuntu 16.04 Linux 64-bit platforms. OSX to be supported soon.
+ /// OnnxRuntime currently works on Windows and Ubuntu 16.04 Linux 64-bit platforms. Mac OS to be supported soon.
/// Visit https://github.com/onnx/models to see a list of readily available models to get started with.
/// Refer to http://onnx.ai' for more information about ONNX.
///
@@ -86,6 +86,8 @@ public sealed class Arguments : TransformInputBase
internal const string UserName = "ONNX Scoring Transform";
internal const string ShortName = "Onnx";
internal const string LoaderSignature = "OnnxTransform";
+ // A valid device ID, but run on CPU
+ public const int NullGpuID = int.MinValue;
public readonly string[] Inputs;
public readonly string[] Outputs;
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
index 36035a421b..60fa567ecf 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
@@ -82,7 +82,7 @@ public OnnxModel(string modelFile, int? gpuDeviceId = null, bool fallbackToCpu =
_modelFile = modelFile;
// Reserve Int32.MinValue for test purpose.
- if (gpuDeviceId.HasValue && gpuDeviceId.Value != Int32.MinValue)
+ if (gpuDeviceId != null && gpuDeviceId.Value != OnnxTransformer.NullGpuID)
{
try
{
diff --git a/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs b/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
index f6b73c7f8e..136e7b2609 100644
--- a/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
@@ -56,8 +56,7 @@ public DnnImageFeaturizerTests(ITestOutputHelper helper) : base(helper)
{
}
- // Onnx is only supported on x64 Windows
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
+ [OnnxFact]
void TestDnnImageFeaturizer()
{
// Onnxruntime supports Ubuntu 16.04, but not CentOS
@@ -96,8 +95,7 @@ void TestDnnImageFeaturizer()
catch (InvalidOperationException) { }
}
- // Onnx is only supported on x64 Windows
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
+ [OnnxFact]
public void OnnxStatic()
{
// Onnxruntime supports Ubuntu 16.04, but not CentOS
@@ -141,16 +139,9 @@ public void OnnxStatic()
}
}
- // Onnx is only supported on x64 Windows
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
+ [OnnxFact]
public void TestOldSavingAndLoading()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
-
var samplevector = GetSampleArrayData();
var dataView = ComponentCreation.CreateDataView(Env,
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index e0769bafaf..5fa4384512 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -21,9 +21,26 @@
namespace Microsoft.ML.Tests
{
- public class OnnxTransformTests : TestDataPipeBase
+
+ ///
+ /// A Fact attribute for Onnx unit tests. Onnxruntime only supported
+ /// on Windows, Linux (Ubuntu 16.04) and 64-bit platforms.
+ ///
+ public class OnnxFact : FactAttribute
{
+ public OnnxFact()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
+ RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ||
+ !Environment.Is64BitProcess)
+ {
+ Skip = "Require 64 bit and Windows or Linux (Ubuntu 16.04).";
+ }
+ }
+ }
+ public class OnnxTransformTests : TestDataPipeBase
+ {
private const int inputSize = 150528;
private class TestData
@@ -83,18 +100,11 @@ public OnnxTransformTests(ITestOutputHelper output) : base(output)
{
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
+ [OnnxFact]
void TestSimpleCase()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
var modelFile = "squeezenet/00000001/model.onnx";
-
var samplevector = GetSampleArrayData();
-
var dataView = ComponentCreation.CreateDataView(Env,
new TestData[] {
new TestData()
@@ -128,13 +138,12 @@ void TestSimpleCase()
catch (InvalidOperationException) { }
}
- [ConditionalTheory(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
+ // x86 not supported
+ [ConditionalTheory(typeof(Environment), nameof(Environment.Is64BitProcess))]
[InlineData(null, false)]
[InlineData(null, true)]
void TestOldSavingAndLoading(int? gpuDeviceId, bool fallbackToCpu)
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
@@ -190,14 +199,9 @@ void TestOldSavingAndLoading(int? gpuDeviceId, bool fallbackToCpu)
}
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 fails with "An attempt was made to load a program with an incorrect format."
+ [OnnxFact]
public void OnnxStatic()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
var modelFile = Path.Combine(Directory.GetCurrentDirectory(), "squeezenet", "00000001", "model.onnx");
var env = new MLContext(conc: 1);
@@ -237,27 +241,17 @@ public void OnnxStatic()
}
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
+ [OnnxFact]
void TestCommandLine()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
var env = new MLContext();
- var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx} GpuDeviceId=" + Int32.MinValue + " FallbackToCpu=+}" });
+ var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx} GpuDeviceId=" + OnnxTransformer.NullGpuID + " FallbackToCpu=+}" });
Assert.Equal(0, x);
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
+ [OnnxFact]
public void OnnxModelScenario()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
var modelFile = "squeezenet/00000001/model.onnx";
using (var env = new ConsoleEnvironment(seed: 1, conc: 1))
{
@@ -287,14 +281,9 @@ public void OnnxModelScenario()
}
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
+ [OnnxFact]
public void OnnxModelMultiInput()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
var modelFile = Path.Combine(Directory.GetCurrentDirectory(), "twoinput", "twoinput.onnx");
using (var env = new ConsoleEnvironment(seed: 1, conc: 1))
{
@@ -332,14 +321,9 @@ public void OnnxModelMultiInput()
}
}
- [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
+ [OnnxFact]
public void TestUnknownDimensions()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- return;
-
// model contains -1 in input and output shape dimensions
// model: input dims = [-1, 3], output argmax dims = [-1]
var modelFile = @"unknowndimensions/test_unknowndimensions_float.onnx";
From 9e223cd159d1889d1fd0a5005755674d31045dab Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 04:39:34 +0000
Subject: [PATCH 10/19] minor fix
---
.../DnnImageFeaturizerTest.cs | 23 +++++++++++--------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs b/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
index 02a35d4b1f..70ec3dffc8 100644
--- a/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/DnnImageFeaturizerTest.cs
@@ -49,7 +49,7 @@ private float[] GetSampleArrayData()
{
var samplevector = new float[inputSize];
for (int i = 0; i < inputSize; i++)
- samplevector[i] = (i / ((float) inputSize));
+ samplevector[i] = (i / ((float)inputSize));
return samplevector;
}
@@ -57,14 +57,15 @@ public DnnImageFeaturizerTests(ITestOutputHelper helper) : base(helper)
{
}
- [OnnxFact]
+ // Onnx is only supported on x64 Windows
+ [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
void TestDnnImageFeaturizer()
{
// Onnxruntime supports Ubuntu 16.04, but not CentOS
// Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
-
+
var samplevector = GetSampleArrayData();
@@ -96,11 +97,10 @@ void TestDnnImageFeaturizer()
catch (InvalidOperationException) { }
}
- [OnnxFact]
+ // Onnx is only supported on x64 Windows
+ [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
public void OnnxStatic()
{
- // Onnxruntime supports Ubuntu 16.04, but not CentOS
- // Do not execute on CentOS image
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
@@ -114,7 +114,7 @@ public void OnnxStatic()
imagePath: ctx.LoadText(0),
name: ctx.LoadText(1)))
.Read(dataFile);
-
+
var pipe = data.MakeNewEstimator()
.Append(row => (
row.name,
@@ -140,9 +140,14 @@ public void OnnxStatic()
}
}
- [OnnxFact]
+ // Onnx is only supported on x64 Windows
+ [ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))]
public void TestOldSavingAndLoading()
{
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ return;
+
+
var samplevector = GetSampleArrayData();
var dataView = ML.Data.ReadFromEnumerable(
@@ -155,7 +160,7 @@ public void TestOldSavingAndLoading()
var inputNames = "data_0";
var outputNames = "output_1";
- var est = new DnnImageFeaturizerEstimator(Env, outputNames, m => m.ModelSelector.ResNet18(m.Environment, m.OutputColumn ,m.InputColumn), inputNames);
+ var est = new DnnImageFeaturizerEstimator(Env, outputNames, m => m.ModelSelector.ResNet18(m.Environment, m.OutputColumn, m.InputColumn), inputNames);
var transformer = est.Fit(dataView);
var result = transformer.Transform(dataView);
var resultRoles = new RoleMappedData(result);
From eb7ca45470c0a0285c1bff5a269935edc7785d48 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 05:03:07 +0000
Subject: [PATCH 11/19] minor change to kick off build
---
test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index e9a1f2986d..51181c434b 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -148,7 +148,6 @@ void TestOldSavingAndLoading(int? gpuDeviceId, bool fallbackToCpu)
return;
var modelFile = "squeezenet/00000001/model.onnx";
-
var samplevector = GetSampleArrayData();
var dataView = ML.Data.ReadFromEnumerable(
From 526a0889d446b5dedd629c3fbc42565e68002b61 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 05:46:55 +0000
Subject: [PATCH 12/19] minor change to kick off build
---
test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index 51181c434b..03f7119514 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -347,4 +347,3 @@ public void TestUnknownDimensions()
}
}
}
-
From 78fc1e8bbe26935aaf9bf97922d3329dccf99390 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 07:16:26 +0000
Subject: [PATCH 13/19] remove reference to myget, and use nuget instead
---
Directory.Build.props | 1 -
1 file changed, 1 deletion(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 83c94cd0fb..f026f9cbe8 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -18,7 +18,6 @@
https://api.nuget.org/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
- https://www.myget.org/F/onnxruntime-dev/api/v3/index.json
From d132374a4aa5434c71bd00423a323d13ae73c378 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 18:50:47 +0000
Subject: [PATCH 14/19] removed nullgpuID. Use AtMostOnce for gpuDeviceID and
fallBackToCpu variables
---
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 6 ++----
src/Microsoft.ML.OnnxTransform/OnnxUtils.cs | 2 +-
test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index 56fb905a29..70c7792a68 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -73,10 +73,10 @@ public sealed class Arguments : TransformInputBase
[Argument(ArgumentType.Multiple | ArgumentType.Required, HelpText = "Name of the output column.", SortOrder = 2)]
public string[] OutputColumns;
- [Argument(ArgumentType.AtMostOnce | ArgumentType.Required, HelpText = "GPU device id to run on (e.g. 0,1,..). Null for CPU. Requires CUDA 10.0.", SortOrder = 3)]
+ [Argument(ArgumentType.AtMostOnce | ArgumentType.AtMostOnce, HelpText = "GPU device id to run on (e.g. 0,1,..). Null for CPU. Requires CUDA 9.1.", SortOrder = 3)]
public int? GpuDeviceId = null;
- [Argument(ArgumentType.AtMostOnce | ArgumentType.Required, HelpText = "If true, resumes execution on CPU upon GPU error. If false, will raise the GPU execption.", SortOrder = 4)]
+ [Argument(ArgumentType.AtMostOnce | ArgumentType.AtMostOnce, HelpText = "If true, resumes execution on CPU upon GPU error. If false, will raise the GPU execption.", SortOrder = 4)]
public bool FallbackToCpu = false;
}
@@ -87,8 +87,6 @@ public sealed class Arguments : TransformInputBase
internal const string UserName = "ONNX Scoring Transform";
internal const string ShortName = "Onnx";
internal const string LoaderSignature = "OnnxTransform";
- // A valid device ID, but run on CPU
- public const int NullGpuID = int.MinValue;
public readonly string[] Inputs;
public readonly string[] Outputs;
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
index 597b2e1786..bac380a302 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
@@ -83,7 +83,7 @@ public OnnxModel(string modelFile, int? gpuDeviceId = null, bool fallbackToCpu =
_modelFile = modelFile;
// Reserve Int32.MinValue for test purpose.
- if (gpuDeviceId != null && gpuDeviceId.Value != OnnxTransformer.NullGpuID)
+ if (gpuDeviceId != null)
{
try
{
diff --git a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
index 03f7119514..17a83041db 100644
--- a/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
+++ b/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs
@@ -246,7 +246,7 @@ public void OnnxStatic()
void TestCommandLine()
{
var env = new MLContext();
- var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx} GpuDeviceId=" + OnnxTransformer.NullGpuID + " FallbackToCpu=+}" });
+ var x = Maml.Main(new[] { @"showschema loader=Text{col=data_0:R4:0-150527} xf=Onnx{InputColumns={data_0} OutputColumns={softmaxout_1} model={squeezenet/00000001/model.onnx}}" });
Assert.Equal(0, x);
}
From f4fe2e21a6abf4368390a2b83d155aad7e451a07 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Wed, 30 Jan 2019 23:40:21 +0000
Subject: [PATCH 15/19] Folded more PR comments
---
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 4 ++--
src/Microsoft.ML.OnnxTransform/OnnxUtils.cs | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index 70c7792a68..bdce75aa1d 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -73,10 +73,10 @@ public sealed class Arguments : TransformInputBase
[Argument(ArgumentType.Multiple | ArgumentType.Required, HelpText = "Name of the output column.", SortOrder = 2)]
public string[] OutputColumns;
- [Argument(ArgumentType.AtMostOnce | ArgumentType.AtMostOnce, HelpText = "GPU device id to run on (e.g. 0,1,..). Null for CPU. Requires CUDA 9.1.", SortOrder = 3)]
+ [Argument(ArgumentType.AtMostOnce, HelpText = "GPU device id to run on (e.g. 0,1,..). Null for CPU. Requires CUDA 9.1.", SortOrder = 3)]
public int? GpuDeviceId = null;
- [Argument(ArgumentType.AtMostOnce | ArgumentType.AtMostOnce, HelpText = "If true, resumes execution on CPU upon GPU error. If false, will raise the GPU execption.", SortOrder = 4)]
+ [Argument(ArgumentType.AtMostOnce, HelpText = "If true, resumes execution on CPU upon GPU error. If false, will raise the GPU execption.", SortOrder = 4)]
public bool FallbackToCpu = false;
}
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
index bac380a302..e5e5d489a7 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxUtils.cs
@@ -82,7 +82,6 @@ public OnnxModel(string modelFile, int? gpuDeviceId = null, bool fallbackToCpu =
{
_modelFile = modelFile;
- // Reserve Int32.MinValue for test purpose.
if (gpuDeviceId != null)
{
try
From c1b7c67338a9bed4aded030a5e007c43033549f4 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Thu, 31 Jan 2019 00:44:11 +0000
Subject: [PATCH 16/19] minor change to kick of build status
---
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index bdce75aa1d..e11ff6200e 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -585,4 +585,3 @@ public override SchemaShape GetOutputSchema(SchemaShape inputSchema)
}
}
}
-
From 0ac8c0e8d48d536fbedd2a7f2e634bc9d91d82f6 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Thu, 31 Jan 2019 01:01:56 +0000
Subject: [PATCH 17/19] minor change to kick off random build failure
---
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index e11ff6200e..4141e46d05 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -584,4 +584,4 @@ public override SchemaShape GetOutputSchema(SchemaShape inputSchema)
return new SchemaShape(resultDic.Values);
}
}
-}
+}
\ No newline at end of file
From 45ce6596a155aa6c48a721ca91cb13f4b5c01847 Mon Sep 17 00:00:00 2001
From: jignparm
Date: Thu, 31 Jan 2019 01:48:46 +0000
Subject: [PATCH 18/19] minor change to kick off build
---
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index 4141e46d05..e11ff6200e 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -584,4 +584,4 @@ public override SchemaShape GetOutputSchema(SchemaShape inputSchema)
return new SchemaShape(resultDic.Values);
}
}
-}
\ No newline at end of file
+}
From af38c76e2c178f0b9a0d57494c477383ca0ce59d Mon Sep 17 00:00:00 2001
From: jignparm
Date: Thu, 31 Jan 2019 02:11:41 +0000
Subject: [PATCH 19/19] minor change to kick off build
---
src/Microsoft.ML.OnnxTransform/OnnxTransform.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
index e11ff6200e..4141e46d05 100644
--- a/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
+++ b/src/Microsoft.ML.OnnxTransform/OnnxTransform.cs
@@ -584,4 +584,4 @@ public override SchemaShape GetOutputSchema(SchemaShape inputSchema)
return new SchemaShape(resultDic.Values);
}
}
-}
+}
\ No newline at end of file