DL4J

Example of DL4J framework with CUSTOM endpoints

Including package to the classpath

Before starting to serve the model, let's add the main package to the classpath to load the whole necessary libraries to Jupyter Notebook kernel from Konduit-Serving.

%classpath add jar ../../konduit.jar

Classpaths can be considered similar to site-packages in the python ecosystem. It is loaded from each library that's to be imported to your code.

Let's start a server with an id of dl4j-mnist and use dl4j.json as the configuration file.

%%bash
konduit serve -id dl4j-mnist -c dl4j.json -rwm -b

You'll notice with the following message indicating the server is starting.

Starting konduit server...
Using classpath: /root/konduit/bin/../konduit.jar
INFO: Running command /root/miniconda/jre/bin/java -Dkonduit.logs.file.path=/root/.konduit-serving/command_logs/dl4j-mnist.log -Dlogback.configurationFile=/tmp/logback-run_command_a6000ad26ed94583.xml -jar /root/konduit/bin/../konduit.jar run --instances 1 -s inference -c dl4j.json -Dserving.id=dl4j-mnist
For server status, execute: 'konduit list'
For logs, execute: 'konduit logs dl4j-mnist'

Use konduit logs to get the logs of served model.

The output of logging is similar to the below.

We'll be able to use konduit list command to view all active servers.

These are examples of active servers if the previous one is still in use.

Sending an input to served model

We're going to display the test image first before feeding it into the model.

The previous image is used as the testing image for this deployed model:

Now, let's predict the input by using the test image above.

You'll see the following output with the label of classification.

Stopping the server

We can stop the running server by using konduit stop command.

You'll see this output once the mentioned id's server is terminated.

Last updated

Was this helpful?