Skip to content
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

ONNX Runtime v1.16.2 crashes with Unity IDE #18441

Open
Storm-Develop opened this issue Nov 14, 2023 · 3 comments
Open

ONNX Runtime v1.16.2 crashes with Unity IDE #18441

Storm-Develop opened this issue Nov 14, 2023 · 3 comments
Labels
api:CSharp issues related to the C# API platform:windows issues related to the Windows platform stale issues that have not been addressed in a while; categorized by a bot

Comments

@Storm-Develop
Copy link

Describe the issue

Starting from ONNX Runtime v1.15.0 Unity crashes upon trying to create inference session from the .onnx model.

Note: ONNX Runtime v1.14.1 works as expected.

It gives out of memory exception.

 =================================================================
	Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at System.Buffer:InternalMemcpy <0x000d5>
	  at System.Buffer:Memcpy <0x0010a>
	  at System.String:memcpy <0x00082>
	  at Microsoft.ML.OnnxRuntime.NativeMethods:.cctor <0x001ba>
	  at System.Object:runtime_invoke_void <0x00184>
	  at <unknown> <0xffffffff>
	  at System.Object:__icall_wrapper_mono_generic_class_init <0x000c2>
	  at Microsoft.ML.OnnxRuntime.SessionOptions:.ctor <0x002c2>
	  at Microsoft.ML.OnnxRuntime.InferenceSession:.ctor <0x0017a>

It seems like changes introduced at v1.15.0 break for Unity environment.
It's targeting .NET Standard 2.1

To reproduce

Have UNITY IDE v 2022.3.3f1 or any other Unity 2022 version

Import Microsoft.ML.OnnxRuntime & Microsoft.ML.OnnxRuntime.Managed packages in the project

The import could be made by manually copying .NET Standard Microsoft.ML.OnnxRuntime DLL
Or use Nuget Manager ( https://github.com/GlitchEnzo/NuGetForUnity) to install the Onnx packages

Try to create a session using onnx model.
`using var session = new InferenceSession(path);

Run in the Unity editor in the playback mode or as Unity test.

Urgency

No response

Platform

Windows

OS Version

Windows 11 OS Build:22621.2428

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

v1.15.0

ONNX Runtime API

C#

Architecture

X64

Execution Provider

Other / Unknown

Execution Provider Library Version

No response

@github-actions github-actions bot added the platform:windows issues related to the Windows platform label Nov 14, 2023
@snnn snnn added the api:CSharp issues related to the C# API label Nov 15, 2023
Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Dec 15, 2023
@Storm-Develop
Copy link
Author

Well, the issue is still not resolved, any version after the v1.14.1 causes the crash in the Unity Editor.

@tonglinyan
Copy link

Hello, I'm using v1.17.1 and met the same problem. Have you find a solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:CSharp issues related to the C# API platform:windows issues related to the Windows platform stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

3 participants