Skip to content

libtokenizers.so problems on alpine #2946

Description

@fenss

Description

(A clear and concise description of what the bug is.)
Hello, I want to use DJL on my project because the backend is written by JAVA.
I only use the HuggingFaceTokenizer, everythings going well on windows.
But its not working when we deploying to alpine:

java.lang.UnsatisfiedLinkError: /root/.djl.ai/tokenizers/0.15.0-0.26.0-linux-x86_64/libtokenizers.so: Error relocating /root/.djl.ai/tokenizers/0.15.0-0.26.0-linux-x86_64/libtokenizers.so: __register_atfork: symbol not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1946)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1828)
at java.lang.Runtime.load0(Runtime.java:810)
at java.lang.System.load(System.java:1088)
at ai.djl.huggingface.tokenizers.jni.LibUtils.loadLibrary(LibUtils.java:76)
at ai.djl.huggingface.tokenizers.jni.LibUtils.(LibUtils.java:41)
at ai.djl.huggingface.tokenizers.HuggingFaceTokenizer.newInstance(HuggingFaceTokenizer.java:173)
at ai.djl.huggingface.tokenizers.HuggingFaceTokenizer.newInstance(HuggingFaceTokenizer.java:138)
at ai.djl.huggingface.tokenizers.HuggingFaceTokenizer.newInstance(HuggingFaceTokenizer.java:121)

It seems the libtokenizers.so and the alpine image are incompatible, can we fix this?

Environment Info

System: runtime-jre8u302-alpine
DJL version:

        <dependency>
            <groupId>ai.djl.huggingface</groupId>
            <artifactId>tokenizers</artifactId>
            <version>0.26.0</version>
        </dependency>

I checked the source code about loading libtokenizers.so:
LibUtils.java
Platform.java
And I checked the system info by:

System.out.println("System: " + System.getProperty("os.name") + "; OSArch: " + System.getProperty("os.arch"));

Output:

System: Linux; OSArch: amd64

So how to solve this? Do I need to compile the rust tokenizer on alpine?

Need help, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions