unionml
unionml copied to clipboard
As a Flyte user with a model artifact produced by a task, I want to deploy using UnionML
The purpose of this task is to add necessary functionality and docs to UnionML that would enable users to use unionml
as a light serving layer on top of their more complex Flyte training workflows.
The idea is the following: as long as the output of a Flyte workflow produces a model object that can be used for prediction, unionml should be able to load it from Flyte for serving.
Train a model in Flyte
# A potentially complex workflow that produces a model
@workflow
def training_workflow() -> ModelObject:
...
remote = FlyteRemote(...)
execution = remote.execute(training_workflow)
Serve it using UnionML
from unionml import Model, Dataset
dataset = dataset(...)
model = Model(..., dataset=dataset)
@model.predictor
def predictor(model_obj, features):
# compute predictions here
...
# e.g. serving with FastAPI
model.serve(app=FastAPI(), execution=execution)