Documentation
¶
Overview ¶
Package inference calls a model server and turns its answer back into rows.
Hermod does not run models in its own process: it is built without cgo, and a model that runs out of memory must not take a CDC pipeline down with it. A model is served by something else — Hermod's own hermod-ml worker, KServe, Triton, Seldon MLServer or an MLflow scoring server — and this package is the one client every caller (the Predict node, the REST and gRPC serving endpoints) goes through.
Two wire protocols cover those servers:
- BackendOIP, the Open Inference Protocol (KServe "V2"), spoken by KServe, Triton, MLServer and hermod-ml: POST {url}/v2/models/{model}[/versions/{v}]/infer.
- BackendMLflow, the MLflow scoring server: POST {url}/invocations.
Index ¶
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout bounds a call whose Target names none.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls model servers.
type Target ¶
type Target struct {
Backend Backend
// URL is the server's base URL, without the protocol's path.
URL string
// Model and Version name the model on an OIP server. Version may be empty
// for the server's default. MLflow serves one model per URL and ignores both.
Model string
Version string
// Token, when set, is sent as "Authorization: Bearer <Token>".
Token string
// InputName switches OIP to matrix mode: one FP32 tensor of this name,
// shaped [rows, len(Features)], with the values in Features order. This is
// what an ONNX model exported from scikit-learn, PyTorch or TensorFlow
// usually takes. Empty means column mode: one tensor per field.
InputName string
Features []string
// Timeout bounds the whole call. Zero means DefaultTimeout.
Timeout time.Duration
}
Target says where a model is served and how to call it.