Skip to content

HuggingFaceTokenizer: add support for Android#3531

Merged
xyang16 merged 3 commits intodeepjavalibrary:masterfrom
naveen521kk:tokenizer-android-support
Nov 17, 2024
Merged

HuggingFaceTokenizer: add support for Android#3531
xyang16 merged 3 commits intodeepjavalibrary:masterfrom
naveen521kk:tokenizer-android-support

Conversation

@naveen521kk
Copy link
Copy Markdown
Contributor

Description

This PR fixes #2170.

This PR does the following:

  • Add scripts to build the Rust library in extensions/tokenizers/rust using cargo-ndk
  • Disable the "http" feature for Rust library when building with Android
  • Create a wrapper android package to use the built libraries to publish, like pytorch-native.

CI support for this is yet to be figured out.

- Build the Rust library for Android using `cargo-ndk`
- Disable "http" feature for Rust library when building with Android
- Modify to load native library in Android
- Copy from pytorch-native and change for tokenizer native modules
@xyang16 xyang16 merged commit f00f18e into deepjavalibrary:master Nov 17, 2024
@naveen521kk naveen521kk deleted the tokenizer-android-support branch November 17, 2024 06:09
@usertomlin
Copy link
Copy Markdown

I used tokenizer-native-0.33.0.aar.
image

And the following dependencies are also added in the gradle file.
implementation "ai.djl.huggingface:tokenizers:0.33.0"
implementation "ai.djl:api"
implementation "ai.djl.android:core"

But the following UnsatisfiedLinkError occurred when calling HuggingFaceTokenizer.newInstance(tokenizerFile.toPath());:

image

java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found: needed by /data/app/~~1W6tsQLPTT7TIe89LcEqSg

How to solve the problem above in an Android project ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HuggingFaceTokenizer android load

4 participants