natmlx / natml-unity

High performance, cross-platform machine learning for Unity Engine.
Apache License 2.0
230 stars 25 forks source link

Async `MLEdgeModel.Create` is still blocking the main thread on Android #49

Closed ghost closed 1 year ago

ghost commented 1 year ago
Screen Shot 2023-03-14 at 20 04 27

These are the models being loaded (both are embedded):

This cannot be solved by calling MLEdgeModel.Create on a non-main thread as it makes a call to PlayerPrefs.GetString which is a main thread only API.

Happens on latest NatML (1.1.3)

olokobayusuf commented 1 year ago

@joseph-o3h found the cause to be some very weird C++ quirk. Fix coming later today or tomorrow morning.

olokobayusuf commented 1 year ago

@joseph-o3h fixed in NatML 1.1.4. Thank you so much for catching this!

olokobayusuf commented 1 year ago

Oh, and MLEdgeModel.Create can now be called from any arbitrary thread. That was also an excellent catch 😉