I have a C# unit test that load an ONNX model and do a prediction. The test works well in my Windows 11 box. But when I tested it in my Windows Server, it failed with a nullreference exception.
I wonder if the ONNX runtime package is compatible with Windows_NT.
Error message:
Failed Datahunter.Tests.BertSentenceSimilarity.NLPSearchTest.GivenTwoTitles_ThenFindOutSimilarityScore(title1: "Battery technologies mass weighted SDP", title2: "battery life cycle", expectedScore: 0.92900002) [508 ms]
Error Message:
System.TypeInitializationException : The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.
---- System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()
at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath)
at Datahunter.Tests.BertSentenceSimilarity.NLPSearchTest.GivenTwoTitles_ThenFindOutSimilarityScore(String title1, String title2, Single expectedScore) in D:\vsts-agent-win-x64-3.225.0\_work\60\s\DataHunter-Main\tests\Datahunter.Tests\BertSentenceSimilarity\NLPSearchTest.cs:line 95
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
at Microsoft.ML.OnnxRuntime.NativeMethods..cctor()
System information:
OS: Windows_NT
OSArchitecture: x64
OSVersion: 10.0.20348
To reproduce
in a Windows_NT box,
run a dotnet net unit test to load an ONNX model.
I have something like these.
private string _baseUncasedModelFromPytorchPath = @"BertSentenceSimilarity/bert-base-uncased.onnx";
public async Task GivenTwoTitles_ThenFindOutSimilarityScore(string title1, string title2, float expectedScore)
{
// Arrange
// Create an InferenceSession from the Model Path.
using var session = new InferenceSession(Path.GetFullPath(_baseUncasedModelFromPytorchPath));
using var runOptions = new RunOptions();
}
Describe the issue
I have a C# unit test that load an ONNX model and do a prediction. The test works well in my Windows 11 box. But when I tested it in my Windows Server, it failed with a nullreference exception.
I wonder if the ONNX runtime package is compatible with Windows_NT.
Error message:
System information: OS: Windows_NT OSArchitecture: x64 OSVersion: 10.0.20348
To reproduce
in a Windows_NT box, run a dotnet net unit test to load an ONNX model. I have something like these.
Urgency
No response
Platform
Windows
OS Version
10.0.20348
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.18.0
ONNX Runtime API
C#
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response