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

Android build not work #295

Closed
MarcoLavoro opened this issue Jan 11, 2025 · 7 comments
Closed

Android build not work #295

MarcoLavoro opened this issue Jan 11, 2025 · 7 comments
Labels
bug Something isn't working

Comments

@MarcoLavoro
Copy link

Describe the bug

Hi I tried on android mobile with the model https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF/resolve/main/llama-3.2-1b-instruct-q4_k_m.gguf
But I get these errors:
AndroidPlayer "samsung_SM-G973F" DllNotFoundException: libundreamai_android assembly: type: member:(null)
at (wrapper managed-to-native) LLMUnity.LLMLib.LLM_StartStatic(intptr)
at LLMUnity.LLMLib.LLM_Start (System.IntPtr LLMObject) [0x00001] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:436
at LLMUnity.LLM.b__81_0 () [0x00000] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:544
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)
LLMUnity.LLMLib:LLM_StartStatic(IntPtr)
LLMUnity.LLMLib:LLM_Start(IntPtr) (at C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:436)
LLMUnity.LLM:b__81_0() (at C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:544)
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

and

Autoconnected Player "Autoconnected Player" DllNotFoundException: libundreamai_android assembly: type: member:(null)
at (wrapper managed-to-native) LLMUnity.LLMLib.LLM_StartStatic(intptr)
at LLMUnity.LLMLib.LLM_Start (System.IntPtr LLMObject) [0x00001] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:436
at LLMUnity.LLM.b__81_0 () [0x00000] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:544
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)
LLMUnity.LLMLib:LLM_StartStatic(IntPtr)
LLMUnity.LLMLib:LLM_Start(IntPtr) (at C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:436)
LLMUnity.LLM:b__81_0() (at C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:544)
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

Steps to reproduce

just downloaded the package, downloaded the model and builded the mobile scene

LLMUnity version

No response

Operating System

None

@MarcoLavoro MarcoLavoro added the bug Something isn't working label Jan 11, 2025
@amakropoulos
Copy link
Collaborator

Posting here as well 🙂:
Can you remove the Assets/StreamjngAssets/undreamai* folder and restart Unity?

@MarcoLavoro
Copy link
Author

Posting here as well 🙂: Can you remove the Assets/StreamjngAssets/undreamai* folder and restart Unity?

i did it and now I have more errors:

Could not find a part of the path "C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\StreamingAssets\undreamai-v1.2.1-llamacpp\setup\undreamai-v1.2.1-llamacpp.zip.complete".
UnityEngine.Debug:LogError (object)
LLMUnity.LLMUnitySetup:LogError (string) (at Assets/LLMUnity/Runtime/LLMUnitySetup.cs:185)
LLMUnity.LLMUnitySetup/d__43:MoveNext () (at Assets/LLMUnity/Runtime/LLMUnitySetup.cs:463)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
LLMUnity.LLMUnitySetup/d__41:MoveNext () (at Assets/LLMUnity/Runtime/LLMUnitySetup.cs:414)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult ()
LLMUnity.LLMUnitySetup/d__31:MoveNext () (at Assets/LLMUnity/Runtime/LLMUnitySetup.cs:289)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

and

IOException: Cannot create a file when that file already exists
System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) (at <467a840a914a47078e4ae9b0b1e8779e>:0)
System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at <467a840a914a47078e4ae9b0b1e8779e>:0)
LLMUnity.LLMBuilder.HandleActionFileRecursive (System.String source, System.String target, LLMUnity.ActionCallback actionCallback) (at Assets/LLMUnity/Runtime/LLMBuilder.cs:39)
LLMUnity.LLMBuilder.HandleActionFileRecursive (System.String source, System.String target, LLMUnity.ActionCallback actionCallback) (at Assets/LLMUnity/Runtime/LLMBuilder.cs:49)
LLMUnity.LLMBuilder.MovePath (System.String source, System.String target) (at Assets/LLMUnity/Runtime/LLMBuilder.cs:81)
LLMUnity.LLMBuilder.MoveAction (System.String source, System.String target, System.Boolean addEntry) (at Assets/LLMUnity/Runtime/LLMBuilder.cs:123)
LLMUnity.LLMBuilder.Reset () (at Assets/LLMUnity/Runtime/LLMBuilder.cs:220)
LLMUnity.LLMBuildProcessor.b__5_0 () (at Assets/LLMUnity/Editor/LLMBuildProcessor.cs:79)
UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at <3d611f181d2047d0a4666e5262482490>:0)

and

Autoconnected Player "Autoconnected Player" DllNotFoundException: libundreamai_android assembly: type: member:(null)
at (wrapper managed-to-native) LLMUnity.LLMLib.LLM_StartStatic(intptr)
at LLMUnity.LLMLib.LLM_Start (System.IntPtr LLMObject) [0x00001] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:436
at LLMUnity.LLM.b__81_0 () [0x00000] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:544
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)
LLMUnity.LLMLib:LLM_StartStatic(IntPtr)
LLMUnity.LLMLib:LLM_Start(IntPtr) (at C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:436)
LLMUnity.LLM:b__81_0() (at C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:544)
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

and

Autoconnected Player "Autoconnected Player" DllNotFoundException: libundreamai_android assembly: type: member:(null)
at (wrapper managed-to-native) LLMUnity.LLMLib.LLM_StartedStatic(intptr)
at LLMUnity.LLMLib.LLM_Started (System.IntPtr LLMObject) [0x00001] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLMLib.cs:437
at LLMUnity.LLM.StartService () [0x00028] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:546
at LLMUnity.LLM.CallWithLock (LLMUnity.EmptyCallback fn) [0x00027] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:518
at LLMUnity.LLM.StartLLMServer (System.String arguments) [0x000e9] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:503
at LLMUnity.LLM+<>c__DisplayClass54_0.b__0 () [0x00000] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:132
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in :0
at System.Threading.Tasks.Task.Execute () [0x00000] in :0
--- End of stack trace from previous location where exception was thrown ---

at LLMUnity.LLM.Awake () [0x0013f] in C:\OFFLINEPROJECTS\MACELLAZIONE\NEWLLMTesting\LLMANDROID\Assets\LLMUnity\Runtime\LLM.cs:132
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) [0x00000] in :0
at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00002] in /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153
at UnityEngine.UnitySynchronizationContext.Exec () [0x0005d] in /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83
at UnityEngine.UnitySynchronizationContext.ExecuteTasks () [0x00014] in /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107

@amakropoulos
Copy link
Collaborator

can you also try this folder:
C:\Users[USER]\AppData\Local\Temp[COMPANY][PROJECT]\LLMUnityBuild
or start from a new project?

@MarcoLavoro
Copy link
Author

can you also try this folder: C:\Users[USER]\AppData\Local\Temp[COMPANY][PROJECT]\LLMUnityBuild or start from a new project?

I deleted the folder and I tried with a new project but I still get the same issue :(

@MarcoLavoro
Copy link
Author

can you also try this folder: C:\Users[USER]\AppData\Local\Temp[COMPANY][PROJECT]\LLMUnityBuild or start from a new project?

nevermind, after 4 times i tried to use unity 2023 and it worked as aspected!
thanks!

@MarcoLavoro
Copy link
Author

can you also try this folder: C:\Users[USER]\AppData\Local\Temp[COMPANY][PROJECT]\LLMUnityBuild or start from a new project?

little update:

on the RAGAndLLM_Scene, if I use for:
LLMRAG
LLM

the model:
llama-3.2-1b-instruct-q4_k_m.gguf

it works, but If I use a larger model on
LLMRAG

I get this error, How can I discover what it is and how to solve?

ArgumentException: Vector lengths must be equal for dot product calculation
LLMUnity.SearchMethod.DotProduct (System.Single[] vector1, System.Single[] vector2) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/Search.cs:318)
LLMUnity.SearchMethod.InverseDotProduct (System.Single[] vector1, System.Single[] vector2) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/Search.cs:329)
LLMUnity.SearchMethod.InverseDotProduct (System.Single[] vector1, System.Single[][] vector2) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/Search.cs:337)
LLMUnity.SimpleSearch.IncrementalSearch (System.Single[] embedding, System.String group) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/SimpleSearch.cs:42)
LLMUnity.SearchMethod.IncrementalSearch (System.String queryString, System.String group) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/Search.cs:426)
LLMUnity.RAG.IncrementalSearch (System.String queryString, System.String group) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/RAG.cs:118)
LLMUnity.Searchable.Search (System.String queryString, System.Int32 k, System.String group) (at ./Library/PackageCache/ai.undream.llm@e040c97679/Runtime/RAG/Search.cs:117)
LLMUnitySamples.RAGAndLLMSample.onInputFieldSubmit (System.String message) (at Assets/Samples/LLM for Unity/2.4.1/RAG/RAGAndLLM_Sample.cs:15)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) (at <07ba9f98d9794cf19aca0392570e5637>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at :0)
UnityEngine.UnitySynchronizationContext.Exec () (at :0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at :0)

@amakropoulos
Copy link
Collaborator

The embeddings need to be recalculated because you changed the model,
You just need to delete the Assets/StreamingsAssets/RAGSample.zip file and it will work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants