deepjavalibrary / djl-demo

Demo applications showcasing DJL
https://demo.djl.ai
Apache License 2.0
307 stars 127 forks source link

Reranking example run failed, djl version 0.28.0 #494

Open kdYY opened 1 month ago

kdYY commented 1 month ago

when I run this code https://github.com/deepjavalibrary/djl-demo/blob/master/huggingface/nlp/src/main/java/com/examples/Reranking.java, it failed

WechatIMG18

frankfliu commented 1 month ago

@kdYY

Seems you are not running the project using djl-demo repo, can you share your build.gradle or pom.xml file?

I think you didn't include tokenizer dependency: https://github.com/deepjavalibrary/djl-demo/blob/master/huggingface/nlp/build.gradle.kts#L19

kdYY commented 1 month ago

@kdYY

似乎您没有使用 djl-demo repo 运行项目,您可以分享您的 build.gradle 或 pom.xml 文件吗?

我认为你没有包含 tokenizer 依赖项:https://github.com/deepjavalibrary/djl-demo/blob/master/huggingface/nlp/build.gradle.kts#L19

<dependency>
            <groupId>com.microsoft.onnxruntime</groupId>
            <artifactId>onnxruntime</artifactId>
            <version>1.18.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ai.djl.pytorch</groupId>
            <artifactId>pytorch-engine</artifactId>
            <version>0.28.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ai.djl</groupId>
            <artifactId>api</artifactId>
            <version>0.28.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ai.djl</groupId>
            <artifactId>model-zoo</artifactId>
            <version>0.28.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ai.djl.huggingface</groupId>
            <artifactId>tokenizers</artifactId>
            <version>0.28.0</version>
            <scope>compile</scope>
        </dependency>

@frankfliu here

frankfliu commented 1 month ago

Can you create a demo project that can reproduce this issue? Can you try to run Ranking.java from djl-demo repo and see if that work for you?