EVA UDF Registration #345
LordDarkula
started this conversation in
Ideas
Replies: 1 comment
-
I like the idea. How do you plan to send the annotated functions and the associated parameters (e.g., |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
EVA UDF Registration
Motivation
Current Approach
Currently, users must create UDFs by doing the following.
eva/udfs
AbstractClassifierUDF
,PytorchAbstractClassifierUDF
, orAbstractNdarrayUDF
depending on the type the UDF will operate on__call__()
,transform()
, andexec()
depending on the class that was inherited fromname()
,labels()
,get_predictions()
, etcProblems
There are a couple problems with the current approach.
Proposed Design
Many major platforms such as SnorkelAI and BentoML use decorators and that is the approach taken here. The user will write a series of functions and decorate them with metadata about the UDF.
The decorators needed to specify a UDF are
setup
,preprocess
, andforward
. Preprocess is optional and can be annotated separately from forward to help EVA optimize queries.Input and Output Specification
Both
preprocess()
andforward()
take an input and produce an output. EVA needs to know the type and format of these inputs and outputs.List[Tuple[Label, Bbox]]
Parameters
In order to add a UDF to EVA, EVA needs to know some information about the UDF to verify queries and execute them efficiently.
cache: bool
requirements: Optional[List[str] | Path]
requirements.txt
fileexternal_resources: Optional[List[Path]]
input_type: type
input_frame_shape: Tuple[int, int]
input_type: type
input_frame_shape: Tuple[int, int]
verify_output: bool
batch: bool
create_udf
exists_ok: bool
labels: List[str]
Preprocessing
Preprocessing is an optional step the user can define. If it is not defined, the query engine will feed frames into the
forward
function directly. The output signature ofpreprocess
must match the input signature offorward
.Examples
Implementation
EVA is split into two parts:
eva_server
andeva_client
. EVA registration will be client-side. The API will be packaged as a python package. Thecreate_udf()
function will send the annotated functions and the associated parameters to the server. The code will internally be converted into a class and saved as a python file inudfs/{udf-name}
. The parameters will be stored as a json file.Beta Was this translation helpful? Give feedback.
All reactions