Konduit Serving works by defining a series of steps. These include operations such as
Pre- or post-processing steps
One or more machine learning models
Transforming the output in a way that can be understood by humans
If deploying your model does not require pre- nor post-processing, only one step - a machine learning model - is required. This configuration is defined using a single ModelStep.
Start by downloading the model weights to the data folder.The downloaded zip file can be unzipped using Util class(Util.unzipBertFile).
A reference Java project is provided in the Example repository ( https://github.com/KonduitAI/konduit-serving-examples ) with a Maven pom.xml dependencies file. If using the IntelliJ IDEA IDE, open the java folder as a Maven project and run the main function of InferenceModelStepBERT the class.
Configure the step
Define the TensorFlow configuration as a TensorFlowConfig object.
tensorDataTypesConfig: The TensorFlowConfig object requires a HashMap input_data_types. Its keys should represent column names, and the values should represent data types as strings, e.g. "INT32". See here for a list of supported data types.
modelConfigType: This argument requires a ModelConfigType object. Specify modelType as TENSORFLOW, and modelLoadingPath to point to the location of TensorFlow weights saved in the PB file format.
The inferenceConfiguration is stored as a JSON File. Set the KonduitServingMainArgs with the saved config.json file path as configPath and other necessary server configuration arguments.
Start server by calling KonduitServingMain with the configurations mentioned in the KonduitServingMainArgs using Callback Function(as per the code mentioned in the Inference Section below)
Inference
Load some sample data from NumPy files. Note that these are NumPy arrays, each with shape (4, 128):
To configure the client, set the required URL to connect server and specify any port number that is not reserved (as used in server configuration).
A Callback Function onSuccess is implemented in order to post the Client request and get the HttpResponse, only after the successful run of the KonduitServingMain Server.
Accepted input and output data formats are as follows:
Input: JSON, ARROW, IMAGE, ND4J (not yet implemented) and NUMPY.
Output: NUMPY, JSON, ND4J (not yet implemented) and ARROW.