-
Notifications
You must be signed in to change notification settings - Fork 414
Feature/add android support #1130
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
base: master
Are you sure you want to change the base?
Conversation
cc: @martindevans |
Is it CPU inference only or can we have GPU acceleration as well? |
It's only CPU in this PR. As far as I know, Mobile GPU inference is still quite slow at the moment. Saw it was even slower than CPU inference in some cases. Besides, it takes a bit of effort building CLBlast from source and trying to get that to work with the Android builds so I didn't consider it. |
<file src="runtimes/deps/osx-arm64/libllama.dylib" target="runtimes\osx-arm64\native\libllama.dylib" /> | ||
<file src="runtimes/deps/osx-arm64/libllava_shared.dylib" target="runtimes\osx-arm64\native\libllava_shared.dylib" /> | ||
|
||
<file src="runtimes/deps/android-arm64-v8a/libllama.so" target="runtimes\android-arm64-v8a\native\libllama.so" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be split into a separate Backend package for Android (e.g. Backend.CPU.Android
)?
I've given this a deeper look, overall it looks good! Left to resolve:
|
Great, thanks for the review. Will follow up with the requested changes later today. |
Hello @martindevans, I've made updates to the PR. Looks like we're good to go. Not sure how you trigger the Unit Test pipelines in this repo, though, to get a finite confirmation. |
Thanks @AmSmart, I'll be doing an update to the llama.cpp version soon (which will involve generating new binaries). I'll be basing that PR off this, so it should all be merged in then. |
Great. Glad to hear it |
Will this include VLM inference as well for multimodal models such as Qwen2.5-VL 0.5B or Gemma3 3b? Thanks |
namespace Llama.Mobile | ||
{ | ||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] | ||
public class MainActivity : MauiAppCompatActivity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we also need an AndroidManifest.xml file?
I'll take a look at it |
It looks like clip.cpp is incompatible with 32 bit architectures, so we might have to disable the x86 target. That doesn't seem like a huge loss, I can't imagine there are many x86 Android devices out there? |
Ahh, I see. Not surprising at all. Majority of Android devices are arm64, so you're right about it mostly being an acceptable/negligible loss. PS: I even had to disable building some of the binary examples because it didn't support x86. It's mostly a relic of the past at this point. |
Ok I disabled the x86 target and started a new test run: https://github.com/SciSharp/LLamaSharp/actions/runs/14580598934 |
Description of Changes
.nuspec
file.targets
file to include new Android additionsPlease let me know if any updates are required.