This module contains examples to demonstrate use of the Deep Java Library (DJL). You can find more examples from our djl-demo github repo.
The following examples are included for training:
The following examples are included for inference:
These examples focus on the overall experience of training and inference. We keep components that are reusable within separate modules for other users to take advantage of in their own applications. For examples and references on creating datasets, look at the basic dataset module. For examples and references on building models and translators, look in our basic model zoo.
More examples and demos of applications featuring DJL are located in our demo repository.
This example supports building with both Gradle and Maven. To build, use either of the following commands:
cd examples # for Linux/macOS: ./gradlew jar # for Windows: ..\gradlew jar
cd examples mvn package -DskipTests
With the gradle
application plugin you can execute example code directly.
For more information on running each example, see the example’s documentation.
The following command executes an object detection example:
cd examples # for Linux/macOS: ./gradlew run # for Windows: ..\gradlew run
cd examples mvn clean package -DskipTests mvn exec:java
DJL is engine agnostic, so it’s capable of supporting different backends.
With Apache MXNet, PyTorch, TensorFlow and ONNX Runtime, you can choose different
builds of the native library.
We recommend the automatic engine selection which downloads the best engine for your
platform and available hardware during the first runtime.
Activate the automatic selection by adding
for Apache MXNet, and
ai.djl.pytorch:pytorch-native-auto:1.8.1 for PyTorch as a dependency.
You can also see: