Skip to content

Sentiment analysis example

In this example, you learn how to use the DistilBERT model trained by HuggingFace using PyTorch. You can provide the model with a question and a paragraph containing an answer. The model is then able to find the best answer from the answer paragraph. You can find the source code in


Input text for analysis

I like DJL. DJL is the best DL framework!


    class: "Positive", probability: 0.99864
    class: "Negative", probability: 0.00135

Setup guide

Follow setup to configure your development environment.

Run Inference

cd examples
./gradlew run -Dmain=ai.djl.examples.inference.SentimentAnalysis