Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
17.18k stars 4.16k forks source link

Building for iOS - Unable to load DLL 'libtensorflow' #1528

Closed taesiri closed 5 years ago

taesiri commented 5 years ago

Hello,

I am following this guide for building on iOS. After game loads on the iPhone I am getting this error message on Xcode debug console:

DllNotFoundException: Unable to load DLL 'libtensorflow': The specified module could not be found.
  at MLAgents.InferenceBrain.TFSharpInferenceEngine.TF_OperationGetAttrShape (System.IntPtr oper, System.String attr_name, System.Int64[] value, System.Int32 num_dims, System.IntPtr status) [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.InferenceBrain.TFSharpInferenceEngine.GetOpMetadata (TensorFlow.TFOperation op) [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.InferenceBrain.TFSharpInferenceEngine.InputFeatures () [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.InferenceBrain.ModelParamLoader.CheckInputTensorPresence (System.Int32 memory, MLAgents.InferenceBrain.ModelParamLoader+ModelActionType isContinuous) [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.InferenceBrain.ModelParamLoader.GenerateChecks () [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.InferenceBrain.ModelParamLoader.GetLoaderAndCheck (MLAgents.InferenceBrain.TFSharpInferenceEngine engine, MLAgents.BrainParameters brainParameters) [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.LearningBrain.ReloadModel (System.Int32 seed) [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.Brain.LazyInitialize () [0x00000] in <00000000000000000000000000000000>:0 
  at MLAgents.Academy.InitializeEnvironment () [0x00000] in <00000000000000000000000000000000>:0 

Am I missing something?

Unity version is 2018.3.0f1 and ML-Agents is Beta 0.6.0.

awjuliani commented 5 years ago

@xiaomaogy Are you familiar with this issue?

MeTheOo commented 5 years ago

I also have this issue running on iPad mini 2

MeTheOo commented 5 years ago

I fixed this issue by changing [DllImport("libtensorflow")] to [DllImport("__Internal")] in TFSharpInferenceEngine.cs

xiaomaogy commented 5 years ago

I haven't tried the ml-agents v0.6 on iOS platform yet. Let's add this to the trello card and pick it up when it is its turn. @awjuliani

taesiri commented 5 years ago

@MeTheOo's solution is working for me.

awjuliani commented 5 years ago

We are now using the internal Unity inference solution as of v0.7. Closing this issue for now. Please feel free to re-open if you deem it necessary.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.