Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Latest commit

 

History

History
36 lines (28 loc) · 1.52 KB

HowToAddAnOperator_en.md

File metadata and controls

36 lines (28 loc) · 1.52 KB

Customize an operator

Have you ever come across the following issues and wanted to implement an operator on your own?

  • The threshold settings of the embedded operator are not up to scratch.
  • The embedded operator models do not meet the precision requirements.
  • I find a novel SOTA model from a latest paper.
  • I'm fine tuning specific fields of the commonly used models.

Prerequisites

  1. Proficient in Python programming.
  2. Intimate knowledge of gRPC and protobuf.
  3. Command of basic Docker commands.

Customize an operator

To customer an operator:

  1. Prepare a model.
  2. Implement an gRPC interface under the rpc directory.
  3. Tune and package it to a Docker image.

Example: Implement an operator

Directory structure of an operator

From example-custom-operator, you can see a simplest directory structure of an operator.

  1. The data directory holds scripts for downloading model files. When you download an image file, it is used to download models.
  2. The rpc directory holds python files generated by gRPC.
  3. The server file under the main directory keeps logics related to gRPC server.
  4. The custom_operator file under the main directory provides interfaces required by the rpc file.

gRPC interface descriptions

You can find proto files here.

You need to implement a total of three interfaces.

  1. Execute: Runs this operator.
  2. Healthy: Checks if the operator is up running.
  3. Identity: Returns information of the operator, such as name, type, and port.