Basic

Simple example to demonstrate Konduit-Serving

In the first example, we’ll use normal operations as a model, but it is deploying on Konduit-Serving. You can give input and get the return of output from the server. This will make your model more straightforward to understand by humans as it can provide direct results.

Viewing directory structure

Let’s run cells with bash in a sub-process by using cell magic command and view files in the current directory that will be used in this demonstration.

%%bash
echo "Current directory $(pwd)" && tree

The following files are present in our simple python script demo.

Current directory /root/konduit/demos/0-python-simple
.
├── init_script.py
├── python-simple.ipynb
├── python.yaml
└── run_script.py

0 directories, 4 files

Viewing Python script content

The scripts contain a simple initialization script for an add function which loads the main function in the init_script.py and executes the incoming input through run_script.py.

%%bash
less init_script.py

You’ll be able to see the following.

Once again, let’s browse through the python script for the calling function from init_script.py.

You’ll notice the script only has a line of code.

Viewing the main configuration file

The main configuration should define the inputs as a and b and the output as c, just as we've showed in the run_script.py.

The YAML script file is as follows.

Using the configuration to start a server

Now we can use the konduit serve command to start the server in background with the given files and configurations.

You’ll get the message like this.

Listing the servers

We can list the created servers with konduit list command

The ID’s server lists like below, giving the status of the server.

Viewing logs

Logs can be viewed for the server with an ID of server through running konduit logs server .. command.

Logs output of started server:

Sending inputs

Now we’ll be able to send the inputs for inferring the output.

The output result of the function deployed from the server.

Stopping the server

Stop the server by giving the ID’s we want to terminate.

Status of the server will be printed out as below.

As you can see from this example, we only use a simple function to deploy in Konduit-Serving. Next, we'll deploy the model in Konduit-Serving.

Last updated

Was this helpful?